From 06337f0dc8114c70fd0c7767083971a0d091750a Mon Sep 17 00:00:00 2001 From: Sandeep Gupta Date: Wed, 5 Jul 2017 12:41:25 +0530 Subject: LinearAlgebra and MatrixOperation Update --- src/c/linearAlgebra/fullrf/dfullrfa.c | 112 ++++++++++++++++++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 src/c/linearAlgebra/fullrf/dfullrfa.c (limited to 'src/c/linearAlgebra/fullrf/dfullrfa.c') diff --git a/src/c/linearAlgebra/fullrf/dfullrfa.c b/src/c/linearAlgebra/fullrf/dfullrfa.c new file mode 100644 index 0000000..a409ae3 --- /dev/null +++ b/src/c/linearAlgebra/fullrf/dfullrfa.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: Sandeep Gupta + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +/* FULL Rank factorization function in scilab */ + +/* + //[Q,M,rk]=fullrf(A) + //Full rank factorization : A=Q.M + //with range(Q)=range(A) and ker(M)=ker(A), + //Q full column rank , M full row rank + // rk = rank(A) = #columns(Q) = #rows(M) + //F.D. +*/ + +#include "fullrf.h" +#include +#include +#include "svd.h" +#include +#include "norm.h" +#include "matrixTranspose.h" +#include "matrixMultiplication.h" + +double dfullrfa(int ninp,double *inp1,int row,int col,double tol,double *out1,double *out2){ + + int i,j; + /* norm inp1 - norm(inp1,1)*/ + double na1; + na1 = dnorma(inp1,row,col,1); + + if(ninp == 1){ + tol = sqrt(pow(2,-52)); + } + + if(na1 < pow(1,-10)){ + out1 = NULL; + out2 = NULL; + return 0; + } + + double tol1; + tol1 = tol*na1; + + double *U,*S,*V; + U = (double *)malloc(row*row*sizeof(double)); + S = (double *)malloc(row*col*sizeof(double)); + V = (double *)malloc(col*col*sizeof(double)); + + double rk; + rk = dsvda(tol1,inp1,row,col,0,4,U,S,V); + + /* sq = sqrt(s) */ + for(i=0;i -#include -#include "svd.h" -#include -#include "norm.h" -#include "matrixTranspose.h" -#include "matrixMultiplication.h" - -double dfullrfa(int ninp,double *inp1,int row,int col,double tol,double *out1,double *out2){ - - int i,j; - /* norm inp1 - norm(inp1,1)*/ - double na1; - na1 = dnorma(inp1,row,col,1); - - if(ninp == 1){ - tol = sqrt(pow(2,-52)); - } - - if(na1 < pow(1,-10)){ - out1 = NULL; - out2 = NULL; - return 0; - } - - double tol1; - tol1 = tol*na1; - - double *U,*S,*V; - U = (double *)malloc(row*row*sizeof(double)); - S = (double *)malloc(row*col*sizeof(double)); - V = (double *)malloc(col*col*sizeof(double)); - - double rk; - rk = dsvda(tol1,inp1,row,col,0,4,U,S,V); - - /* sq = sqrt(s) */ - for(i=0;i +#include +#include "svd.h" +#include +#include "norm.h" +#include "matrixTranspose.h" +#include "matrixMultiplication.h" + +double dfullrfa(int ninp,double *inp1,int row,int col,double tol,double *out1,double *out2){ + + int i,j; + /* norm inp1 - norm(inp1,1)*/ + double na1; + na1 = dnorma(inp1,row,col,1); + + if(ninp == 1){ + tol = sqrt(pow(2,-52)); + } + + if(na1 < pow(1,-10)){ + out1 = NULL; + out2 = NULL; + return 0; + } + + double tol1; + tol1 = tol*na1; + + double *U,*S,*V; + U = (double *)malloc(row*row*sizeof(double)); + S = (double *)malloc(row*col*sizeof(double)); + V = (double *)malloc(col*col*sizeof(double)); + + double rk; + rk = dsvda(tol1,inp1,row,col,0,4,U,S,V); + + /* sq = sqrt(s) */ + for(i=0;i