Changeset 27838 for branches/tap_branches/Ohana/src/opihi/cmd.data/svd.c
- Timestamp:
- May 3, 2010, 8:41:49 AM (16 years ago)
- Location:
- branches/tap_branches
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/tap_branches
- Property svn:mergeinfo changed
-
branches/tap_branches/Ohana
-
Property svn:mergeinfo
set to (toggle deleted branches)
/trunk/Ohana merged eligible /branches/eam_branches/Ohana.20100407 27635-27772 /branches/pap_delete/Ohana 27530-27595
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
branches/tap_branches/Ohana/src/opihi/cmd.data/svd.c
r20936 r27838 57 57 /* use a bcopy instead? */ 58 58 59 // try C.R. Bond's version -- requires matrices in the form A[row][col] not A[row*Ncol + col] 60 if (1) { 61 int j; 62 double **a, **u, **v, *q; 63 ALLOCATE (a, double *, Ny); 64 ALLOCATE (u, double *, Ny); 65 ALLOCATE (v, double *, Ny); 66 for (i = 0; i < Ny; i++) { 67 ALLOCATE (a[i], double, Nx); 68 ALLOCATE (u[i], double, Nx); 69 ALLOCATE (v[i], double, Nx); 70 } 71 ALLOCATE (q, double, Nx); 72 73 for (j = 0; j < Ny; j++) { 74 for (i = 0; i < Nx; i++) { 75 a[j][i] = A[j*Nx + i]; 76 u[j][i] = 0; 77 v[j][i] = 0; 78 } 79 } 80 for (i = 0; i < Nx; i++) { 81 q[i] = 0; 82 } 83 84 # if 0 85 status = svdcmp_bond_raw (Ny, Nx, 1, 1, FLT_EPSILON, 1e-6, a, q, u, v); 86 fprintf (stderr, "status: %d\n", status); 87 # else 88 fprintf (stderr, "fix bond svdcmp\n"); 89 return FALSE; 90 # endif 91 92 // copy u q v back to U W V: 93 for (j = 0; j < Ny; j++) { 94 for (i = 0; i < Nx; i++) { 95 U[j*Nx + i] = u[j][i]; 96 V[j*Nx + i] = v[j][i]; 97 } 98 } 99 for (i = 0; i < Nx; i++) { 100 W[i] = q[i]; 101 } 102 103 for (j = 0; j < Ny; j++) { 104 free(a[j]); 105 free(u[j]); 106 free(v[j]); 107 } 108 free (a); 109 free (u); 110 free (v); 111 free (q); 112 113 return TRUE; 114 } 115 59 116 status = svdcmp (U, W, V, Nx, Ny); 60 117 if (!status) {
Note:
See TracChangeset
for help on using the changeset viewer.
