From 55c0e6c1c041d9d0215c6a192ed11476d49d593c Mon Sep 17 00:00:00 2001 From: Abhinav Dronamraju Date: Tue, 22 Aug 2017 20:54:30 +0530 Subject: Faurre, kalm, Mvcorrel added --- 2.3-1/includes/sci2clib.h | 11 ++ 2.3-1/jar/scilab_en_US_help.jar | Bin 20466 -> 11210 bytes 2.3-1/macros/ASTManagement/AST2Ccode.sci | 9 -- 2.3-1/macros/ASTManagement/AST_HandleEndGenFun.sci | 4 +- .../macros/FunctionAnnotation/FA_GetOutArgInfo.sci | 18 ++-- .../ToolInitialization/INIT_FillSCI2LibCDirs.sci | 104 ++++++++++++++++++ 2.3-1/macros/findDeps/getAllHeaders.sci | 3 + 2.3-1/macros/findDeps/getAllInterfaces.sci | 3 + 2.3-1/macros/findDeps/getAllSources.sci | 4 + 2.3-1/src/c/interpolation/interpln/dinterplna.c | 29 +++++ 2.3-1/src/c/interpolation/interpln/sinterp13a.c | 75 +++++++++++++ 2.3-1/src/c/signalProcessing/faurre/dfaurrea.c | 112 +++++++++++++++++++ 2.3-1/src/c/signalProcessing/includes/faurre.h | 29 +++++ 2.3-1/src/c/signalProcessing/includes/kalm.h | 33 ++++++ .../src/c/signalProcessing/interfaces/int_faurre.h | 20 ++++ 2.3-1/src/c/signalProcessing/interfaces/int_kalm.h | 25 +++++ 2.3-1/src/c/signalProcessing/kalm/dkalma.c | 118 ++++++++++++++++++++ 2.3-1/src/c/signalProcessing/kalm/zkalma.c | 119 +++++++++++++++++++++ .../src/c/statisticsFunctions/includes/mvcorrel.h | 33 ++++++ .../statisticsFunctions/interfaces/int_mvcorrel.h | 28 +++++ .../c/statisticsFunctions/mvcorrel/dmvcorrela.c | 69 ++++++++++++ 21 files changed, 826 insertions(+), 20 deletions(-) create mode 100644 2.3-1/src/c/interpolation/interpln/dinterplna.c create mode 100644 2.3-1/src/c/interpolation/interpln/sinterp13a.c create mode 100644 2.3-1/src/c/signalProcessing/faurre/dfaurrea.c create mode 100644 2.3-1/src/c/signalProcessing/includes/faurre.h create mode 100644 2.3-1/src/c/signalProcessing/includes/kalm.h create mode 100644 2.3-1/src/c/signalProcessing/interfaces/int_faurre.h create mode 100644 2.3-1/src/c/signalProcessing/interfaces/int_kalm.h create mode 100644 2.3-1/src/c/signalProcessing/kalm/dkalma.c create mode 100644 2.3-1/src/c/signalProcessing/kalm/zkalma.c create mode 100644 2.3-1/src/c/statisticsFunctions/includes/mvcorrel.h create mode 100644 2.3-1/src/c/statisticsFunctions/interfaces/int_mvcorrel.h create mode 100644 2.3-1/src/c/statisticsFunctions/mvcorrel/dmvcorrela.c diff --git a/2.3-1/includes/sci2clib.h b/2.3-1/includes/sci2clib.h index ac8f7e7d..68378ed3 100644 --- a/2.3-1/includes/sci2clib.h +++ b/2.3-1/includes/sci2clib.h @@ -606,6 +606,14 @@ extern "C" { #include "buttmag.h" #include "int_buttmag.h" +/*interfacing kalm */ +#include "kalm.h" +#include "int_kalm.h" + +/*interfacing faurre */ +#include "faurre.h" +#include "int_faurre.h" + /*interfacing cheb1mag */ #include "cheb1mag.h" #include "int_cheb1mag.h" @@ -662,6 +670,9 @@ extern "C" { /* interfacing median */ #include "median.h" #include "int_median.h" +/* interfacing mvcorrel */ +#include "mvcorrel.h" +#include "int_mvcorrel.h" /* interfacing gsort */ #include "gsort.h" #include "int_gsort.h" diff --git a/2.3-1/jar/scilab_en_US_help.jar b/2.3-1/jar/scilab_en_US_help.jar index fec28974..e858ddc5 100644 Binary files a/2.3-1/jar/scilab_en_US_help.jar and b/2.3-1/jar/scilab_en_US_help.jar differ diff --git a/2.3-1/macros/ASTManagement/AST2Ccode.sci b/2.3-1/macros/ASTManagement/AST2Ccode.sci index 20aa999e..d44a3393 100644 --- a/2.3-1/macros/ASTManagement/AST2Ccode.sci +++ b/2.3-1/macros/ASTManagement/AST2Ccode.sci @@ -16,7 +16,6 @@ function AST2Ccode(FileInfoDatFile) // Copyright 2007 Raffaele Nutricato. // Contact: raffaele.nutricato@tiscali.it // ----------------------------------------------------------------- - // ------------------------------ // --- Check input arguments. --- // ------------------------------ @@ -75,7 +74,6 @@ FName = null ASTFileName = FileInfo.Funct(nxtscifunnumber).ASTFileName; - // ----------------------- // --- Initialization. --- // ----------------------- @@ -121,7 +119,6 @@ AST_PushASTStack('Dummy'); SharedInfo.UsedTempScalarVars = OrigUsedTempScalarVars; //NUT: put here a manageeol so that you can have all the save and load you want. SharedInfo.ASTReader.UsedTempVars = 0; - // ---------------------------------- // --- Main loop to read the AST. --- // ---------------------------------- @@ -137,7 +134,6 @@ while ~meof(fidAST) if STACKDEDUG == 1 disp('Read AST Line: '+treeline); end - // Analyze line. select treeline @@ -179,7 +175,6 @@ while ~meof(fidAST) end disp_isthere = 0; FName = null - case 'Equal' then SharedInfo.Equal.Enabled = 1; // 1 means enabled -> we are inside an equal AST block. AST_PushASTStack(treeline); @@ -218,7 +213,6 @@ while ~meof(fidAST) end AST_PushASTStack(treeline); end - // ---------------- // --- If/Else. --- // ---------------- @@ -237,7 +231,6 @@ while ~meof(fidAST) SharedInfo = C_IfElseBlocks(FileInfo,SharedInfo,'out'); end SharedInfo.CountNestedIf = 0; - // -------------- // --- Dummy. --- // -------------- @@ -254,7 +247,6 @@ while ~meof(fidAST) disp_isthere = 0; //NUT: per essere precisi si puo' pensare di mettere un check //NUT: alla fine dell'albero per accertarsi che c'e' end program li' dove ce lo aspettiamo - // ------------ // --- For. --- // ------------ @@ -316,7 +308,6 @@ SharedInfo.Function_list = SharedInfo.Function_list(1:SharedInfo.Function_list_i - // -------------------------------------- // --- End main loop to read the AST. --- // -------------------------------------- diff --git a/2.3-1/macros/ASTManagement/AST_HandleEndGenFun.sci b/2.3-1/macros/ASTManagement/AST_HandleEndGenFun.sci index 79ec976c..455cd404 100644 --- a/2.3-1/macros/ASTManagement/AST_HandleEndGenFun.sci +++ b/2.3-1/macros/ASTManagement/AST_HandleEndGenFun.sci @@ -348,8 +348,8 @@ NOutArg_mod = NOutArg OutArg(1).FindLike = InArg(1).FindLike; OutArg(1).Scope = 'Number_d'; else - OutArg = FA_GetOutArgInfo(InArg,NInArg,OutArg,NOutArg,SharedInfo,FunPrecSpecifier,FunTypeAnnot,FunSizeAnnot,ReportFileName,ASTFunName); - end + OutArg = FA_GetOutArgInfo(InArg,NInArg,OutArg,NOutArg,SharedInfo,FunPrecSpecifier,FunTypeAnnot,FunSizeAnnot,ReportFileName,ASTFunName); +end // #RNU_RES_B // --- Generate the names for the output arguments. --- diff --git a/2.3-1/macros/FunctionAnnotation/FA_GetOutArgInfo.sci b/2.3-1/macros/FunctionAnnotation/FA_GetOutArgInfo.sci index 4d1113ea..284f4a29 100644 --- a/2.3-1/macros/FunctionAnnotation/FA_GetOutArgInfo.sci +++ b/2.3-1/macros/FunctionAnnotation/FA_GetOutArgInfo.sci @@ -95,15 +95,15 @@ for counterout = 1:NOutArg UpdatedOutArg(counterout).FindLike = -1; end - // #RNU_RES_B - // When the size is given by e IN(x).VAL annotation we can have two cases: - // IN(x).VAL is a number or IN(x).VAL is %nan. When it is %nan the - // size is equal to the name of IN(x). - // This is a dynamic memory extension of a local variable and for the moment - // we issue an error according to SCI2C specifications - // #RNU_RES_E - //disp(FunSizeAnnot(2),FunSizeAnnot(1)) - //Ukasha +// #RNU_RES_B +// When the size is given by e IN(x).VAL annotation we can have two cases: +// IN(x).VAL is a number or IN(x).VAL is %nan. When it is %nan the +// size is equal to the name of IN(x). +// This is a dynamic memory extension of a local variable and for the moment +// we issue an error according to SCI2C specifications +// #RNU_RES_E +// disp(FunSizeAnnot(2),FunSizeAnnot(1)) +// Ukasha // if ASTFunName == svd // x=1; // for i=1:InArg(1).Size(1) diff --git a/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci b/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci index f46d1672..d1cfeff2 100644 --- a/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci +++ b/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci @@ -11118,6 +11118,110 @@ INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,E INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); +//------------------------------------ +//---- Class KALM -------------------- +//------------------------------------ +ClassName = 'KALM'; + +// --- Class Annotation. --- +PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y'); +ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls); + + +PrintStringInfo('NIN= 8',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 4',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= IN(1).TP',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= IN(4).SZ(1)',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= IN(2).SZ(2)',ClassFileName,'file','y'); + +PrintStringInfo('OUT(2).TP= IN(1).TP',ClassFileName,'file','y'); +PrintStringInfo('OUT(2).SZ(1)= IN(4).SZ(1)',ClassFileName,'file','y'); +PrintStringInfo('OUT(2).SZ(2)= IN(4).SZ(1)',ClassFileName,'file','y'); + +PrintStringInfo('OUT(3).TP= IN(1).TP',ClassFileName,'file','y'); +PrintStringInfo('OUT(3).SZ(1)= IN(2).SZ(1)',ClassFileName,'file','y'); +PrintStringInfo('OUT(3).SZ(2)= IN(2).SZ(2)',ClassFileName,'file','y'); + +PrintStringInfo('OUT(4).TP= IN(1).TP',ClassFileName,'file','y'); +PrintStringInfo('OUT(4).SZ(1)= IN(3).SZ(1)',ClassFileName,'file','y'); +PrintStringInfo('OUT(4).SZ(2)= IN(3).SZ(2)',ClassFileName,'file','y'); + + +ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls); +PrintStringInfo('d2d2d2d2d2d2d2d2'+ArgSeparator+'d2d2d2d2',ClassFileName,'file','y'); +PrintStringInfo('z2z2z2z2z2z2z2z2'+ArgSeparator+'z2z2z2z2',ClassFileName,'file','y'); + + +// --- Annotation Function And Function List Function. --- +FunctionName = 'kalm'; +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +//------------------------------------ +//---- Class MVCORREL -------------------- +//------------------------------------ +ClassName = 'MVCORREL'; + +// --- Class Annotation. --- +PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y'); +ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls); + + +PrintStringInfo('NIN= 1',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 1',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= IN(1).TP',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= IN(1).SZ(2)',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= IN(2).SZ(2)',ClassFileName,'file','y'); + +ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls); +PrintStringInfo('d2'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('z2'+ArgSeparator+'z2',ClassFileName,'file','y'); + + +// --- Annotation Function And Function List Function. --- +FunctionName = 'mvcorrel'; +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + +//------------------------------------ +//---- Class FAURRE -------------------- +//------------------------------------ +ClassName = 'FAURRE'; + +// --- Class Annotation. --- +PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y'); +ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls); + + +PrintStringInfo('NIN= 5',ClassFileName,'file','y'); +PrintStringInfo('NOUT= 3',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).TP= IN(1).TP',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(1)= IN(4).SZ(1)',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= IN(4).SZ(1)',ClassFileName,'file','y'); + +PrintStringInfo('OUT(2).TP= IN(1).TP',ClassFileName,'file','y'); +PrintStringInfo('OUT(2).SZ(1)= IN(5).SZ(1)',ClassFileName,'file','y'); +PrintStringInfo('OUT(2).SZ(2)= IN(5).SZ(2)',ClassFileName,'file','y'); + +PrintStringInfo('OUT(3).TP= IN(1).TP',ClassFileName,'file','y'); +PrintStringInfo('OUT(3).SZ(1)= IN(4).SZ(1)',ClassFileName,'file','y'); +PrintStringInfo('OUT(3).SZ(2)= IN(5).SZ(1)',ClassFileName,'file','y'); + + +ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls); +PrintStringInfo('d0d2d2d2d2'+ArgSeparator+'d2d2d2',ClassFileName,'file','y'); +PrintStringInfo('z0z2z2z2z2'+ArgSeparator+'z2z2z2',ClassFileName,'file','y'); + + +// --- Annotation Function And Function List Function. --- +FunctionName = 'faurre'; +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + + //------------------------------------ //---- Class CHEB1MAG -------------------- //------------------------------------ diff --git a/2.3-1/macros/findDeps/getAllHeaders.sci b/2.3-1/macros/findDeps/getAllHeaders.sci index e4d7133e..2135dced 100644 --- a/2.3-1/macros/findDeps/getAllHeaders.sci +++ b/2.3-1/macros/findDeps/getAllHeaders.sci @@ -155,6 +155,7 @@ function allHeaders = getAllHeaders(SharedInfo) "src/c/statisticsFunctions/includes/sum.h" "src/c/statisticsFunctions/includes/mean.h" "src/c/statisticsFunctions/includes/median.h" + "src/c/statisticsFunctions/includes/mvcorrel.h" "src/c/statisticsFunctions/includes/nanmedian.h" "src/c/statisticsFunctions/includes/gsort.h" "src/c/statisticsFunctions/includes/nanstdev.h" @@ -201,6 +202,8 @@ function allHeaders = getAllHeaders(SharedInfo) "src/c/signalProcessing/includes/zpch1.h" "src/c/signalProcessing/includes/zpch2.h" "src/c/signalProcessing/includes/buttmag.h" + "src/c/signalProcessing/includes/kalm.h" + "src/c/signalProcessing/includes/faurre.h" "src/c/signalProcessing/includes/cheb1mag.h" "src/c/signalProcessing/includes/cheb2mag.h" "src/c/signalProcessing/includes/sincd.h" diff --git a/2.3-1/macros/findDeps/getAllInterfaces.sci b/2.3-1/macros/findDeps/getAllInterfaces.sci index 48028745..601d5255 100644 --- a/2.3-1/macros/findDeps/getAllInterfaces.sci +++ b/2.3-1/macros/findDeps/getAllInterfaces.sci @@ -144,6 +144,7 @@ function allInterfaces = getAllInterfaces(SharedInfo) "src/c/elementaryFunctions/interfaces/int_isinf.h" "src/c/statisticsFunctions/interfaces/int_mean.h" "src/c/statisticsFunctions/interfaces/int_median.h" + "src/c/statisticsFunctions/interfaces/int_mvcorrel.h" "src/c/statisticsFunctions/interfaces/int_nanmedian.h" "src/c/statisticsFunctions/interfaces/int_gsort.h" "src/c/statisticsFunctions/interfaces/int_nanstdev.h" @@ -199,6 +200,8 @@ function allInterfaces = getAllInterfaces(SharedInfo) "src/c/signalProcessing/interfaces/int_zpch1.h" "src/c/signalProcessing/interfaces/int_zpch2.h" "src/c/signalProcessing/interfaces/int_buttmag.h" + "src/c/signalProcessing/interfaces/int_kalm.h" + "src/c/signalProcessing/interfaces/int_faurre.h" "src/c/signalProcessing/interfaces/int_cheb1mag.h" "src/c/signalProcessing/interfaces/int_cheb2mag.h" "src/c/signalProcessing/interfaces/int_sincd.h" diff --git a/2.3-1/macros/findDeps/getAllSources.sci b/2.3-1/macros/findDeps/getAllSources.sci index 606139a7..6594a2e1 100644 --- a/2.3-1/macros/findDeps/getAllSources.sci +++ b/2.3-1/macros/findDeps/getAllSources.sci @@ -1017,6 +1017,7 @@ function allSources = getAllSources(SharedInfo,BuildTool) "src/c/statisticsFunctions/median/zmediana.c" "src/c/statisticsFunctions/median/zmediancola.c" "src/c/statisticsFunctions/median/zmedianrowa.c" + "src/c/statisticsFunctions/mvcorrel/dmvcorrela.c" "src/c/statisticsFunctions/stdev/dstdeva.c" "src/c/statisticsFunctions/stdev/dstdevrowa.c" "src/c/statisticsFunctions/stdev/dstdevcola.c" @@ -1330,6 +1331,9 @@ function allSources = getAllSources(SharedInfo,BuildTool) "src/c/signalProcessing/zpch1/dzpch1s.c" "src/c/signalProcessing/zpch2/dzpch2s.c" "src/c/signalProcessing/buttmag/dbuttmags.c" + "src/c/signalProcessing/kalm/dkalma.c" + "src/c/signalProcessing/kalm/zkalma.c" + "src/c/signalProcessing/faurre/dfaurrea.c" "src/c/signalProcessing/cheb1mag/dcheb1mags.c" "src/c/signalProcessing/cheb2mag/dcheb2mags.c" "src/c/signalProcessing/sincd/dsincds.c" diff --git a/2.3-1/src/c/interpolation/interpln/dinterplna.c b/2.3-1/src/c/interpolation/interpln/dinterplna.c new file mode 100644 index 00000000..76cd7f83 --- /dev/null +++ b/2.3-1/src/c/interpolation/interpln/dinterplna.c @@ -0,0 +1,29 @@ +/* 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 +*/ + + +#include "interpln.h" +#include "stdio.h" +#include "matrixInversion.h" +#include "matrixTranspose.h" + +void dinterplna(double* xyd, int nd, double* x, int x_row, int x_col) +{ + int md=2; + int n= x_col*x_row; + + + + +} + + diff --git a/2.3-1/src/c/interpolation/interpln/sinterp13a.c b/2.3-1/src/c/interpolation/interpln/sinterp13a.c new file mode 100644 index 00000000..b8cb0851 --- /dev/null +++ b/2.3-1/src/c/interpolation/interpln/sinterp13a.c @@ -0,0 +1,75 @@ +/* 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: Ukasha Noor + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "interp1.h" +#include + +void sinterp13a(float *x,int size1,float *fx,int size2,float *q,int size3,char *ch,int size4,float *out) +{ + int i,j,k,f; + float a,b; + if(strcmp(ch,"linear")==0) + { + for(i=0;ix[j]) + { + j++; + } + a=x[j-1]; + b=x[j]; + out[i]=fx[j-1]+(q[i]-a)*((fx[j]-fx[j-1])/(b-a)); + } + } + } + else if(strcmp(ch,"nearest")==0) + { + for(i=0;ix[j]) + { + j++; + } + out[i]=fx[j]; + } + } + } +} + + diff --git a/2.3-1/src/c/signalProcessing/faurre/dfaurrea.c b/2.3-1/src/c/signalProcessing/faurre/dfaurrea.c new file mode 100644 index 00000000..04d5a697 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/faurre/dfaurrea.c @@ -0,0 +1,112 @@ +/* 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 + */ + +/*Funtion to find faurre */ + +#include "lapack.h" +#include "stdlib.h" +#include "string.h" +#include "faurre.h" +#include "matrixTranspose.h" +#include "matrixMultiplication.h" +#include "matrixInversion.h" +#include "addition.h" +#include "subtraction.h" +#include "eye.h" +#include "matrixDivision.h" + +void dfaurrea(int n, double* H, int H_row, int H_col, double* F, int F_row, int F_col, double* G, int G_row, int G_col, double * R0, int R0_row, int R0_col, double* P, double *R , double* T ) +{ + +/*Variable Declaration Start*/ + double R0_inv[R0_row* R0_col]; + double temp1[G_row* R0_col]; + double Pn[G_row* G_row]; + double Pn_temp[G_row*G_row]; + double G_trans[G_col*G_row]; + double H_trans[H_col*H_row]; + double F_trans[F_col*F_row]; + double A_trans[G_col*G_row]; + double temp2[F_row*G_row]; + double temp3[F_row*H_row]; + double A[G_row*G_col]; + double temp4[H_row*G_row]; + double temp5[H_row*H_row]; + double temp6[R0_row*R0_col]; + double temp7[G_row*R0_row]; + double temp8[G_row*G_row]; + double temp9[F_row*F_col]; + double temp10[H_row*G_row]; + double temp11[H_row*H_row]; + double temp12[F_row*G_row]; + double temp13[F_row*H_row]; + double temp14[G_row*G_col]; +/*Variable Declaration End*/ + + dinverma(R0, R0_inv, R0_row); //R0_inv= inv(R0) + dmulma(G, G_row, G_col, R0_inv, R0_row, R0_col, temp1); //temp1= G* inv(R0) + dtransposea(G, G_row, G_col, G_trans); //G_trans= G' + dmulma(temp1, G_row, R0_col, G_trans, G_col, G_row, Pn ); // Pn= G* inv(R0)* G' + dtransposea(H, H_row, H_col, H_trans); //H_trans= H' + dtransposea(F, F_row, F_col, F_trans); //F_trans= F' + +/*//Debug Only*/ +/* for(int i=0; i< G_row*G_row; i++)*/ +/* printf("Before loop Pn[%d]= %lf \t", i, Pn[i]);*/ +/* printf("\n");*/ + + for(int i=1;i <= n ; i++) + { + dmulma(F, F_row, F_col, Pn, G_row, G_row, temp2); //temp2= F*Pn; + dmulma(temp2, F_row, G_row, H_trans, H_col, H_row, temp3); //temp3= F*Pn*H' + ddiffa( G, G_row*G_col, temp3, F_row*H_row, A); //A = G- F*Pn*H' + dtransposea(A, G_row, G_col, A_trans); //A_trans= A' + dmulma(H, H_row, H_col, Pn, G_row, G_row, temp4); //temp4= H*Pn + dmulma(temp4, H_row, G_row, H_trans, H_col, H_row, temp5 ); //temp5= H*Pn*H' + ddiffa(R0, R0_row*R0_col, temp5, H_row*H_row,temp6 ); //temp6= R0-H*Pn*H' + drdivma(A,G_row, G_col, temp6, R0_row, R0_col, temp7); //temp7= A / (R0-H*Pn*H') + dmulma(temp7, G_row, R0_row, A_trans, G_col, G_row, temp8); //temp8 = A / (R0-H*Pn*H')*A' + dmulma(temp2, F_row, G_row, F_trans, F_col, F_row, temp9); //temp9= F*Pn*F' + dadda(temp9, F_row*F_col,temp8,G_row*G_row, Pn_temp); //Pn_temp = F*Pn*F'+ A / (R0-H*Pn*H')*A' + for(int j=0; j< G_row*G_row; j++) + Pn[j]= Pn_temp[j]; + + } + +/* //Debug Only*/ +/* for(int i=0; i< G_row*G_row; i++)*/ +/* printf("Afterloop Pn[%d]= %lf \t", i, Pn[i]);*/ +/* printf("\n");*/ + + for(int j=0; j< G_row*G_row; j++) + P[j]= Pn[j]; + + dmulma(H, H_row, H_col, P, G_row, G_row, temp10); //temp10= H*P + dmulma(temp10, H_row, G_row, H_trans, H_col, H_row, temp11 ); //temp11= H*P*H' + ddiffa(R0, R0_row*R0_col, temp11, H_row*H_row, R ); //R= R0-H*P*H' + +/* //Debug Only*/ +/* for(int i=0; i< H_row*H_row; i++)*/ +/* printf("R[%d]= %lf \t", i, R[i]);*/ +/* printf("\n");*/ + + dmulma(F, F_row, F_col, P, G_row, G_row, temp12); //temp12= F*P; + dmulma(temp12, F_row, G_row, H_trans, H_col, H_row, temp13); //temp13= F*P*H' + ddiffa( G, G_row*G_col, temp13, F_row*H_row, temp14); //temp14 = G- F*P*H' + drdivma(temp14,G_row, G_col, R, R0_row, R0_col, T); //T= (G-F*P*H')/ R + +/* //Debug Only*/ +/* for(int i=0; i< G_row*R0_row; i++)*/ +/* printf("T[%d]= %lf \t", i, T[i]);*/ +/* printf("\n");*/ + +} diff --git a/2.3-1/src/c/signalProcessing/includes/faurre.h b/2.3-1/src/c/signalProcessing/includes/faurre.h new file mode 100644 index 00000000..e4a2de3c --- /dev/null +++ b/2.3-1/src/c/signalProcessing/includes/faurre.h @@ -0,0 +1,29 @@ +/* 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 __FAURRE_H__ +#define __FAURRE_H__ +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dfaurrea(int n, double* H, int H_row, int H_col, double* F, int F_row, int F_col, double* G, int G_row, int G_col, double * R0, int R0_row, int R0_col, double * P, double* R, double* T); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __FAURRE_H__ */ + diff --git a/2.3-1/src/c/signalProcessing/includes/kalm.h b/2.3-1/src/c/signalProcessing/includes/kalm.h new file mode 100644 index 00000000..7cd5a551 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/includes/kalm.h @@ -0,0 +1,33 @@ +/* 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 __KALM_H__ +#define __KALM_H__ +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +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" */ +#endif + +#endif /* __KALM_H__ */ + diff --git a/2.3-1/src/c/signalProcessing/interfaces/int_faurre.h b/2.3-1/src/c/signalProcessing/interfaces/int_faurre.h new file mode 100644 index 00000000..e527a639 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/interfaces/int_faurre.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_FAURRE_H__ +#define __INT_FAURRE_H__ + +#define d0d2d2d2d2faurred2d2d2(in1,in2, size2, in3, size3, in4, size4, in5, size5,out1, out2, out3) \ + dfaurrea(in1,in2, size2[0], size2[1],in3, size3[0], size3[1],in4, size4[0], size4[1],in5, size5[0], size5[1], out1, out2, out3) + + +#endif /* !INT_FAURRE_H__! */ diff --git a/2.3-1/src/c/signalProcessing/interfaces/int_kalm.h b/2.3-1/src/c/signalProcessing/interfaces/int_kalm.h new file mode 100644 index 00000000..b03977d1 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/interfaces/int_kalm.h @@ -0,0 +1,25 @@ +/* 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_KALM_H__ +#define __INT_KALM_H__ + +#define d2d2d2d2d2d2d2d2kalmd2d2d2d2(in1, size1, in2, size2, in3, size3, in4, size4, in5, size5, in6, size6, in7, size7, in8, size8, out1, out2, out3, out4) \ + 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/2.3-1/src/c/signalProcessing/kalm/dkalma.c b/2.3-1/src/c/signalProcessing/kalm/dkalma.c new file mode 100644 index 00000000..d71a86a9 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/kalm/dkalma.c @@ -0,0 +1,118 @@ +/* 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 "kalm.h" +#include "matrixTranspose.h" +#include "matrixMultiplication.h" +#include "matrixInversion.h" +#include "addition.h" +#include "subtraction.h" +#include "eye.h" + +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) + +{ + double k[p0_row*h_row]; + double h_trans[h_col*h_row]; + double temp1[p0_row*h_row]; + double temp2[h_row*p0_col]; + double temp3[h_row*h_row]; + double temp4[h_row*h_row]; + double temp5[h_row*h_row]; + double temp6[p0_row*p0_col]; + double temp7[p0_row*h_col]; + double temp8[p0_row*p0_col]; + double f_trans[f_col*f_row]; + double g_trans[g_col*g_row]; + double temp9 [f_row*p0_col]; + double temp10[f_row*f_row]; + double temp11 [g_row*q_col]; + double temp12[g_row*g_row]; + double temp13[h_row*x0_col]; + double temp14[h_row*x0_col]; + double temp15[p0_row*x0_col]; + + + + 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 + +/*//Debug Only*/ +/* for(int i=0; i< h_row*h_row; i++)*/ +/* printf("temp4[%d] = %lf \t",i, temp4[i]);*/ +/* printf("\n");*/ + + dinverma(temp4, temp5, h_row); //temp5= (h*p0*h'+r)**(-1) + + dmulma(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");*/ + + + deyea(temp6, p0_row, p0_col); //temp6 = eye(p0) + dmulma(k, p0_row, h_row, h, h_row, h_col, temp7); //temp7 = k*h + ddiffa(temp6, p0_row*p0_col, temp7, p0_row*h_col, temp8); //temp8= eye(p0)- k*h + dmulma(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");*/ + + + dtransposea(g, g_row, g_col, g_trans); + dtransposea(f, f_row, f_col, f_trans); + dmulma(f, f_row, f_col, p, p0_row, p0_col, temp9); //temp9= f*p + dmulma(temp9, f_row, p0_col, f_trans, f_col, f_row, temp10); //temp10= f*p*f' + dmulma(g, g_row, g_col, q, q_row, q_col, temp11); //temp11= g*q + dmulma(temp11, g_row, q_col, g_trans, g_col, g_row, temp12); //temp12= g*q*g' + dadda(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");*/ + + + dmulma(h, h_row, h_col, x0, x0_row, x0_col, temp13); //temp13= h*x0 + ddiffa(y, y_row*y_col, temp13, h_row*x0_col, temp14); //temp14= y-h*x0 + dmulma(k, p0_row, h_row, temp14, h_row, x0_col, temp15); //temp15= k*(y-h*x0) + dadda(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");*/ + + + dmulma(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/2.3-1/src/c/signalProcessing/kalm/zkalma.c b/2.3-1/src/c/signalProcessing/kalm/zkalma.c new file mode 100644 index 00000000..f47e01ea --- /dev/null +++ b/2.3-1/src/c/signalProcessing/kalm/zkalma.c @@ -0,0 +1,119 @@ +/* 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/2.3-1/src/c/statisticsFunctions/includes/mvcorrel.h b/2.3-1/src/c/statisticsFunctions/includes/mvcorrel.h new file mode 100644 index 00000000..857bfd6c --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/includes/mvcorrel.h @@ -0,0 +1,33 @@ +/* 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 __MVCORREL_H__ +#define __MVCORREL_H__ + +#include "types.h" +#include "doubleComplex.h" +#include "uint16.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dmvcorrela(double* , int, int, double* ); + + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__MVCORREL_H__*/ diff --git a/2.3-1/src/c/statisticsFunctions/interfaces/int_mvcorrel.h b/2.3-1/src/c/statisticsFunctions/interfaces/int_mvcorrel.h new file mode 100644 index 00000000..361687ba --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/interfaces/int_mvcorrel.h @@ -0,0 +1,28 @@ +/* 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_MVCORREL_H__ +#define __INT_MVCORREL_H__ + + +#ifdef __cplusplus +extern "C" { +#endif + +#define d2mvcorreld2(in1, size, out) dmvcorrela(in1, size[0] ,size[1], out) + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_MVCORREL_H__*/ diff --git a/2.3-1/src/c/statisticsFunctions/mvcorrel/dmvcorrela.c b/2.3-1/src/c/statisticsFunctions/mvcorrel/dmvcorrela.c new file mode 100644 index 00000000..646e3db2 --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/mvcorrel/dmvcorrela.c @@ -0,0 +1,69 @@ +/* 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 +*/ + + +#include "mvcorrel.h" +#include "stdio.h" +#include "types.h" +#include "uint16.h" +#include "zeros.h" +#include "sum.h" +#include "ones.h" +#include "matrixMultiplication.h" +#include "subtraction.h" + +void dmvcorrela(double *in, int lx, int cx, double* out) +{ + double temp1[1* cx]; + double xbar[1* cx]; + double temp2[lx*1]; + double temp3[lx*cx]; + double temp4[lx*cx]; + double temp5[1* cx]; + double std[1*cx]; + + donesa ( temp2 , lx , 1 ); //temp2= ones(lx,1) + + if(lx==1) + { + dzerosa ( out , lx ,cx ); //out= zeros(lx,cx) + + } + + else + { + + drowsuma(in, lx, cx, temp1); //temp1= sum(x, "r") + + for(int i=0; i< 1*cx; i++) + xbar[i]= temp1[i]/ lx; // xbar= sum(x, "r")/ lx + //Debug Only + for(int i= 0; i< 1*cx; i++) + printf("xbar[%d]= %lf", i, xbar[i]); + printf("\n"); + + dmulma(temp2, lx,1, xbar, 1, cx, temp3 ); //temp3= ones(lx,1)*xbar + ddiffa(in, lx*cx, temp3, lx*cx, temp4); //temp4= x-ones(lx,1)*xbar + for(int i=0; i< lx*cx; i++) + temp4[i]= pow(temp4[i], 2); + drowsuma(temp4, lx, cx, temp5); //temp5= sum(r.^2, "r") + for(int i=0; i< 1*cx; i++) + std[i]= pow(temp5[i], 0.5); + //Debug Only + for(int i= 0; i< 1*cx; i++) + printf("std[%d]= %lf", i, std[i]); + printf("\n"); + } + + + +} -- cgit