IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 15, 2009, 4:58:42 PM (17 years ago)
Author:
Paul Price
Message:

Fixed implementation of chi2 penalties. Using penalties going as r4 (following Yuan & Akerlof 2008).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/pap/psModules/src/imcombine/pmSubtractionEquation.c

    r25858 r25860  
    379379
    380380// Add in penalty term to least-squares vector
    381 static bool calculatePenalty(psVector *vector, // Vector to which to add in penalty term
    382                              const pmSubtractionKernels *kernels // Kernel parameters
     381static bool calculatePenalty(psImage *matrix,                     // Matrix to which to add in penalty term
     382                             psVector *vector,                    // Vector to which to add in penalty term
     383                             const pmSubtractionKernels *kernels, // Kernel parameters
     384                             float norm                           // Normalisation
    383385    )
    384386{
     
    393395        for (int yOrder = 0, index = i; yOrder <= spatialOrder; yOrder++) {
    394396            for (int xOrder = 0; xOrder <= spatialOrder - yOrder; xOrder++, index += numKernels) {
    395                 vector->data.F64[index] -= penalties->data.F32[i];
     397                matrix->data.F64[index][index] -= norm * penalties->data.F32[i];
    396398            }
    397399        }
     
    786788#endif
    787789
    788         calculatePenalty(sumVector, kernels);
     790        int bgIndex = PM_SUBTRACTION_INDEX_BG(kernels); // Index for background
     791        calculatePenalty(sumMatrix, sumVector, kernels, sumMatrix->data.F64[bgIndex][bgIndex]);
    789792
    790793#ifdef TESTING
     
    870873            }
    871874        }
    872         calculatePenalty(sumVector1, kernels);
    873         calculatePenalty(sumVector2, kernels);
     875
     876        int bgIndex = PM_SUBTRACTION_INDEX_BG(kernels); // Index for background
     877        calculatePenalty(sumMatrix1, sumVector1, kernels, sumMatrix1->data.F64[bgIndex][bgIndex]);
     878        calculatePenalty(sumMatrix2, sumVector2, kernels, -sumMatrix1->data.F64[bgIndex][bgIndex]);
    874879
    875880        // Pure matrix operations
Note: See TracChangeset for help on using the changeset viewer.