Changeset 5094 for trunk/psLib/src/math/psPolynomial.c
- Timestamp:
- Sep 22, 2005, 12:22:15 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/math/psPolynomial.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/math/psPolynomial.c
r5092 r5094 7 7 * polynomials. It also contains a Gaussian functions. 8 8 * 9 * @version $Revision: 1.12 5$ $Name: not supported by cvs2svn $10 * @date $Date: 2005-09-22 2 0:45:43$9 * @version $Revision: 1.126 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2005-09-22 22:22:15 $ 11 11 * 12 12 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 161 161 used frequently and the data structure created here does not contain the 162 162 outer coefficients of the Chebyshev polynomials. 163 164 XXX: From the poly nOrder/nTerm changem the maxChebyPoly here is still nTerms, 165 not nOrder. 163 166 *****************************************************************************/ 164 static psPolynomial1D **createChebyshevPolys(unsigned int maxChebyPoly) 165 { 167 static psPolynomial1D **createChebyshevPolys(psS32 maxChebyPoly) 168 { 169 //printf("createChebyshevPolys(%d)\n", maxChebyPoly); 166 170 PS_ASSERT_INT_NONNEGATIVE(maxChebyPoly, NULL); 167 171 … … 169 173 170 174 chebPolys = (psPolynomial1D **) psAlloc(maxChebyPoly * sizeof(psPolynomial1D *)); 171 for ( unsigned inti = 0; i < maxChebyPoly; i++) {172 chebPolys[i] = psPolynomial1DAlloc(i , PS_POLYNOMIAL_ORD);175 for (psS32 i = 0; i < maxChebyPoly; i++) { 176 chebPolys[i] = psPolynomial1DAlloc(i + 1, PS_POLYNOMIAL_ORD); 173 177 } 174 178 … … 184 188 for (psS32 j = 0; j < chebPolys[i - 1]->COOL_1D_n; j++) { 185 189 chebPolys[i]->coeff[j + 1] = 2 * chebPolys[i - 1]->coeff[j]; 190 //printf("chebPolys[%d]->coeff[%d] is %.2f\n", i, j + 1, chebPolys[i]->coeff[j + 1]); 186 191 } 187 192 for (psS32 j = 0; j < chebPolys[i - 2]->COOL_1D_n; j++) { 188 193 chebPolys[i]->coeff[j] -= chebPolys[i - 2]->coeff[j]; 194 //printf("chebPolys[%d]->coeff[%d] is %.2f\n", i, j, chebPolys[i]->coeff[j]); 189 195 } 190 196 } … … 203 209 const psPolynomial1D* poly) 204 210 { 211 //printf("ordPolynomial1DEval(%f): ", x); 212 //for (psS32 i = 0 ; i < (1 + poly->COOL_1D_n) ; i++) printf("(%.2f) ", poly->coeff[i]); 213 //printf("\n"); 214 205 215 unsigned int loop_x = 0; 206 216 psF64 polySum = 0.0; … … 527 537 maxChebyPoly = poly->COOL_4D_nT; 528 538 } 539 // XXX: Add 1 since createChebyshevPolys() takes nTerms, not nOrder. 529 540 chebPolys = createChebyshevPolys(maxChebyPoly + 1); 530 541 … … 532 543 for (loop_y = 0; loop_y < (1 + poly->COOL_4D_nY); loop_y++) { 533 544 for (loop_z = 0; loop_z < (1 + poly->COOL_4D_nZ); loop_z++) { 534 for (loop_t = 0; loop_t < (1 + poly->COOL_4D_n Z); loop_t++) {545 for (loop_t = 0; loop_t < (1 + poly->COOL_4D_nT); loop_t++) { 535 546 if (poly->mask[loop_x][loop_y][loop_z][loop_t] == 0) { 536 547 //printf("HMMM (%d, %d, %d, %d)\n", loop_x, loop_y, loop_z, loop_t); 537 548 //printf("HMMM (%d, %d, %d, %d)\n", chebPolys[loop_x]->COOL_1D_n, chebPolys[loop_y]->COOL_1D_n, chebPolys[loop_z]->COOL_1D_n, chebPolys[loop_t]->COOL_1D_n); 538 549 //printf("chebPolynomial4DEval()\n"); 539 550 polySum += poly->coeff[loop_x][loop_y][loop_z][loop_t] * 540 551 psPolynomial1DEval(chebPolys[loop_x], x) *
Note:
See TracChangeset
for help on using the changeset viewer.
