summaryrefslogtreecommitdiff
path: root/src/c
diff options
context:
space:
mode:
authorsimon2009-08-24 11:57:46 +0000
committersimon2009-08-24 11:57:46 +0000
commitfbe2f2c97a8841e2ab16e388c202a96abeecc553 (patch)
tree6f1cafa7ce03ba1edea041cb3a9d6af34ff9c9e8 /src/c
parent5814413d010ab5d43cfef5391f2444e3842ba004 (diff)
downloadscilab2c-fbe2f2c97a8841e2ab16e388c202a96abeecc553.tar.gz
scilab2c-fbe2f2c97a8841e2ab16e388c202a96abeecc553.tar.bz2
scilab2c-fbe2f2c97a8841e2ab16e388c202a96abeecc553.zip
corrected a mistake in ccolumnmeanfa and crowmeanfa
Diffstat (limited to 'src/c')
-rw-r--r--src/c/statisticsFunctions/meanf/ccolumnmeanfa.c8
-rw-r--r--src/c/statisticsFunctions/meanf/crowmeanfa.c8
2 files changed, 8 insertions, 8 deletions
diff --git a/src/c/statisticsFunctions/meanf/ccolumnmeanfa.c b/src/c/statisticsFunctions/meanf/ccolumnmeanfa.c
index 6e811262..90dbb8b7 100644
--- a/src/c/statisticsFunctions/meanf/ccolumnmeanfa.c
+++ b/src/c/statisticsFunctions/meanf/ccolumnmeanfa.c
@@ -17,22 +17,22 @@
void ccolumnmeanfa(floatComplex *in1, int lines, int columns,floatComplex *in2, floatComplex *out) {
int i = 0;
int j = 0;
- float tempCoefSum = 0.0f;
+ floatComplex tempCoefSum = FloatComplex(0.0f,0.0f);
floatComplex tempMul = FloatComplex(0.0f,0.0f);
/*we first multiply each cell of the input matrix by its coefficient*/
for (j = 0; j < lines ; ++j)
{
- tempCoefSum = 0.0f;
+ tempCoefSum = FloatComplex(0.0f,0.0f);
out[j]= FloatComplex(0.0f,0.0f);
for ( i = 0 ; i < columns; ++i )
{
tempMul = cmuls ( in1[lines*i + j] , in2[lines*i + j]); /* we times by the coefficient*/
- tempCoefSum += creals(in2[lines*i + j]) ;
+ tempCoefSum = cadds ( in2[lines*i + j] ,tempCoefSum ) ;
out[j] = cadds (tempMul, out[j]) ;
}
- out[j] =FloatComplex(creals(out[j]) /tempCoefSum, cimags(out[j]) /tempCoefSum);
+ out[j] = crdivs(out[j] ,tempCoefSum);
}
}
diff --git a/src/c/statisticsFunctions/meanf/crowmeanfa.c b/src/c/statisticsFunctions/meanf/crowmeanfa.c
index 4c2b4866..14dc3271 100644
--- a/src/c/statisticsFunctions/meanf/crowmeanfa.c
+++ b/src/c/statisticsFunctions/meanf/crowmeanfa.c
@@ -16,21 +16,21 @@
void crowmeanfa(floatComplex *in1, int lines, int columns, floatComplex *in2, floatComplex *out) {
int i = 0;
int j = 0;
- float tempCoefSum = 0.0f;
+ floatComplex tempCoefSum = FloatComplex(0.0f,0.0f);
floatComplex tempMul = FloatComplex(0.0f,0.0f);
/*we first multiply each cell of the input matrix by its coefficient*/
for (j = 0; j < columns; ++j)
{
- tempCoefSum = 0.0f;
+ tempCoefSum = FloatComplex(0.0f,0.0f);
out[j]= FloatComplex(0.0f,0.0f);
for ( i = 0 ; i < lines; ++i )
{
tempMul = cmuls ( in1[lines*j + i] , in2[lines*j + i]); /* we times by the coefficient*/
- tempCoefSum += creals(in2[lines*j + i]) ;
+ tempCoefSum = cadds ( in2[lines*j + i] ,tempCoefSum ) ;
out[j] = cadds (tempMul, out[j]) ;
}
- out[j] = FloatComplex(creals(out[j]) /tempCoefSum, cimags(out[j]) /tempCoefSum);
+ out[j] = crdivs(out[j] ,tempCoefSum);
}
}