diff options
author | Abhinav Dronamraju | 2017-09-11 17:00:59 +0530 |
---|---|---|
committer | Abhinav Dronamraju | 2017-09-11 17:00:59 +0530 |
commit | d229093eac4cd1963e336959fe663f7332efafea (patch) | |
tree | be49670052e565231fbb0f95f03929d784114d1d /src/c/signalProcessing | |
parent | fe525aa0b13baa3113ec22fe4f2d373db6e093d8 (diff) | |
parent | 3aa26bd48e9d42e4f97fcafee4c761f36ea766bc (diff) | |
download | Scilab2C_fossee_old-d229093eac4cd1963e336959fe663f7332efafea.tar.gz Scilab2C_fossee_old-d229093eac4cd1963e336959fe663f7332efafea.tar.bz2 Scilab2C_fossee_old-d229093eac4cd1963e336959fe663f7332efafea.zip |
mvcorrel and strange functions added
Diffstat (limited to 'src/c/signalProcessing')
-rw-r--r-- | src/c/signalProcessing/hank/dhanka.c | 4 | ||||
-rw-r--r-- | src/c/signalProcessing/includes/kalm.h | 3 | ||||
-rw-r--r-- | src/c/signalProcessing/includes/wiener.h | 30 | ||||
-rw-r--r-- | src/c/signalProcessing/interfaces/int_kalm.h | 5 | ||||
-rw-r--r-- | src/c/signalProcessing/interfaces/int_weiner.h | 20 | ||||
-rw-r--r-- | src/c/signalProcessing/interfaces/int_wiener.h | 20 | ||||
-rw-r--r-- | src/c/signalProcessing/kalm/zkalma.c | 119 | ||||
-rw-r--r-- | src/c/signalProcessing/wiener/dwienera.c | 166 |
8 files changed, 238 insertions, 129 deletions
diff --git a/src/c/signalProcessing/hank/dhanka.c b/src/c/signalProcessing/hank/dhanka.c index 37008fd..5cef7f3 100644 --- a/src/c/signalProcessing/hank/dhanka.c +++ b/src/c/signalProcessing/hank/dhanka.c @@ -43,7 +43,7 @@ for(int i=1; i< mr+1; i= i+row) { temp1[j]=i; j++; - printf("%d", i); + //printf("%d", i); } for(int j=0;j< nr; j++) temp2[j]=j; @@ -65,7 +65,7 @@ for(int i=0; i< m*nr; i++) } } - +//Debug Only /* printf("ones1\n"); for(int k=0; k<1*nr; k++) diff --git a/src/c/signalProcessing/includes/kalm.h b/src/c/signalProcessing/includes/kalm.h index 7cd5a55..6f73ac1 100644 --- a/src/c/signalProcessing/includes/kalm.h +++ b/src/c/signalProcessing/includes/kalm.h @@ -21,9 +21,6 @@ extern "C" { void dkalma(double* y, int y_row, int y_col, double* x0, int x0_row, int x0_col, double* p0, int p0_row, int p0_col, double* f, int f_row, int f_col, double* g, int g_row, int g_col, double* h, int h_row, int h_col, double* q, int q_row, int q_col, double* r, int r_row, int r_col, double* x1, double* p1, double* x, double* p); -void zkalma(doubleComplex* y, int y_row, int y_col, doubleComplex* x0, int x0_row, int x0_col,doubleComplex* p0, int p0_row, int p0_col, doubleComplex* f, int f_row, int f_col, doubleComplex* g, int g_row, int g_col, doubleComplex* h, int h_row, int h_col, doubleComplex* q, int q_row, int q_col, doubleComplex* r, int r_row, int r_col, doubleComplex* x1, doubleComplex* p1, doubleComplex* x, doubleComplex* p); - - #ifdef __cplusplus } /* extern "C" */ diff --git a/src/c/signalProcessing/includes/wiener.h b/src/c/signalProcessing/includes/wiener.h new file mode 100644 index 0000000..ba77526 --- /dev/null +++ b/src/c/signalProcessing/includes/wiener.h @@ -0,0 +1,30 @@ +/* Copyright (C) 2017 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __WEINER_H__ +#define __WEINER_H__ +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dwienera(double* y, int y_row, int y_col, double* x0, int x0_row, int x0_col, double* p0, int p0_row, int p0_col, double* f, int f_row, int f_col, double* g, int g_row, int g_col, double* h, int h_row, int h_col, double* q, int q_row, int q_col, double* r, int r_row, int r_col, double* xs, double* ps, double* xf, double* pf); + + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __WEINER_H__ */ + diff --git a/src/c/signalProcessing/interfaces/int_kalm.h b/src/c/signalProcessing/interfaces/int_kalm.h index b03977d..b4369c9 100644 --- a/src/c/signalProcessing/interfaces/int_kalm.h +++ b/src/c/signalProcessing/interfaces/int_kalm.h @@ -17,9 +17,4 @@ dkalma(in1, size1[0], size1[1],in2, size2[0], size2[1],in3, size3[0], size3[1],in4, size4[0], size4[1],in5, size5[0], size5[1] ,\ in6, size6[0], size6[1],in7, size7[0], size7[1],in8, size8[0], size8[1], out1, out2, out3, out4) - -#define z2z2z2z2z2z2z2z2kalmz2z2z2z2(in1, size1, in2, size2, in3, size3, in4, size4, in5, size5, in6, size6, in7, size7, in8, size8, out1, out2, out3, out4) \ - zkalma(in1, size1[0], size1[1],in2, size2[0], size2[1],in3, size3[0], size3[1],in4, size4[0], size4[1],in5, size5[0], size5[1] ,\ - in6, size6[0], size6[1],in7, size7[0], size7[1],in8, size8[0], size8[1], out1, out2, out3, out4) - #endif /* !INT_KALM_H__! */ diff --git a/src/c/signalProcessing/interfaces/int_weiner.h b/src/c/signalProcessing/interfaces/int_weiner.h new file mode 100644 index 0000000..daefcf0 --- /dev/null +++ b/src/c/signalProcessing/interfaces/int_weiner.h @@ -0,0 +1,20 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __INT_WIENER_H__ +#define __INT_WIENER_H__ + +#define d2d2d2d2d2d2d2d2wienerd2d2d2d2(in1, size1, in2, size2, in3, size3, in4, size4, in5, size5, in6, size6, in7, size7, in8, size8, out1, out2, out3, out4) \ + dwienera(in1, size1[0], size1[1],in2, size2[0], size2[1],in3, size3[0], size3[1],in4, size4[0], size4[1],in5, size5[0], size5[1] ,\ + in6, size6[0], size6[1],in7, size7[0], size7[1],in8, size8[0], size8[1], out1, out2, out3, out4) + +#endif /* !INT_WEINER_H__! */ diff --git a/src/c/signalProcessing/interfaces/int_wiener.h b/src/c/signalProcessing/interfaces/int_wiener.h new file mode 100644 index 0000000..daefcf0 --- /dev/null +++ b/src/c/signalProcessing/interfaces/int_wiener.h @@ -0,0 +1,20 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __INT_WIENER_H__ +#define __INT_WIENER_H__ + +#define d2d2d2d2d2d2d2d2wienerd2d2d2d2(in1, size1, in2, size2, in3, size3, in4, size4, in5, size5, in6, size6, in7, size7, in8, size8, out1, out2, out3, out4) \ + dwienera(in1, size1[0], size1[1],in2, size2[0], size2[1],in3, size3[0], size3[1],in4, size4[0], size4[1],in5, size5[0], size5[1] ,\ + in6, size6[0], size6[1],in7, size7[0], size7[1],in8, size8[0], size8[1], out1, out2, out3, out4) + +#endif /* !INT_WEINER_H__! */ diff --git a/src/c/signalProcessing/kalm/zkalma.c b/src/c/signalProcessing/kalm/zkalma.c deleted file mode 100644 index f47e01e..0000000 --- a/src/c/signalProcessing/kalm/zkalma.c +++ /dev/null @@ -1,119 +0,0 @@ -/* Copyright (C) 2017 - IIT Bombay - FOSSEE - - This file must be used under the terms of the CeCILL. - This source file is licensed as described in the file COPYING, which - you should have received as part of this distribution. The terms - are also available at - http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt - Author: Abhinav Dronamraju - Organization: FOSSEE, IIT Bombay - Email: toolbox@scilab.in - */ - -/*Function to find kalm */ - -#include "lapack.h" -#include "stdlib.h" -#include "doubleComplex.h" -#include "stdio.h" -#include "string.h" -#include "kalm.h" -#include "matrixTranspose.h" -#include "matrixMultiplication.h" -#include "matrixInversion.h" -#include "addition.h" -#include "subtraction.h" -#include "eye.h" - -void zkalma(doubleComplex* y, int y_row, int y_col, doubleComplex* x0, int x0_row, int x0_col,doubleComplex* p0, int p0_row, int p0_col, doubleComplex* f, int f_row, int f_col, doubleComplex* g, int g_row, int g_col, doubleComplex* h, int h_row, int h_col, doubleComplex* q, int q_row, int q_col, doubleComplex* r, int r_row, int r_col, doubleComplex* x1, doubleComplex* p1, doubleComplex* x, doubleComplex* p) - -{ - doubleComplex k[p0_row*h_row]; - doubleComplex h_trans[h_col*h_row]; - doubleComplex temp1[p0_row*h_row]; - doubleComplex temp2[h_row*p0_col]; - doubleComplex temp3[h_row*h_row]; - doubleComplex temp4[h_row*h_row]; - doubleComplex temp5[h_row*h_row]; - doubleComplex temp6[p0_row*p0_col]; - doubleComplex temp7[p0_row*h_col]; - doubleComplex temp8[p0_row*p0_col]; - doubleComplex f_trans[f_col*f_row]; - doubleComplex g_trans[g_col*g_row]; - doubleComplex temp9 [f_row*p0_col]; - doubleComplex temp10[f_row*f_row]; - doubleComplex temp11 [g_row*q_col]; - doubleComplex temp12[g_row*g_row]; - doubleComplex temp13[h_row*x0_col]; - doubleComplex temp14[h_row*x0_col]; - doubleComplex temp15[p0_row*x0_col]; - - - - ztransposea(h, h_row, h_col, h_trans); - zmulma(p0, p0_row, p0_col, h_trans, h_col, h_row, temp1); //temp1= p0*h' - zmulma(h, h_row, h_col, p0, p0_row, p0_col, temp2); //temp2= h*p0 - zmulma(temp2, h_row, p0_col, h_trans, h_col, h_row, temp3); //temp3= h*p0*h' - zadda(temp3, h_row*h_row, r, r_row*r_col, temp4); //temp4= h*p0*h'+r - -/*//Debug Only*/ -/* for(int i=0; i< h_row*h_row; i++)*/ -/* printf("temp4[%d] = %lf + i %lf\t",i, zreals(temp4[i]) , zimags(temp4[i]));*/ -/* printf("\n");*/ - - zinverma(temp4, temp5, h_row); //temp5= (h*p0*h'+r)**(-1) - - zmulma(temp1, p0_row, h_row, temp5, h_row, h_row, k); //k=p0*h'*(h*p0*h'+r)**(-1) - -/*//Debug Only*/ -/* for(int i=0; i< p0_row*h_row; i++)*/ -/* printf("k[%d] = %lf \t",i, k[i]);*/ -/* printf("\n");*/ - - - zeyea(temp6, p0_row, p0_col); //temp6 = eye(p0) - zmulma(k, p0_row, h_row, h, h_row, h_col, temp7); //temp7 = k*h - zdiffa(temp6, p0_row*p0_col, temp7, p0_row*h_col, temp8); //temp8= eye(p0)- k*h - zmulma(temp8, p0_row, p0_col, p0, p0_row, p0_col, p); //p=(eye(p0)-k*h)*p0 - -/*//Debug Only*/ -/* for(int i=0; i< p0_row*p0_col; i++)*/ -/* printf("p[%d] = %lf \t",i, p[i]);*/ -/* printf("\n");*/ - - - ztransposea(g, g_row, g_col, g_trans); - ztransposea(f, f_row, f_col, f_trans); - zmulma(f, f_row, f_col, p, p0_row, p0_col, temp9); //temp9= f*p - zmulma(temp9, f_row, p0_col, f_trans, f_col, f_row, temp10); //temp10= f*p*f' - zmulma(g, g_row, g_col, q, q_row, q_col, temp11); //temp11= g*q - zmulma(temp11, g_row, q_col, g_trans, g_col, g_row, temp12); //temp12= g*q*g' - zadda(temp10, f_row*f_row, temp12, g_row*g_row, p1); //p1=f*p*f'+g*q*g' - -/* //Debug Only*/ -/* for(int i=0; i< f_row*f_row; i++)*/ -/* printf("p1[%d] = %lf \t",i, p1[i]);*/ -/* printf("\n");*/ - - - zmulma(h, h_row, h_col, x0, x0_row, x0_col, temp13); //temp13= h*x0 - zdiffa(y, y_row*y_col, temp13, h_row*x0_col, temp14); //temp14= y-h*x0 - zmulma(k, p0_row, h_row, temp14, h_row, x0_col, temp15); //temp15= k*(y-h*x0) - zadda(x0, x0_row*x0_col, temp15, p0_row*x0_col, x); //x=x0+k*(y-h*x0) - -/* //Debug Only*/ -/* for(int i=0; i< x0_row*x0_col; i++)*/ -/* printf("x[%d] = %lf \t",i, x[i]);*/ -/* printf("\n");*/ - - - zmulma(f, f_row, f_col, x, x0_row, x0_col, x1) ; //x1= f*x - -/* //Debug Only*/ -/* for(int i=0; i< f_row*x0_col; i++)*/ -/* printf("x1[%d] = %lf \t",i, x1[i]);*/ -/* printf("\n");*/ - - - -} diff --git a/src/c/signalProcessing/wiener/dwienera.c b/src/c/signalProcessing/wiener/dwienera.c new file mode 100644 index 0000000..18f49bc --- /dev/null +++ b/src/c/signalProcessing/wiener/dwienera.c @@ -0,0 +1,166 @@ +/* Copyright (C) 2017 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +/*Function to find kalm */ + +#include "lapack.h" +#include "stdlib.h" +#include "stdio.h" +#include "string.h" +#include "wiener.h" +#include "kalm.h" +#include "matrixTranspose.h" +#include "matrixMultiplication.h" +#include "matrixInversion.h" +#include "addition.h" +#include "subtraction.h" +#include "eye.h" + +void dwienera(double* y, int y_row, int y_col, double* x0, int x0_row, int x0_col, double* p0, int p0_row, int p0_col, double* f, int f_row, int f_col, double* g, int g_row, int g_col, double* h, int h_row, int h_col, double* q, int q_row, int q_col, double* r, int r_row, int r_col, double* xs, double* ps, double* xf, double* pf) + +{ + +/* dtransposea(h, h_row, h_col, h_trans);*/ +/* dmulma(p0, p0_row, p0_col, h_trans, h_col, h_row, temp1); //temp1= p0*h'*/ +/* dmulma(h, h_row, h_col, p0, p0_row, p0_col, temp2); //temp2= h*p0*/ +/* dmulma(temp2, h_row, p0_col, h_trans, h_col, h_row, temp3); //temp3= h*p0*h'*/ +/* dadda(temp3, h_row*h_row, r, r_row*r_col, temp4); //temp4= h*p0*h'+r*/ + + int n= x0_row, x0j= x0_col, m= y_row, tf= y_col, to=1, k; + double ind_nk[n]; + double ind_mk[m]; + double xf1[x0_row*x0_col]; + double pf1[p0_row*p0_col]; + double yk[y_row*1]; + double fk[f_row*n]; + double gk[g_row*n]; + double hk[h_row*n]; + double qk[q_row*n]; + double rk[r_row*m]; + double x1[f_row*x0_col]; + double p1[f_row*f_row]; + double x[x0_row*x0_col]; + double p[p0_row*p0_col]; + + +for(int i=0; i< x0_row*x0_col; i++) + xf1[i]= x0[i]; + +for(int i=0; i< p0_row*p0_col; i++) + pf1[i]= p0[i]; + +for(k=t0; k<=tf; k++) +{ + int j=0; + for(int i=1+(k-1)*n; i<= k*n; i++) + { + ind_nk[j]= i; + j++; + } + + int j=0; + for(int i=1+(k-1)*m; i<= k*m; i++) + { + ind_mk[j]= i; + j++; + } + + for(int i=0; i< y_row; y++) + { + int j=k-1; + + yk[i]= y[i+j*y_row]; + + } +int l=0; + for(int i=0; i<n; i++) + { + for(int j=0; j< f_row; j++) + { + int k=ind_nk[i]-1; + + fk[l]= f[j+k*y_row]; + l++; + } + + + } + +int l=0; + for(int i=0; i<n; i++) + { + for(int j=0; j< g_row; j++) + { + int k=ind_nk[i]-1; + + gk[l]= g[j+k*y_row]; + l++; + } + + + } + +int l=0; + for(int i=0; i<n; i++) + { + for(int j=0; j< h_row; j++) + { + int k=ind_nk[i]-1; + + hk[l]= h[j+k*y_row]; + l++; + } + + + } + +int l=0; + for(int i=0; i<n; i++) + { + for(int j=0; j< q_row; j++) + { + int k=ind_nk[i]-1; + + qk[l]= q[j+k*y_row]; + l++; + } + + + } + +int l=0; + for(int i=0; i<m; i++) + { + for(int j=0; j< r_row; j++) + { + int k=ind_mk[i]-1; + + rk[l]= r[j+k*y_row]; + l++; + } + + + } + + +dkalma(yk, y_row, 1, x0, x0_row, x0_col, p0, p0_row, p0_col, fk, f_row, n, gk, g_row, n, hk, h_row, n, qk, q_row, n, rk, r_row, m, x1, p1, x, p); + + + + +} + + + + + +} |