IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 28, 2009, 10:59:54 AM (17 years ago)
Author:
eugene
Message:

added some test code to verify GJ elimination: move to a real test

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/math/psMinimizeLMM.c

    r23486 r23984  
    8080    assert (alpha->numCols == alpha->numRows);
    8181
     82# define TESTGJ 0
     83# if (TESTGJ)
     84    lambda = 0.0;
     85#endif
     86
    8287    // set new guess values, applying (1+lambda) scaling to pivots
    8388    Beta = psVectorCopy(Beta, beta, PS_TYPE_F32);
     
    9297        return(false);
    9398    }
     99
     100// XXX check that the GJ solver works:
     101# if (TESTGJ)
     102    psImage *out = psImageAlloc (alpha->numRows, alpha->numCols, PS_TYPE_F32);
     103    for (int oy = 0; oy < out->numRows; oy++) {
     104        for (int ox = 0; ox < out->numCols; ox++) {
     105            float value = 0;
     106            for (int i = 0; i < alpha->numCols; i++) {
     107                value += alpha->data.F32[i][ox]*Alpha->data.F32[oy][i];
     108            }
     109            out->data.F32[oy][ox] = value;
     110        }
     111    }
     112
     113    psVector *vect = psVectorAlloc (beta->n, PS_TYPE_F32);
     114    for (int oy = 0; oy < vect->n; oy++) {
     115        float value = 0;
     116        for (int i = 0; i < alpha->numCols; i++) {
     117            value += alpha->data.F32[oy][i]*Beta->data.F32[i];
     118        }
     119        vect->data.F32[oy] = value;
     120    }
     121   
     122    psFree (out);
     123    psFree (vect);
     124
     125# endif
    94126
    95127    // check for non-finite entries in result
Note: See TracChangeset for help on using the changeset viewer.