summaryrefslogtreecommitdiff
path: root/2.3-1/src/c/linearAlgebra/svd
diff options
context:
space:
mode:
authorSandeep Gupta2017-07-05 12:41:25 +0530
committerSandeep Gupta2017-07-05 12:41:25 +0530
commitdd50e95a8193fb0faa846ccaa971a115ba69e71c (patch)
tree8d66abedd68dc5255ad323b95a16c9b592657f35 /2.3-1/src/c/linearAlgebra/svd
parent3308ea7a973e2c1e1c8bea99ac7cc783ce8e8b06 (diff)
downloadScilab2C-dd50e95a8193fb0faa846ccaa971a115ba69e71c.tar.gz
Scilab2C-dd50e95a8193fb0faa846ccaa971a115ba69e71c.tar.bz2
Scilab2C-dd50e95a8193fb0faa846ccaa971a115ba69e71c.zip
LinearAlgebra and MatrixOperation Update
Diffstat (limited to '2.3-1/src/c/linearAlgebra/svd')
-rw-r--r--2.3-1/src/c/linearAlgebra/svd/.1.c.swpbin0 -> 12288 bytes
-rw-r--r--2.3-1/src/c/linearAlgebra/svd/zsvda.c33
2 files changed, 21 insertions, 12 deletions
diff --git a/2.3-1/src/c/linearAlgebra/svd/.1.c.swp b/2.3-1/src/c/linearAlgebra/svd/.1.c.swp
new file mode 100644
index 00000000..81d9e9cf
--- /dev/null
+++ b/2.3-1/src/c/linearAlgebra/svd/.1.c.swp
Binary files differ
diff --git a/2.3-1/src/c/linearAlgebra/svd/zsvda.c b/2.3-1/src/c/linearAlgebra/svd/zsvda.c
index 0d360222..12a07aaf 100644
--- a/2.3-1/src/c/linearAlgebra/svd/zsvda.c
+++ b/2.3-1/src/c/linearAlgebra/svd/zsvda.c
@@ -113,7 +113,16 @@ void zsvda(doubleComplex *in1,int row,int col,int in2,int nout, doubleComplex *o
out3[i+j*N] = zconjs(VT[j+i*N]);
out3[j+i*N] = zconjs(VT[i+j*N]);
}
- }
+ }
+ /* output from zgesvd is copied to out2 variables in required format*/
+ for(j=0;j<M;j++){
+ for(k=0;k<N;k++){
+ if(j == k)
+ out2[j*(Min(M,N))+k] = DoubleComplex(S[j],0);
+ else
+ out2[j*(Min(M,N))+k] = DoubleComplex(0,0);
+ }
+ }
//ztransposea(VT,LDVT,Min(M,N),out3);
/*for(i=0;i<N;i++){
for(j=0;j<N;j++){
@@ -124,7 +133,7 @@ void zsvda(doubleComplex *in1,int row,int col,int in2,int nout, doubleComplex *o
//free(U);
//free(VT);
}
- else{
+ else{ /*svd(x,'e')*/
LDA = M;
LDU = M;
if(M > N){
@@ -156,18 +165,18 @@ void zsvda(doubleComplex *in1,int row,int col,int in2,int nout, doubleComplex *o
for(j=0;j<N;j++){
out3[j+i*N] = zconjs(VT[i+j*Min(M,N)]);
}
- }
+ }
+ /* output from zgesvd is copied to out2 variables in required format*/
+ for(j=0;j<Min(M,N);j++){
+ for(k=0;k<Min(M,N);k++){
+ if(j == k)
+ out2[j*(Min(M,N))+k] = DoubleComplex(S[j],0);
+ else
+ out2[j*(Min(M,N))+k] = DoubleComplex(0,0);
+ }
+ }
//free(U);
//free(VT);
}
- /* output from zgesvd is copied to out2 variables in required format*/
- for(j=0;j<Min(M,N);j++){
- for(k=0;k<Min(M,N);k++){
- if(j == k)
- out2[j*(Min(M,N))+k] = DoubleComplex(S[j],0);
- else
- out2[j*(Min(M,N))+k] = DoubleComplex(0,0);
- }
- }
}
}