diff options
author | Calvin Morrison <mutantturkey@gmail.com> | 2014-03-09 14:35:55 -0400 |
---|---|---|
committer | Calvin Morrison <mutantturkey@gmail.com> | 2014-03-09 14:35:55 -0400 |
commit | ef09fc14190dbc72a46cc48a29775acce2ed9dcf (patch) | |
tree | 346a706cb19b8756f65de8296c3de1b918d31a64 /src | |
parent | c337a6b4cfc43f700d8b3e996a8a32919d3de053 (diff) |
work towards fix
Diffstat (limited to 'src')
-rw-r--r-- | src/c/multifasta_to_otu.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/c/multifasta_to_otu.c b/src/c/multifasta_to_otu.c index 6dc4a34..9266e21 100644 --- a/src/c/multifasta_to_otu.c +++ b/src/c/multifasta_to_otu.c @@ -403,13 +403,13 @@ int main(int argc, char **argv) { double *count_matrix_rare = calloc(rare_width, sizeof(double)); check_malloc(count_matrix_rare, NULL); - double *sensing_matrix_rare = malloc((rare_width) * sequences * sizeof(double)); + double *sensing_matrix_rare = calloc(rare_width * sequences, sizeof(double)); check_malloc(sensing_matrix_rare, NULL); // copy only kmers from our original counts that match our rareness percentage // in both our count matrix and our sensing matrix for(x = 0, y = 1; x < width; x++) { - if(count_matrix[x] < rare_value) { + if(count_matrix[x] <= rare_value) { count_matrix_rare[y] = count_matrix[x]; for(z = 0; z < sequences; z++) @@ -440,6 +440,13 @@ int main(int argc, char **argv) { sensing_matrix_rare[x*rare_width] = 1.0; } + size_t zz; + for(y = 0; y < sequences; y++) { + for(zz = 0; zz < rare_width - 1; zz++) + printf("%lf\t", sensing_matrix_rare[rare_width * y + zz]); + printf("%lf\n", sensing_matrix_rare[rare_width * y + rare_width - 1]); + } + double *solution = nnls(sensing_matrix_rare, count_matrix_rare, sequences, rare_width); // add the current solution to the solutions array |