X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=cooccurrencecommand.cpp;h=45bc0f58dd9cbf5fbcb32a7038fde29fb749551d;hb=4418e128575c1d667720090d7b45d9b48de81a3a;hp=b4965f5a91a2d12e4101aadc3b7258741de4945f;hpb=0a9e6ac8c01605781f78ce5de0515fe6d271eb97;p=mothur.git diff --git a/cooccurrencecommand.cpp b/cooccurrencecommand.cpp index b4965f5..45bc0f5 100644 --- a/cooccurrencecommand.cpp +++ b/cooccurrencecommand.cpp @@ -318,7 +318,7 @@ int CooccurrenceCommand::getCooccurrence(vector& thisLookUp } } //don't need a prob matrix because we just shuffle the rows, may use this in the future -// else if (matrix == "sim2") { + else if (matrix == "sim2") { } // for(int i=0;i& thisLookUp } //populate null matrix from probability matrix, do this a lot. - for(int i=0;i(ncols, 0)); @@ -420,6 +420,7 @@ int CooccurrenceCommand::getCooccurrence(vector& thisLookUp if(matrix == "sim1" || matrix == "sim6" || matrix == "sim8" || matrix == "sim7") { count = 0; while(count < n) { + if (m->control_pressed) { return 0; } nextnum2: previous = 0.0; randnum = rand() / double(RAND_MAX); @@ -453,10 +454,12 @@ int CooccurrenceCommand::getCooccurrence(vector& thisLookUp previous = 0.0; count = 0; while(count < rowtotal[i]) { + previous = 0.0; + if (m->control_pressed) { return 0; } randnum = rand() / double(RAND_MAX); for(int j=0;j previous && nullmatrix[i][j] != 1) { + if((randnum <= current && randnum > previous && nullmatrix[i][j] != 1) || (previous==current)){ nullmatrix[i][j] = 1; count++; previous = 0.0; @@ -473,6 +476,7 @@ int CooccurrenceCommand::getCooccurrence(vector& thisLookUp for(int j=0;jcontrol_pressed) { return 0; } randnum = rand() / double(RAND_MAX); for(int i=0;i