diff options
author | Calvin Morrison <mutantturkey@gmail.com> | 2013-10-29 15:09:25 -0400 |
---|---|---|
committer | Calvin Morrison <mutantturkey@gmail.com> | 2013-10-29 15:09:25 -0400 |
commit | bd5b32238f99a979c57a0a5930cc303427a6356a (patch) | |
tree | e0ae375561c46fe497626b111bf28ecffb28a997 /src/c/quikr_functions.c | |
parent | dc260da91504a190b1833ad6859716a0116d7d4a (diff) |
use type in memset, add +1 to our matrix width
Diffstat (limited to 'src/c/quikr_functions.c')
-rw-r--r-- | src/c/quikr_functions.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/c/quikr_functions.c b/src/c/quikr_functions.c index fd7b99e..60fe676 100644 --- a/src/c/quikr_functions.c +++ b/src/c/quikr_functions.c @@ -181,6 +181,8 @@ struct matrix *load_sensing_matrix(const char *filename) { headers[i] = header+1; + row = memset(row, 0, (width + 1) * sizeof(unsigned long long)); + for(j = 0; j < width; j++) { line = gzgets(fh, line, 32); if(line == NULL || line[0] == '>') { @@ -197,7 +199,7 @@ struct matrix *load_sensing_matrix(const char *filename) { sum += row[j]; } for(j = 1; j < width+1; j++) { - matrix[i*width + j] = ((double)row[j-1]) / sum; + matrix[i*(width+1) + j] = ((double)row[j-1]) / sum; } } |