IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 18, 2006, 12:42:12 PM (20 years ago)
Author:
Paul Price
Message:

Updating to psLib rel11. Most changes are setting the 'n' element of the vector or array upon allocation. Needed to change the way the image subsets are done: not sure why we switched back to the old method of trim regions, but it seems we did.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/pois/src/poisSolveEquation.c

    r5717 r6891  
    44#include "pois.h"
    55
    6 psVector *poisSolveEquation(psVector *solution, // Solution vector, or NULL
    7                             const psArray *stamps, // Array of stamps
    8                             const poisConfig *config
     6psVector *poisSolveEquation(psVector *solution, // Solution vector, or NULL
     7                            const psArray *stamps, // Array of stamps
     8                            const poisConfig *config
    99    )
    1010{
     
    1414
    1515    int size = (2 * config->xKernel + 1) * (2 * config->yKernel + 1) * (config->spatialOrder + 1) *
    16         (config->spatialOrder + 2) / 2 + 1; // Size of matrix and vector
     16        (config->spatialOrder + 2) / 2 + 1; // Size of matrix and vector
    1717
    1818    assert(!solution || solution->n == size);
     
    2020    psImage *matrix = psImageAlloc(size, size, PS_TYPE_F64);
    2121    psVector *vector = psVectorAlloc(size, PS_TYPE_F64);
     22    vector->n = size;
    2223    for (int j = 0; j < size; j++) {
    23         for (int i = 0; i < size; i++) {
    24             matrix->data.F64[j][i] = 0.0;
    25         }
    26         vector->data.F64[j] = 0.0;
     24        for (int i = 0; i < size; i++) {
     25            matrix->data.F64[j][i] = 0.0;
     26        }
     27        vector->data.F64[j] = 0.0;
    2728    }
    2829
    2930    for (int s = 0; s < stamps->n; s++) {
    30         poisStamp *stamp = stamps->data[s]; // Stamp of interest
    31         psImage *stampMatrix = stamp->matrix; // Corresponding matrix
    32         psVector *stampVector = stamp->vector; // Corresponding vector
     31        poisStamp *stamp = stamps->data[s]; // Stamp of interest
     32        psImage *stampMatrix = stamp->matrix; // Corresponding matrix
     33        psVector *stampVector = stamp->vector; // Corresponding vector
    3334
    34         // Check inputs
    35         assert(matrix->type.type == PS_TYPE_F64);
    36         assert(vector->type.type == PS_TYPE_F64);
    37         assert(matrix->numCols == size && matrix->numRows == size);
    38         assert(vector->n == size);
     35        // Check inputs
     36        assert(matrix->type.type == PS_TYPE_F64);
     37        assert(vector->type.type == PS_TYPE_F64);
     38        assert(matrix->numCols == size && matrix->numRows == size);
     39        assert(vector->n == size);
    3940
    40         if (stamp->status == POIS_STAMP_USED) {
    41             (void)psBinaryOp(matrix, matrix, "+", stampMatrix);
    42             (void)psBinaryOp(vector, vector, "+", stampVector);
    43         }
     41        if (stamp->status == POIS_STAMP_USED) {
     42            (void)psBinaryOp(matrix, matrix, "+", stampMatrix);
     43            (void)psBinaryOp(vector, vector, "+", stampVector);
     44        }
    4445    }
    4546
     
    5354    printf("Matrix:\n");
    5455    for (int i = 0; i < matrix->numCols; i++) {
    55         for (int j = 0; j < matrix->numRows; j++) {
    56             printf("%f ", matrix->data.F64[i][j]);
    57         }
    58         printf("\n");
     56        for (int j = 0; j < matrix->numRows; j++) {
     57            printf("%f ", matrix->data.F64[i][j]);
     58        }
     59        printf("\n");
    5960    }
    6061#endif
Note: See TracChangeset for help on using the changeset viewer.