diff options
author | torset | 2009-01-09 13:02:41 +0000 |
---|---|---|
committer | torset | 2009-01-09 13:02:41 +0000 |
commit | 5990ef5e5762976752eac62959b844dc4e9ec004 (patch) | |
tree | a1084761fdc6246bcfe05c3c43eacedb87d661fe /src/auxiliaryFunctions/find/zfinda.c | |
parent | 27d1195037550a3e3a99769c1d39e5f2f122616c (diff) | |
download | scilab2c-5990ef5e5762976752eac62959b844dc4e9ec004.tar.gz scilab2c-5990ef5e5762976752eac62959b844dc4e9ec004.tar.bz2 scilab2c-5990ef5e5762976752eac62959b844dc4e9ec004.zip |
Change find prototype and function (output is one dimention indexation)
Diffstat (limited to 'src/auxiliaryFunctions/find/zfinda.c')
-rw-r--r-- | src/auxiliaryFunctions/find/zfinda.c | 13 |
1 files changed, 9 insertions, 4 deletions
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; } |