diff options
author | Brijeshcr | 2017-07-07 22:29:47 +0530 |
---|---|---|
committer | Brijeshcr | 2017-07-07 22:29:47 +0530 |
commit | 4ebc92d414c6e87cea84770f4137434b922a76ca (patch) | |
tree | 5045ff8802c4164d0ac7a48f3f25758297eacf5b /src/c | |
parent | eb4fd4f84b56a9b8f1976a67461f2c918edede32 (diff) | |
download | Scilab2C_fossee_old-4ebc92d414c6e87cea84770f4137434b922a76ca.tar.gz Scilab2C_fossee_old-4ebc92d414c6e87cea84770f4137434b922a76ca.tar.bz2 Scilab2C_fossee_old-4ebc92d414c6e87cea84770f4137434b922a76ca.zip |
Changes to Toeplitz
Diffstat (limited to 'src/c')
-rw-r--r-- | src/c/matrixOperations/toeplitz/ctoeplitza.c | 6 | ||||
-rw-r--r-- | src/c/matrixOperations/toeplitz/ztoeplitza.c | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/c/matrixOperations/toeplitz/ctoeplitza.c b/src/c/matrixOperations/toeplitz/ctoeplitza.c index 048a367..56c3ef8 100644 --- a/src/c/matrixOperations/toeplitz/ctoeplitza.c +++ b/src/c/matrixOperations/toeplitz/ctoeplitza.c @@ -9,14 +9,14 @@ void ctoeplitza(floatComplex* inp1,int size1,floatComplex* inp2,int size2,floatComplex* oup) { - if (inp1[0]!=inp2[0]) + if ((creals(inp1[0])!=creals(inp2[0]))&&(cimags(inp1[0])!=cimags(inp2[0]))) { printf("Error!The first elements of the Vectors are not equal."); // First element of both input vectors must be equal for Toeplitz. return; } int i, j; - for(i=0;i<size1*size2;i++) oup[i] = 0; // Initializing the output matrix with zeros. + for(i=0;i<size1*size2;i++) oup[i] = FloatComplex(0,0); // Initializing the output matrix with zeros. for (i = 0; i<size1; i++) { @@ -28,7 +28,7 @@ void ctoeplitza(floatComplex* inp1,int size1,floatComplex* inp2,int size2,floatC } for (i = size2+1; i<size1*size2; i++) // Loop to build the rest of the Toeplitz matrix. { - if (oup[i] == 0) + if (creals(oup[i]) == 0 && cimags(oup[i]) == 0) oup[i] = oup[i-size2-1]; } } diff --git a/src/c/matrixOperations/toeplitz/ztoeplitza.c b/src/c/matrixOperations/toeplitz/ztoeplitza.c index d47c5e1..117f818 100644 --- a/src/c/matrixOperations/toeplitz/ztoeplitza.c +++ b/src/c/matrixOperations/toeplitz/ztoeplitza.c @@ -11,14 +11,14 @@ void ztoeplitza(doubleComplex* inp1,int size1,doubleComplex* inp2,int size2,doubleComplex* oup) { - if (inp1[0]!=inp2[0]) + if ((zreals(inp1[0])!=zreals(inp2[0]))&&(zimags(inp1[0])!=zimags(inp2[0]))) { printf("Error!The first elements of the Vectors are not equal."); // First element of both input vectors must be equal for Toeplitz. return; } int i, j; - for(i=0;i<size1*size2;i++) oup[i] = DoubleComplex(0,0); // Initializing the output matrix with zeros. + for(i=0;i<size1*size2;i++) oup[i] = 0; // Initializing the output matrix with zeros. for (i = 0; i<size1; i++) { @@ -30,7 +30,7 @@ void ztoeplitza(doubleComplex* inp1,int size1,doubleComplex* inp2,int size2,doub } for (i = size2+1; i<size1*size2; i++) // Loop to build the rest of the Toeplitz matrix. { - if (oup[i] == DoubleComplex(0,0)) + if (zreals(oup[i]) == 0 && zimags(oup[i]) == 0) oup[i] = oup[i-size2-1]; } } |