IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 26647


Ignore:
Timestamp:
Jan 20, 2010, 5:18:15 PM (16 years ago)
Author:
Paul Price
Message:

Threshold based on the total.

File:
1 edited

Legend:

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

    r26551 r26647  
    10651065    if (isfinite(thresh) && thresh > 0.0) {
    10661066        // Trim the singular values
    1067         thresh *= gsl_vector_get(S, 0);
    1068         psTrace("psLib.math", 8, "Singular value 0: %lf", gsl_vector_get(S, 0));
    1069         for (int i = 1; i < numCols; i++) {
     1067        double total = 0.0;             // Total of singular values
     1068        for (int i = 0; i < numCols; i++) {
     1069            total += gsl_vector_get(S, i);
     1070        }
     1071        thresh *= total;
     1072        for (int i = 0; i < numCols; i++) {
    10701073            double value = gsl_vector_get(S, i); // Singular value
    10711074            if (value < thresh) {
    1072                 psTrace("psLib.math", 5, "Trimming singular value %d: %lf", i, value);
     1075                psTrace("psLib.math", 5, "Trimming singular value %d: %lg", i, value);
    10731076                gsl_vector_set(S, i, 0.0);
     1077#if 0
    10741078                for (int j = 0; j < numCols; j++) {
    10751079                    // Being thorough; probably unnecessary
     
    10771081                    gsl_matrix_set(A, j, i, 0.0);
    10781082                }
     1083#endif
    10791084            } else {
    1080                 psTrace("psLib.math", 5, "Singular value %d: %lf", i, value);
     1085                psTrace("psLib.math", 5, "Singular value %d: %lg", i, value);
    10811086            }
    10821087        }
Note: See TracChangeset for help on using the changeset viewer.