Changeset 26346
- Timestamp:
- Dec 6, 2009, 8:41:25 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/20091201/psLib/src/math/psMatrix.c
r26344 r26346 1151 1151 // dimensionality of A. 1152 1152 // XXX there is no error handling for the gsl functions (anywhere in psMatrix.c) 1153 bool psMatrixSVD(psImage * U, psVector *w, psImage*V, const psImage *A)1153 bool psMatrixSVD(psImage **U, psVector **w, psImage **V, const psImage *A) 1154 1154 { 1155 1155 // Error checks Missing one for eval 1156 PS_ASSERT_PTR_NON_NULL(*U, false); 1157 PS_ASSERT_PTR_NON_NULL(*w, false); 1158 PS_ASSERT_PTR_NON_NULL(*V, false); 1156 1159 PS_ASSERT_GENERAL_IMAGE_NON_NULL(A, false); 1157 1160 PS_CHECK_POINTERS(A, evec, false); … … 1167 1170 int numCols = A->numCols; 1168 1171 1169 U = psImageRecycle(U, numCols, numRows, A->type.type);1170 V = psImageRecycle(V, numCols, numCols, A->type.type);1171 w = psVectorRecycle(w, numCols, A->type.type);1172 *U = psImageRecycle(*U, numCols, numRows, A->type.type); 1173 *V = psImageRecycle(*V, numCols, numCols, A->type.type); 1174 *w = psVectorRecycle(*w, numCols, A->type.type); 1172 1175 1173 1176 gsl_matrix *Agsl = gsl_matrix_alloc(numRows, numCols); … … 1183 1186 1184 1187 // Copy GSL matrix data to psImage data 1185 matrixGSLtoPS( V, Vgsl);1186 matrixGSLtoPS( U, Agsl); // gsl_linalg_SV_decomp replaces A with U1187 vectorGSLtoPS( S, Sgsl);1188 matrixGSLtoPS(*V, Vgsl); 1189 matrixGSLtoPS(*U, Agsl); // gsl_linalg_SV_decomp replaces A with U 1190 vectorGSLtoPS(*w, Sgsl); 1188 1191 1189 1192 // Free GSL data 1190 gsl_matrix_free(A );1191 gsl_matrix_free(V );1192 gsl_vector_free(S );1193 gsl_matrix_free(Agsl); 1194 gsl_matrix_free(Vgsl); 1195 gsl_vector_free(Sgsl); 1193 1196 gsl_vector_free(work); 1194 1197
Note:
See TracChangeset
for help on using the changeset viewer.
