diff options
Diffstat (limited to 'src/auxiliaryFunctions/find2d/cfind2da.c')
-rw-r--r-- | src/auxiliaryFunctions/find2d/cfind2da.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/auxiliaryFunctions/find2d/cfind2da.c b/src/auxiliaryFunctions/find2d/cfind2da.c index 2acdd882..8aefa06d 100644 --- a/src/auxiliaryFunctions/find2d/cfind2da.c +++ b/src/auxiliaryFunctions/find2d/cfind2da.c @@ -13,25 +13,23 @@ #include "find2d.h" #include <malloc.h> -void cfind2da(floatComplex* x, int rows, int columns, float** out1, float** out2) { +void cfind2da(floatComplex* x, int rows, int columns, float* out1,int* indiceOut1, float* out2,int* indiceOut2) { int i = 0, j=0; - int indiceOut = 0; - float* out_1 = NULL, *out_2=NULL; + indiceOut1[1] = 0; - /* We suppose out1 and out2 are NULL on input */ + /* if out are empties */ + out1[0]=-1; + out2[0]=-1; for (i = 0; i < rows ; ++i) { for (j = 0; j < columns ; ++j) { - if ((creals(x[i*columns+j]) != 0) || (cimags(x[i*columns+j])!=0) ) { - out_1 = realloc(out_1, (uint)(indiceOut+1)*sizeof(float)); - out_2 = realloc(out_2, (uint)(indiceOut+1)*sizeof(float)); + if ((creals(x[j*rows+i]) != 0) || (cimags(x[j*rows+i])!=0) ) { - out_1[indiceOut] = (float)i; - out_2[indiceOut] = (float)j; - indiceOut++; + out1[indiceOut1[1]] = (float)(i+1); + out2[indiceOut1[1]] = (float)(j+1); + indiceOut1[1]++; } } } - *out1=out_1; - *out2=out_2; + indiceOut2[1]=indiceOut1[1]; } |