IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 26372


Ignore:
Timestamp:
Dec 8, 2009, 7:10:29 PM (16 years ago)
Author:
eugene
Message:

update the SVD calculation

Location:
branches/eam_branches/20091201/psLib/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/20091201/psLib/src/math/psMatrix.c

    r26346 r26372  
    11441144}
    11451145
    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 the
    1151 // dimensionality of A.
    1152 // XXX there is no error handling for the gsl functions (anywhere in psMatrix.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)
    11531153bool psMatrixSVD(psImage **U, psVector **w, psImage **V, const psImage *A)
    11541154{
    11551155    // 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);
    11621160
    11631161    // A is provided with size Nx,Ny = numCols,numRows
  • branches/eam_branches/20091201/psLib/src/math/psMatrix.h

    r26001 r26372  
    196196
    197197
    198 /// Single value decomposition, provided by Andy Becker
    199 psImage *psMatrixSVD(psImage* evec, psVector* eval, const psImage* in);
     198/// Single value decomposition (original by Andy Becker, updated by EAM)
     199bool psMatrixSVD(psImage **U, psVector **w, psImage **V, const psImage *A);
    200200
    201201/// @}
  • branches/eam_branches/20091201/psLib/src/mathtypes/psVector.c

    r24886 r26372  
    729729    char line[1024];
    730730
    731     sprintf (line, "vector: %s\n", name);
     731    sprintf (line, "# vector: %s\n", name);
    732732    if (write(fd, line, strlen(line))) {;} //ignore return value
    733733
Note: See TracChangeset for help on using the changeset viewer.