diff options
Diffstat (limited to 'src/c/signalProcessing/wiener/dwienera.c')
-rw-r--r-- | src/c/signalProcessing/wiener/dwienera.c | 166 |
1 files changed, 166 insertions, 0 deletions
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); + + + + +} + + + + + +} |