From 5990ef5e5762976752eac62959b844dc4e9ec004 Mon Sep 17 00:00:00 2001 From: torset Date: Fri, 9 Jan 2009 13:02:41 +0000 Subject: Change find prototype and function (output is one dimention indexation) --- src/auxiliaryFunctions/find/zfinda.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/auxiliaryFunctions/find/zfinda.c') diff --git a/src/auxiliaryFunctions/find/zfinda.c b/src/auxiliaryFunctions/find/zfinda.c index e01d42ca..18c87a25 100644 --- a/src/auxiliaryFunctions/find/zfinda.c +++ b/src/auxiliaryFunctions/find/zfinda.c @@ -12,12 +12,17 @@ #include "find.h" -int zfinda(doubleComplex* z, int size) { - int i = 0; +double *zfinda(doubleComplex* z, int size) { + int i = 0; + int indiceOut = 0; + double* out=NULL; + for (i = 0; i < size ; ++i) { if (zreals(z[i]) != 0 || zimags(z[i]) != 0) { - return i; + out = realloc(out, (uint)(indiceOut+1)*sizeof(double)); + out[indiceOut] = (double)i; + indiceOut++; } } - return NOT_FOUND; + return out; } -- cgit