diff options
author | Brijeshcr | 2017-07-07 16:43:27 +0530 |
---|---|---|
committer | Brijeshcr | 2017-07-07 16:43:27 +0530 |
commit | 46da80312c4bc66bb5f16044c5c5597ac259d419 (patch) | |
tree | 34796b1bca87abf2b3e1530bd2af5b07e2cfd184 /2.3-1/src/c/matrixOperations/toeplitz/i16toeplitza.c | |
parent | 850c0ff1ca5cd660b76d0568a215bab0547312ad (diff) | |
download | Scilab2C-46da80312c4bc66bb5f16044c5c5597ac259d419.tar.gz Scilab2C-46da80312c4bc66bb5f16044c5c5597ac259d419.tar.bz2 Scilab2C-46da80312c4bc66bb5f16044c5c5597ac259d419.zip |
Toeplitz Added
Diffstat (limited to '2.3-1/src/c/matrixOperations/toeplitz/i16toeplitza.c')
-rw-r--r-- | 2.3-1/src/c/matrixOperations/toeplitz/i16toeplitza.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/2.3-1/src/c/matrixOperations/toeplitz/i16toeplitza.c b/2.3-1/src/c/matrixOperations/toeplitz/i16toeplitza.c new file mode 100644 index 00000000..945f626e --- /dev/null +++ b/2.3-1/src/c/matrixOperations/toeplitz/i16toeplitza.c @@ -0,0 +1,32 @@ +#include <stdio.h> +#include "toeplitz.h" +#include "int16.h" + +/*Function to build a Toeplitz Matrix for inputs of Signed Int16 datatype*/ + + +void i16toeplitza(int16* inp1,int size1,int16* inp2,int size2,int16* oup) +{ + if (inp1[0]!=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; i++) + { + for (j = 0; j<size2; j++) + { + oup[j*size1] = inp2[j]; // Elements of the second input vector are copied to the first row of the Toeplitx Matrix. + } + oup[i] = inp1[i]; // Elements of the first input vector are copied to the first column of the Toeplitx Matrix. + } + for (i = size2+1; i<size1*size2; i++) // Loop to build the rest of the Toeplitz matrix. + { + if (oup[i] == 0) + oup[i] = oup[i-size2-1]; + } +} |