/* 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