Changeset 6891 for trunk/pois/src/poisSolveEquation.c
- Timestamp:
- Apr 18, 2006, 12:42:12 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/pois/src/poisSolveEquation.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pois/src/poisSolveEquation.c
r5717 r6891 4 4 #include "pois.h" 5 5 6 psVector *poisSolveEquation(psVector *solution, // Solution vector, or NULL7 const psArray *stamps, // Array of stamps8 const poisConfig *config6 psVector *poisSolveEquation(psVector *solution, // Solution vector, or NULL 7 const psArray *stamps, // Array of stamps 8 const poisConfig *config 9 9 ) 10 10 { … … 14 14 15 15 int size = (2 * config->xKernel + 1) * (2 * config->yKernel + 1) * (config->spatialOrder + 1) * 16 (config->spatialOrder + 2) / 2 + 1; // Size of matrix and vector16 (config->spatialOrder + 2) / 2 + 1; // Size of matrix and vector 17 17 18 18 assert(!solution || solution->n == size); … … 20 20 psImage *matrix = psImageAlloc(size, size, PS_TYPE_F64); 21 21 psVector *vector = psVectorAlloc(size, PS_TYPE_F64); 22 vector->n = size; 22 23 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; 27 28 } 28 29 29 30 for (int s = 0; s < stamps->n; s++) { 30 poisStamp *stamp = stamps->data[s]; // Stamp of interest31 psImage *stampMatrix = stamp->matrix; // Corresponding matrix32 psVector *stampVector = stamp->vector; // Corresponding vector31 poisStamp *stamp = stamps->data[s]; // Stamp of interest 32 psImage *stampMatrix = stamp->matrix; // Corresponding matrix 33 psVector *stampVector = stamp->vector; // Corresponding vector 33 34 34 // Check inputs35 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); 39 40 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 } 44 45 } 45 46 … … 53 54 printf("Matrix:\n"); 54 55 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"); 59 60 } 60 61 #endif
Note:
See TracChangeset
for help on using the changeset viewer.
