summaryrefslogtreecommitdiff
path: root/src/auxiliaryFunctions/find2d/zfind2da.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/auxiliaryFunctions/find2d/zfind2da.c')
-rw-r--r--src/auxiliaryFunctions/find2d/zfind2da.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/src/auxiliaryFunctions/find2d/zfind2da.c b/src/auxiliaryFunctions/find2d/zfind2da.c
index 223ce0ed..db263544 100644
--- a/src/auxiliaryFunctions/find2d/zfind2da.c
+++ b/src/auxiliaryFunctions/find2d/zfind2da.c
@@ -13,25 +13,23 @@
#include "find2d.h"
#include <malloc.h>
-void zfind2da(doubleComplex* x, int rows, int columns, double** out1, double** out2) {
+void zfind2da(doubleComplex* x, int rows, int columns, double* out1,int* indiceOut1, double* out2,int* indiceOut2) {
int i = 0, j=0;
- int indiceOut = 0;
- double* 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 ((zreals(x[i*columns+j]) != 0) || (zimags(x[i*columns+j])!=0) ) {
- out_1 = realloc(out_1, (uint)(indiceOut+1)*sizeof(double));
- out_2 = realloc(out_2, (uint)(indiceOut+1)*sizeof(double));
+ if ((zreals(x[j*rows+i]) != 0) || (zimags(x[j*rows+i])!=0) ) {
- out_1[indiceOut] = (double)i;
- out_2[indiceOut] = (double)j;
- indiceOut++;
+ out1[indiceOut1[1]] = (double)(i+1);
+ out2[indiceOut1[1]] = (double)(j+1);
+ indiceOut1[1]++;
}
}
}
- *out1=out_1;
- *out2=out_2;
+ indiceOut2[1]=indiceOut1[1];
}