]> git.donarmstrong.com Git - mothur.git/blobdiff - cooccurrencecommand.cpp
fixed sim4
[mothur.git] / cooccurrencecommand.cpp
index e1d60b7c18553b0d3de4df1e0dd6a87ea60b17af..f0a46aaf9dfc0a729df15549a7d8fecc4c02d52a 100644 (file)
@@ -408,11 +408,11 @@ int CooccurrenceCommand::getCooccurrence(vector<SharedRAbundVector*>& thisLookUp
 
         //burn-in for sim9    
         if(matrix == "sim9") {
-            for(int i=0;i<10000;i++) trial.swap_checkerboards (co_matrix, rowtotal, columntotal, ncols, nrows);
+            for(int i=0;i<10000;i++) trial.swap_checkerboards (co_matrix, ncols, nrows);
         }
 
         //populate null matrix from probability matrix, do this a lot.
-        for(int i=0;i<runs;i++){
+        for(int k=0;k<runs;k++){
             nullmatrix.clear();
             //zero-fill the null matrix
             nullmatrix.assign(nrows, vector<int>(ncols, 0));
@@ -450,9 +450,9 @@ int CooccurrenceCommand::getCooccurrence(vector<SharedRAbundVector*>& thisLookUp
             
             else if(matrix == "sim4") {
                 for(int i=0;i<nrows;i++) {
-                    previous = 0.0;
                     count = 0;
                     while(count < rowtotal[i]) {
+                        previous = 0.0;
                         randnum = rand() / double(RAND_MAX);
                         for(int j=0;j<ncols;j++) {
                             current = probabilityMatrix[ncols * i + j];
@@ -490,7 +490,7 @@ int CooccurrenceCommand::getCooccurrence(vector<SharedRAbundVector*>& thisLookUp
             
             //swap_checkerboards takes the original matrix and swaps checkerboards
             else if(matrix == "sim9") {
-                trial.swap_checkerboards (co_matrix, rowtotal, columntotal, ncols, nrows);
+                trial.swap_checkerboards (co_matrix, ncols, nrows);
             }
             else {
                 m->mothurOut("[ERROR]: No null model selected!\n\n"); m->control_pressed = true;