X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=sparsematrix.cpp;h=3a0ec6521720c1f89eb7c54ce47f60a2f81d364a;hb=3914b0d6480f67df53b1e838f51c4e6155710434;hp=8a873f74c2441c4dd50f20450ebe4882227ce32b;hpb=1b9d0a66e4737f31d16824fe93944880b9edc530;p=mothur.git diff --git a/sparsematrix.cpp b/sparsematrix.cpp index 8a873f7..3a0ec65 100644 --- a/sparsematrix.cpp +++ b/sparsematrix.cpp @@ -5,7 +5,7 @@ /***********************************************************************/ -SparseMatrix::SparseMatrix() : numNodes(0), minsIndex(0), smallDist(1e6){} +SparseMatrix::SparseMatrix() : numNodes(0), minsIndex(0), smallDist(1e6){ m = MothurOut::getInstance(); } /***********************************************************************/ @@ -34,7 +34,7 @@ MatData SparseMatrix::rmCell(MatData data){ // clustering and the clustering algorithm updates smallDist } catch(exception& e) { - errorOut(e, "SparseMatrix", "rmCell"); + m->errorOut(e, "SparseMatrix", "rmCell"); exit(1); } } @@ -50,7 +50,7 @@ void SparseMatrix::addCell(PCell value){ } } catch(exception& e) { - errorOut(e, "SparseMatrix", "addCell"); + m->errorOut(e, "SparseMatrix", "addCell"); exit(1); } } @@ -66,7 +66,7 @@ void SparseMatrix::clear(){ smallDist = 1e6; } catch(exception& e) { - errorOut(e, "SparseMatrix", "clear"); + m->errorOut(e, "SparseMatrix", "clear"); exit(1); } } @@ -97,7 +97,7 @@ void SparseMatrix::print(){ } } catch(exception& e) { - errorOut(e, "SparseMatrix", "print"); + m->errorOut(e, "SparseMatrix", "print"); exit(1); } } @@ -108,15 +108,15 @@ void SparseMatrix::print(ListVector* list){ try { int index = 0; - mothurOutEndLine(); mothurOut("Index\tRow\tColumn\tDistance"); mothurOutEndLine(); + m->mothurOutEndLine(); m->mothurOut("Index\tRow\tColumn\tDistance"); m->mothurOutEndLine(); for(MatData currentCell=matrix.begin();currentCell!=matrix.end();currentCell++){ - mothurOut(toString(index) + "\t" + toString(list->get(currentCell->row)) + "\t" + toString(list->get(currentCell->column)) + "\t" + toString(currentCell->dist)); mothurOutEndLine(); + m->mothurOut(toString(index) + "\t" + toString(list->get(currentCell->row)) + "\t" + toString(list->get(currentCell->column)) + "\t" + toString(currentCell->dist)); m->mothurOutEndLine(); index++; } } catch(exception& e) { - errorOut(e, "SparseMatrix", "print"); + m->errorOut(e, "SparseMatrix", "print"); exit(1); } } @@ -136,7 +136,7 @@ PCell* SparseMatrix::getSmallestCell(){ // if the mins vector is empty go here... if(mins.empty()){ mins.clear(); - + smallDist = begin()->dist; //set the first candidate small distance for(MatData currentCell=begin();currentCell!=end();currentCell++){ @@ -153,7 +153,7 @@ PCell* SparseMatrix::getSmallestCell(){ } } -// random_shuffle(mins.begin(), mins.end()); //randomize the order of the iterators in the mins vector + random_shuffle(mins.begin(), mins.end()); //randomize the order of the iterators in the mins vector for(int i=0;ivectorMap = &mins[i]; //assign vectorMap to the address for the container @@ -168,7 +168,7 @@ PCell* SparseMatrix::getSmallestCell(){ return smallCell; } catch(exception& e) { - errorOut(e, "SparseMatrix", "getSmallestCell"); + m->errorOut(e, "SparseMatrix", "getSmallestCell"); exit(1); } }