diff options
author | Brijeshcr | 2017-07-06 15:48:47 +0530 |
---|---|---|
committer | GitHub | 2017-07-06 15:48:47 +0530 |
commit | ea958d3c401761dcc24865d9639b2fab31038db8 (patch) | |
tree | 8cea93113a46d7015d1a10638778f92275a0ca94 /src/c/linearAlgebra/sva | |
parent | cb1d99232e521c34e9f0c271a6c4176cc7b9cbe4 (diff) | |
download | Scilab2C_fossee_old-ea958d3c401761dcc24865d9639b2fab31038db8.tar.gz Scilab2C_fossee_old-ea958d3c401761dcc24865d9639b2fab31038db8.tar.bz2 Scilab2C_fossee_old-ea958d3c401761dcc24865d9639b2fab31038db8.zip |
Revert "LinearAlgebra Function Added"
Diffstat (limited to 'src/c/linearAlgebra/sva')
-rw-r--r-- | src/c/linearAlgebra/sva/dsvaa.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/c/linearAlgebra/sva/dsvaa.c b/src/c/linearAlgebra/sva/dsvaa.c index 691694e..b7d07d8 100644 --- a/src/c/linearAlgebra/sva/dsvaa.c +++ b/src/c/linearAlgebra/sva/dsvaa.c @@ -20,7 +20,6 @@ #define eps 2.22044604925e-16 -/* Ref: Scilab source code */ void dsvaa(int ninp,double *in1,int row,int col,double in2,double *out1, \ double *out2,double *out3){ @@ -34,14 +33,14 @@ void dsvaa(int ninp,double *in1,int row,int col,double in2,double *out1, \ /* Calculation of svd of a given matrix */ double *U,*S,*V; - U = (double *)malloc((double)row*Min(row,col)*sizeof(double)); - S = (double *)malloc((double)Min(row,col)*Min(row,col)*sizeof(double)); - V = (double *)malloc((double)col*Min(row,col)*sizeof(double)); + U = (double *)malloc((double)row*min(row,col)*sizeof(double)); + S = (double *)malloc((double)min(row,col)*min(row,col)*sizeof(double)); + V = (double *)malloc((double)col*min(row,col)*sizeof(double)); dsvda(0,in1,M,N,1,3,U,S,V); if (ninp == 1){ /* [u,s,v] = sva(A) when input is only matrix */ - tol = Max(row,col)*S[0]*eps; + tol = max(row,col)*S[0]*eps; rk = 0; for(i=0;i<col;i++){ if(S[i+i*row] > tol){ @@ -53,7 +52,7 @@ void dsvaa(int ninp,double *in1,int row,int col,double in2,double *out1, \ tol = in2; if(tol > 1){ rk = tol; - if(rk > Min(row,col)){ + if(rk > min(row,col)){ printf("ERROR: Wrong value for input argument !"); out1 = NULL; out2 = NULL; @@ -71,21 +70,21 @@ void dsvaa(int ninp,double *in1,int row,int col,double in2,double *out1, \ } } arow = M; - acol = Min(M,N); /* Copying, the output in required format */ + acol = min(M,N); for(i=0;i<arow;i++){ for(j=0;j<rk;j++){ out1[i+j*row]=U[i+j*arow]; } } - arow = Min(M,N); - for(i=0;i<rk;i++){ /* Copying, the output in required format */ + arow = min(M,N); + for(i=0;i<rk;i++){ for(j=0;j<rk;j++){ out2[i+j*(int)rk] = S[i+j*arow]; } } arow = N; - acol = Min(M,N); - for(i=0;i<arow;i++){ /* Copying, the output in required format */ + acol = min(M,N); + for(i=0;i<arow;i++){ for(j=0;j<rk;j++){ out3[i+j*arow] = V[i+j*arow]; } |