IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 22, 2005, 12:22:15 PM (21 years ago)
Author:
gusciora
Message:

Implementing psPoly nOrder/nTerm switch.

File:
1 edited

Legend:

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

    r5092 r5094  
    77*  polynomials.  It also contains a Gaussian functions.
    88*
    9 *  @version $Revision: 1.125 $ $Name: not supported by cvs2svn $
    10 *  @date $Date: 2005-09-22 20:45:43 $
     9*  @version $Revision: 1.126 $ $Name: not supported by cvs2svn $
     10*  @date $Date: 2005-09-22 22:22:15 $
    1111*
    1212*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    161161used frequently and the data structure created here does not contain the
    162162outer coefficients of the Chebyshev polynomials.
     163 
     164XXX: From the poly nOrder/nTerm changem the maxChebyPoly here is still nTerms,
     165not nOrder.
    163166 *****************************************************************************/
    164 static psPolynomial1D **createChebyshevPolys(unsigned int maxChebyPoly)
    165 {
     167static psPolynomial1D **createChebyshevPolys(psS32 maxChebyPoly)
     168{
     169    //printf("createChebyshevPolys(%d)\n", maxChebyPoly);
    166170    PS_ASSERT_INT_NONNEGATIVE(maxChebyPoly, NULL);
    167171
     
    169173
    170174    chebPolys = (psPolynomial1D **) psAlloc(maxChebyPoly * sizeof(psPolynomial1D *));
    171     for (unsigned int i = 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);
    173177    }
    174178
     
    184188            for (psS32 j = 0; j < chebPolys[i - 1]->COOL_1D_n; j++) {
    185189                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]);
    186191            }
    187192            for (psS32 j = 0; j < chebPolys[i - 2]->COOL_1D_n; j++) {
    188193                chebPolys[i]->coeff[j] -= chebPolys[i - 2]->coeff[j];
     194                //printf("chebPolys[%d]->coeff[%d] is %.2f\n", i, j, chebPolys[i]->coeff[j]);
    189195            }
    190196        }
     
    203209                                 const psPolynomial1D* poly)
    204210{
     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
    205215    unsigned int loop_x = 0;
    206216    psF64 polySum = 0.0;
     
    527537        maxChebyPoly = poly->COOL_4D_nT;
    528538    }
     539    // XXX: Add 1 since createChebyshevPolys() takes nTerms, not nOrder.
    529540    chebPolys = createChebyshevPolys(maxChebyPoly + 1);
    530541
     
    532543        for (loop_y = 0; loop_y < (1 + poly->COOL_4D_nY); loop_y++) {
    533544            for (loop_z = 0; loop_z < (1 + poly->COOL_4D_nZ); loop_z++) {
    534                 for (loop_t = 0; loop_t < (1 + poly->COOL_4D_nZ); loop_t++) {
     545                for (loop_t = 0; loop_t < (1 + poly->COOL_4D_nT); loop_t++) {
    535546                    if (poly->mask[loop_x][loop_y][loop_z][loop_t] == 0) {
    536547                        //printf("HMMM (%d, %d, %d, %d)\n", loop_x, loop_y, loop_z, loop_t);
    537548                        //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");
    539550                        polySum += poly->coeff[loop_x][loop_y][loop_z][loop_t] *
    540551                                   psPolynomial1DEval(chebPolys[loop_x], x) *
Note: See TracChangeset for help on using the changeset viewer.