diff options
author | torset | 2009-01-21 15:51:25 +0000 |
---|---|---|
committer | torset | 2009-01-21 15:51:25 +0000 |
commit | a71f66554c16b8733c726035bec8d58b53e9d471 (patch) | |
tree | 02d67529fa7a76e3ae67eb9a0574df703d1e464e | |
parent | 337a2c9eb45f7e11ce690891c1be5c8502ead450 (diff) | |
download | scilab2c-a71f66554c16b8733c726035bec8d58b53e9d471.tar.gz scilab2c-a71f66554c16b8733c726035bec8d58b53e9d471.tar.bz2 scilab2c-a71f66554c16b8733c726035bec8d58b53e9d471.zip |
adjusting some functions
-rw-r--r-- | src/auxiliaryFunctions/find/cfinda.c | 13 | ||||
-rw-r--r-- | src/auxiliaryFunctions/find/dfinda.c | 13 | ||||
-rw-r--r-- | src/auxiliaryFunctions/find/sfinda.c | 12 | ||||
-rw-r--r-- | src/auxiliaryFunctions/find/zfinda.c | 13 |
4 files changed, 17 insertions, 34 deletions
diff --git a/src/auxiliaryFunctions/find/cfinda.c b/src/auxiliaryFunctions/find/cfinda.c index 87655c0b..c2abca8c 100644 --- a/src/auxiliaryFunctions/find/cfinda.c +++ b/src/auxiliaryFunctions/find/cfinda.c @@ -14,17 +14,12 @@ void cfinda(floatComplex* z, int size, float *out, int *indiceOut) { int i = 0; - int indice = *indiceOut; - - indice = 0; - - /* Initialisation de out à -1 */ - for (i=0;i<size;i++) out[i]=-1; - + indiceOut[1]=0; + for (i = 0; i < size ; ++i) { if (creals(z[i]) != 0 || cimags(z[i]) != 0) { - out[indice] = (float)(i+1); - indice++; + out[indiceOut[1]] = (float)(i+1); + indiceOut[1]++; } } } diff --git a/src/auxiliaryFunctions/find/dfinda.c b/src/auxiliaryFunctions/find/dfinda.c index 8613d00d..061caf56 100644 --- a/src/auxiliaryFunctions/find/dfinda.c +++ b/src/auxiliaryFunctions/find/dfinda.c @@ -15,17 +15,14 @@ void dfinda(double* x, int size ,double *out, int *indiceOut) { int i = 0; - int indice = *indiceOut; - - indice = 0; + indiceOut[1]=0; - /* Initialisation de out à -1 */ - for (i=0;i<size;i++) out[i]=-1; - + for (i = 0; i < size ; ++i) { if (x[i] != 0) { - out[indice] = (double)(i + 1); - indice++; + out[indiceOut[1]] = (double)(i+1); + indiceOut[1]++; } } } + diff --git a/src/auxiliaryFunctions/find/sfinda.c b/src/auxiliaryFunctions/find/sfinda.c index 7916b1fb..9d2c125e 100644 --- a/src/auxiliaryFunctions/find/sfinda.c +++ b/src/auxiliaryFunctions/find/sfinda.c @@ -14,20 +14,16 @@ void sfinda(float* x, int size, float* out, int *indiceOut) { int i = 0; - *indiceOut=0; - /* Initialisation de out à -1 */ - for (i=0;i<size;i++) out[i]=-1; + indiceOut[1]=0; + for (i = 0; i < size ; ++i) { - if (x[i] != 0) { - out[*indiceOut] = (float)(i+1); - (*indiceOut)++; + out[indiceOut[1]] = (float)(i+1); + indiceOut[1]++; } } - /* (*indiceOut) must be equal to 1 when goes out to display as we want */ - *indiceOut=1; } diff --git a/src/auxiliaryFunctions/find/zfinda.c b/src/auxiliaryFunctions/find/zfinda.c index 82a9864c..1a98e3b3 100644 --- a/src/auxiliaryFunctions/find/zfinda.c +++ b/src/auxiliaryFunctions/find/zfinda.c @@ -14,17 +14,12 @@ void zfinda(doubleComplex* z, int size, double *out, int* indiceOut) { int i = 0; - int indice = *indiceOut; - - indice = 0; - - /* Initialisation de out à -1 */ - for (i=0;i<size;i++) out[i]=-1; - + indiceOut[1]=0; + for (i = 0; i < size ; ++i) { if (zreals(z[i]) != 0 || zimags(z[i]) != 0) { - out[indice] = (double)(i+1); - indice++; + out[indiceOut[1]] = (double)(i+1); + indiceOut[1]++; } } } |