Changeset 26372
- Timestamp:
- Dec 8, 2009, 7:10:29 PM (16 years ago)
- Location:
- branches/eam_branches/20091201/psLib/src
- Files:
-
- 3 edited
-
math/psMatrix.c (modified) (1 diff)
-
math/psMatrix.h (modified) (1 diff)
-
mathtypes/psVector.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/20091201/psLib/src/math/psMatrix.c
r26346 r26372 1144 1144 } 1145 1145 1146 // this is basically a wrapper for the gsl function: gsl_linalg_SV_decomp() 1147 // SVD decomposes matrix A based on the following equation: A = U w V^T .1148 // This function (as usual for SVD implementations) returns V not V^T.1149 // U and V are returned to images; w is returned to a vector. The input image is not modified.1150 // U, V, and w must be supplied as allocated structures, but their lengths are set here to match the1151 // dimensionality of A. 1152 // XXX there is no error handling for the gsl functions (anywhere inpsMatrix.c)1146 // this is basically a wrapper for the gsl function: gsl_linalg_SV_decomp() SVD decomposes 1147 // matrix A based on the following equation: A = U w V^T . This function (as usual for SVD 1148 // implementations) returns V not V^T. U and V are returned to images; w is returned to a 1149 // vector representing the diagonal of w. The input image A is not modified. U, V, and w may 1150 // be supplied as NULL or may be allocated; their lengths are set here to match the 1151 // dimensionality of A. XXX there is no error handling for the gsl functions (anywhere in 1152 // psMatrix.c) 1153 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); 1159 PS_ASSERT_GENERAL_IMAGE_NON_NULL(A, false); 1160 PS_CHECK_POINTERS(A, evec, false); 1161 PS_CHECK_DIMEN_AND_TYPE(A, PS_DIMEN_IMAGE, false); 1156 PS_ASSERT_PTR_NON_NULL(U, false); 1157 PS_ASSERT_PTR_NON_NULL(w, false); 1158 PS_ASSERT_PTR_NON_NULL(V, false); 1159 PS_ASSERT_PTR_NON_NULL(A, false); 1162 1160 1163 1161 // A is provided with size Nx,Ny = numCols,numRows -
branches/eam_branches/20091201/psLib/src/math/psMatrix.h
r26001 r26372 196 196 197 197 198 /// Single value decomposition , provided by Andy Becker199 psImage *psMatrixSVD(psImage* evec, psVector* eval, const psImage* in);198 /// Single value decomposition (original by Andy Becker, updated by EAM) 199 bool psMatrixSVD(psImage **U, psVector **w, psImage **V, const psImage *A); 200 200 201 201 /// @} -
branches/eam_branches/20091201/psLib/src/mathtypes/psVector.c
r24886 r26372 729 729 char line[1024]; 730 730 731 sprintf (line, " vector: %s\n", name);731 sprintf (line, "# vector: %s\n", name); 732 732 if (write(fd, line, strlen(line))) {;} //ignore return value 733 733
Note:
See TracChangeset
for help on using the changeset viewer.
