diff options
author | simon | 2009-08-24 09:20:03 +0000 |
---|---|---|
committer | simon | 2009-08-24 09:20:03 +0000 |
commit | a2c6ed14519f019b157eac1aac66d9528dd9208a (patch) | |
tree | e6f48a413cdafa1efe94ab8ec723d013cc55ae3a /src/c/auxiliaryFunctions/find/dfinda.c | |
parent | 839d659e6b1c25be20bd556aba6386eaceb1245f (diff) | |
download | scilab2c-a2c6ed14519f019b157eac1aac66d9528dd9208a.tar.gz scilab2c-a2c6ed14519f019b157eac1aac66d9528dd9208a.tar.bz2 scilab2c-a2c6ed14519f019b157eac1aac66d9528dd9208a.zip |
updating *find2d for loops order in order to have the result in the same result than scilab
updating *find* prototype , adding to all a argument "int max" , in order to avoid useless
computation when only a limited number of results is requested
Diffstat (limited to 'src/c/auxiliaryFunctions/find/dfinda.c')
-rw-r--r-- | src/c/auxiliaryFunctions/find/dfinda.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/c/auxiliaryFunctions/find/dfinda.c b/src/c/auxiliaryFunctions/find/dfinda.c index 986be373..1f07b674 100644 --- a/src/c/auxiliaryFunctions/find/dfinda.c +++ b/src/c/auxiliaryFunctions/find/dfinda.c @@ -13,7 +13,7 @@ #include "find.h" -void dfinda(double* x, int size ,double *out, int *indiceOut) { +void dfinda(double* x, int size ,double *out, int *indiceOut , int max ) { int i = 0; indiceOut[1]=0; @@ -22,6 +22,8 @@ void dfinda(double* x, int size ,double *out, int *indiceOut) { for (i = 0; i < size ; ++i) { + /*to avoid useless search if we only want to find the max first founded value */ + if (indiceOut[1] == max ) return ; if (x[i] != 0) { out[indiceOut[1]] = (double)(i+1); indiceOut[1]++; |