diff options
author | Brijeshcr | 2017-09-11 12:03:59 +0530 |
---|---|---|
committer | GitHub | 2017-09-11 12:03:59 +0530 |
commit | b2518f279a3005536e87e45302d4e05d9aeb6d3d (patch) | |
tree | 007de2537151d82e75a6015f47f228402144763e /2.3-1/src/c/statisticsFunctions/mvcorrel | |
parent | a7ca3ed26f1fa8f51c586aba300005bf4a700cc4 (diff) | |
parent | 75558fc35bebe72c6db7e1b3b0c7ae214aa4fc8e (diff) | |
download | Scilab2C-master.tar.gz Scilab2C-master.tar.bz2 Scilab2C-master.zip |
Merged and added functions
Diffstat (limited to '2.3-1/src/c/statisticsFunctions/mvcorrel')
4 files changed, 242 insertions, 0 deletions
diff --git a/2.3-1/src/c/statisticsFunctions/mvcorrel/dmvcorrel1a.c b/2.3-1/src/c/statisticsFunctions/mvcorrel/dmvcorrel1a.c new file mode 100644 index 00000000..9971e0fb --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/mvcorrel/dmvcorrel1a.c @@ -0,0 +1,34 @@ +/* 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 "stdlib.h" +#include "stdio.h" +#include "types.h" +#include "uint16.h" +#include "zeros.h" +#include "sum.h" +#include "ones.h" +#include "matrixMultiplication.h" +#include "matrixTranspose.h" +#include "subtraction.h" +#include "division.h" + +double dmvcorrel1a(int lx, int cx) +{ + if(lx==1 && cx==1) + return 0; + + else + return 1; +} 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..a1bacfdc --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/mvcorrel/dmvcorrela.c @@ -0,0 +1,87 @@ +/* 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 "stdlib.h" +#include "stdio.h" +#include "pow.h" +#include "division.h" +#include "types.h" +#include "uint16.h" +#include "zeros.h" +#include "sum.h" +#include "ones.h" +#include "matrixMultiplication.h" +#include "matrixTranspose.h" +#include "subtraction.h" +#include "division.h" + +void dmvcorrela(double *in, int lx, int cx, double* r) +{ + double temp1[1* cx]; + double xbar[1* cx]; + double temp2[lx*1]; + double temp3[lx*cx]; + double temp4[lx*cx]; + double temp4_trans[cx*lx]; + double temp5[1* cx]; + double temp6[lx*cx]; + double std[1*cx]; + double std_trans[cx*1]; + double temp7[cx*cx]; + double temp8[cx*cx]; + + donesa ( temp2 , lx , 1 ); //temp2= ones(lx,1) + + if(lx==1) + { + dzerosa ( r , cx ,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]= drdivs(temp1[i], lx); // xbar= sum(x, "r")/ lx +/* //Debug Only*/ +/* for(int i= 0; i< 1*cx; i++)*/ +/* printf("xbar[%d]= %lf\t", 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= r= x-ones(lx,1)*xbar + for(int i=0; i< lx*cx; i++) + temp6[i]= dpows(temp4[i], 2); //temp6= r.^2 + drowsuma(temp6, lx, cx, temp5); //temp5= sum(r.^2, "r") + for(int i=0; i< 1*cx; i++) + std[i]= dpows(temp5[i], 0.5); //std=(sum(r .^2,"r")) .^ (0.5) +/* //Debug Only*/ +/* for(int i= 0; i< 1*cx; i++)*/ +/* printf("std[%d]= %lf\t", i, std[i]);*/ +/* printf("\n"); */ + dtransposea ( temp4 , lx , cx, temp4_trans); //temp4_trans= r' + dtransposea ( std , 1 , cx, std_trans); //std_trans= std' + dmulma(temp4_trans, cx,lx, temp4, lx, cx, temp7 ); //temp7= r'*r + dmulma(std_trans, cx, 1, std, 1,cx, temp8); //temp8= std'*std + + drdiva (temp7, temp8, cx*cx, r); // r=(r'*r) ./ (std'*std) + + + } + + + +} diff --git a/2.3-1/src/c/statisticsFunctions/mvcorrel/smvcorrel1a.c b/2.3-1/src/c/statisticsFunctions/mvcorrel/smvcorrel1a.c new file mode 100644 index 00000000..345ce601 --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/mvcorrel/smvcorrel1a.c @@ -0,0 +1,34 @@ +/* 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 "stdlib.h" +#include "stdio.h" +#include "types.h" +#include "uint16.h" +#include "zeros.h" +#include "sum.h" +#include "ones.h" +#include "matrixMultiplication.h" +#include "matrixTranspose.h" +#include "subtraction.h" +#include "division.h" + +float smvcorrel1a(int lx, int cx) +{ + if(lx==1 && cx==1) + return 0; + + else + return 1; +} diff --git a/2.3-1/src/c/statisticsFunctions/mvcorrel/smvcorrela.c b/2.3-1/src/c/statisticsFunctions/mvcorrel/smvcorrela.c new file mode 100644 index 00000000..8894ceeb --- /dev/null +++ b/2.3-1/src/c/statisticsFunctions/mvcorrel/smvcorrela.c @@ -0,0 +1,87 @@ +/* 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 "stdlib.h" +#include "stdio.h" +#include "types.h" +#include "pow.h" +#include "uint16.h" +#include "zeros.h" +#include "sum.h" +#include "ones.h" +#include "matrixMultiplication.h" +#include "division.h" +#include "matrixTranspose.h" +#include "subtraction.h" +#include "division.h" + +void smvcorrela(float *in, int lx, int cx, float* r) +{ + float temp1[1* cx]; + float xbar[1* cx]; + float temp2[lx*1]; + float temp3[lx*cx]; + float temp4[lx*cx]; + float temp4_trans[cx*lx]; + float temp5[1* cx]; + float temp6[lx*cx]; + float std[1*cx]; + float std_trans[cx*1]; + float temp7[cx*cx]; + float temp8[cx*cx]; + + sonesa ( temp2 , lx , 1 ); //temp2= ones(lx,1) + + if(lx==1) + { + szerosa ( r , cx ,cx ); //out= zeros(lx,cx) + + } + + else + { + + srowsuma(in, lx, cx, temp1); //temp1= sum(x, "r") + + for(int i=0; i< 1*cx; i++) + xbar[i]= srdivs(temp1[i], lx); // xbar= sum(x, "r")/ lx +/* //Debug Only*/ +/* for(int i= 0; i< 1*cx; i++)*/ +/* printf("xbar[%d]= %lf\t", i, xbar[i]);*/ +/* printf("\n");*/ + + smulma(temp2, lx,1, xbar, 1, cx, temp3 ); //temp3= ones(lx,1)*xbar + sdiffa(in, lx*cx, temp3, lx*cx, temp4); //temp4= r= x-ones(lx,1)*xbar + for(int i=0; i< lx*cx; i++) + temp6[i]= spows(temp4[i], 2); //temp6= r.^2 + srowsuma(temp6, lx, cx, temp5); //temp5= sum(r.^2, "r") + for(int i=0; i< 1*cx; i++) + std[i]= spows(temp5[i], 0.5); //std=(sum(r .^2,"r")) .^ (0.5) +/* //Debug Only*/ +/* for(int i= 0; i< 1*cx; i++)*/ +/* printf("std[%d]= %lf\t", i, std[i]);*/ +/* printf("\n"); */ + stransposea ( temp4 , lx , cx, temp4_trans); //temp4_trans= r' + stransposea ( std , 1 , cx, std_trans); //std_trans= std' + smulma(temp4_trans, cx,lx, temp4, lx, cx, temp7 ); //temp7= r'*r + smulma(std_trans, cx, 1, std, 1,cx, temp8); //temp8= std'*std + + srdiva (temp7, temp8, cx*cx, r); // r=(r'*r) ./ (std'*std) + + + } + + + +} |