#include "sparsematrix.hpp"
#include "listvector.hpp"
-typedef list<PCell>::iterator MatData;
/***********************************************************************/
/***********************************************************************/
-void SparseMatrix::rmCell(MatData data){
+MatData SparseMatrix::rmCell(MatData data){
try {
if(data->vectorMap != NULL ){
*(data->vectorMap) = NULL;
data->vectorMap = NULL;
}
- matrix.erase(data);
+ data = matrix.erase(data);
numNodes--;
-
+ return(data);
// seems like i should be updating smallDist here, but the only time we remove cells is when
// clustering and the clustering algorithm updates smallDist
}
void SparseMatrix::print(){
try {
int index = 0;
-
- mothurOutEndLine();
- mothurOut("Index\tRow\tColumn\tDistance");
- mothurOutEndLine();
+
+ cout << endl << "Index\tRow\tColumn\tDistance" << endl;
for(MatData currentCell=matrix.begin();currentCell!=matrix.end();currentCell++){
- mothurOut(toString(index) + "\t" + toString(currentCell->row) + "\t" + toString(currentCell->column) + "\t" + toString(currentCell->dist)); mothurOutEndLine();
+ cout << index << '\t' << currentCell->row << '\t' << currentCell->column << '\t' << currentCell->dist << endl;
index++;
}
}
try {
int index = 0;
- mothurOutEndLine();
- mothurOut("Index\tRow\tColumn\tDistance");
- mothurOutEndLine();
-
+ mothurOutEndLine(); mothurOut("Index\tRow\tColumn\tDistance"); 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();
}
}
- 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;i<mins.size();i++){
mins[i]->vectorMap = &mins[i]; //assign vectorMap to the address for the container