IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 3384


Ignore:
Timestamp:
Mar 7, 2005, 4:27:47 PM (21 years ago)
Author:
evanalst
Message:

Update psPolynomial1DEvalVector function.

Location:
trunk/psLib/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/dataManip/psFunctions.c

    r3380 r3384  
    77 *  polynomials.  It also contains a Gaussian functions.
    88 *
    9  *  @version $Revision: 1.91 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2005-03-07 20:56:13 $
     9 *  @version $Revision: 1.92 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2005-03-08 02:27:47 $
    1111 *
    1212 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    249249
    250250    psPolynomial1D **chebPolys = NULL;
    251     psS32 i = 0;
    252     psS32 j = 0;
    253251
    254252    chebPolys = (psPolynomial1D **) psAlloc(maxChebyPoly * sizeof(psPolynomial1D *));
    255     for (i = 0; i < maxChebyPoly; i++) {
     253    for (psS32 i = 0; i < maxChebyPoly; i++) {
    256254        chebPolys[i] = psPolynomial1DAlloc(i + 1, PS_POLYNOMIAL_ORD);
    257255    }
     
    265263        chebPolys[1]->coeff[1] = 1;
    266264    }
    267     for (i = 2; i < maxChebyPoly; i++) {
    268         for (j = 0; j < chebPolys[i - 1]->n; j++) {
     265    for (psS32 i = 2; i < maxChebyPoly; i++) {
     266        for (psS32 j = 0; j < chebPolys[i - 1]->n; j++) {
    269267            chebPolys[i]->coeff[j + 1] = 2 * chebPolys[i - 1]->coeff[j];
    270268        }
    271         for (j = 0; j < chebPolys[i - 2]->n; j++) {
     269        for (psS32 j = 0; j < chebPolys[i - 2]->n; j++) {
    272270            chebPolys[i]->coeff[j] -= chebPolys[i - 2]->coeff[j];
    273271        }
     
    12651263
    12661264    psVector *tmp;
    1267     psVector *myX;
    1268     psVector *myY;
    1269     psS32 i;
    12701265    psS32 vecLen=x->n;
    12711266
    1272     vecLen=x->n;
     1267    // Determine the length of the output vector to by the minimum of the x,y vectors
    12731268    if (y->n < vecLen) {
    12741269        vecLen = y->n;
    12751270    }
    12761271
     1272    // Create output vector to return
    12771273    tmp = psVectorAlloc(vecLen, PS_TYPE_F32);
    1278     for (i=0;i<vecLen;i++) {
    1279         tmp->data.F32[i] = psPolynomial2DEval(myPoly,
    1280                                               myX->data.F32[i],
    1281                                               myY->data.F32[i]);
    1282 
    1283     }
    1284 
    1285     if (x->type.type != PS_TYPE_F32) {
    1286         psFree(myX);
    1287     }
    1288     if (y->type.type != PS_TYPE_F32) {
    1289         psFree(myY);
    1290     }
     1274
     1275    // Evaluate the polynomial at the specified points
     1276    for (psS32 i=0; i<vecLen; i++) {
     1277        tmp->data.F32[i] = psPolynomial2DEval(myPoly,x->data.F32[i],y->data.F32[i]);
     1278    }
     1279
     1280    // Return output vector
    12911281    return(tmp);
    12921282}
     
    16641654
    16651655    psVector *tmp;
    1666     psVector *myX;
    1667     psVector *myY;
    1668     psS32 i;
    16691656    psS32 vecLen=x->n;
    16701657
    1671     vecLen=x->n;
     1658    // Determine the output vector length from minimum length of input vectors
    16721659    if (y->n < vecLen) {
    16731660        vecLen = y->n;
    16741661    }
    16751662
     1663    // Allocate output vector
    16761664    tmp = psVectorAlloc(vecLen, PS_TYPE_F64);
    1677     for (i=0;i<vecLen;i++) {
    1678         tmp->data.F64[i] = psDPolynomial2DEval(myPoly,
    1679                                                myX->data.F64[i],
    1680                                                myY->data.F64[i]);
    1681 
    1682     }
    1683 
    1684     if (x->type.type != PS_TYPE_F64) {
    1685         psFree(myX);
    1686     }
    1687     if (y->type.type != PS_TYPE_F64) {
    1688         psFree(myY);
    1689     }
     1665
     1666    // Evaluate the polynomial
     1667    for (psS32 i = 0; i < vecLen; i++) {
     1668        tmp->data.F64[i] = psDPolynomial2DEval(myPoly,x->data.F64[i],y->data.F64[i]);
     1669    }
     1670
     1671    // Return output vector
    16901672    return(tmp);
    16911673}
  • trunk/psLib/src/math/psPolynomial.c

    r3380 r3384  
    77 *  polynomials.  It also contains a Gaussian functions.
    88 *
    9  *  @version $Revision: 1.91 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2005-03-07 20:56:13 $
     9 *  @version $Revision: 1.92 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2005-03-08 02:27:47 $
    1111 *
    1212 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    249249
    250250    psPolynomial1D **chebPolys = NULL;
    251     psS32 i = 0;
    252     psS32 j = 0;
    253251
    254252    chebPolys = (psPolynomial1D **) psAlloc(maxChebyPoly * sizeof(psPolynomial1D *));
    255     for (i = 0; i < maxChebyPoly; i++) {
     253    for (psS32 i = 0; i < maxChebyPoly; i++) {
    256254        chebPolys[i] = psPolynomial1DAlloc(i + 1, PS_POLYNOMIAL_ORD);
    257255    }
     
    265263        chebPolys[1]->coeff[1] = 1;
    266264    }
    267     for (i = 2; i < maxChebyPoly; i++) {
    268         for (j = 0; j < chebPolys[i - 1]->n; j++) {
     265    for (psS32 i = 2; i < maxChebyPoly; i++) {
     266        for (psS32 j = 0; j < chebPolys[i - 1]->n; j++) {
    269267            chebPolys[i]->coeff[j + 1] = 2 * chebPolys[i - 1]->coeff[j];
    270268        }
    271         for (j = 0; j < chebPolys[i - 2]->n; j++) {
     269        for (psS32 j = 0; j < chebPolys[i - 2]->n; j++) {
    272270            chebPolys[i]->coeff[j] -= chebPolys[i - 2]->coeff[j];
    273271        }
     
    12651263
    12661264    psVector *tmp;
    1267     psVector *myX;
    1268     psVector *myY;
    1269     psS32 i;
    12701265    psS32 vecLen=x->n;
    12711266
    1272     vecLen=x->n;
     1267    // Determine the length of the output vector to by the minimum of the x,y vectors
    12731268    if (y->n < vecLen) {
    12741269        vecLen = y->n;
    12751270    }
    12761271
     1272    // Create output vector to return
    12771273    tmp = psVectorAlloc(vecLen, PS_TYPE_F32);
    1278     for (i=0;i<vecLen;i++) {
    1279         tmp->data.F32[i] = psPolynomial2DEval(myPoly,
    1280                                               myX->data.F32[i],
    1281                                               myY->data.F32[i]);
    1282 
    1283     }
    1284 
    1285     if (x->type.type != PS_TYPE_F32) {
    1286         psFree(myX);
    1287     }
    1288     if (y->type.type != PS_TYPE_F32) {
    1289         psFree(myY);
    1290     }
     1274
     1275    // Evaluate the polynomial at the specified points
     1276    for (psS32 i=0; i<vecLen; i++) {
     1277        tmp->data.F32[i] = psPolynomial2DEval(myPoly,x->data.F32[i],y->data.F32[i]);
     1278    }
     1279
     1280    // Return output vector
    12911281    return(tmp);
    12921282}
     
    16641654
    16651655    psVector *tmp;
    1666     psVector *myX;
    1667     psVector *myY;
    1668     psS32 i;
    16691656    psS32 vecLen=x->n;
    16701657
    1671     vecLen=x->n;
     1658    // Determine the output vector length from minimum length of input vectors
    16721659    if (y->n < vecLen) {
    16731660        vecLen = y->n;
    16741661    }
    16751662
     1663    // Allocate output vector
    16761664    tmp = psVectorAlloc(vecLen, PS_TYPE_F64);
    1677     for (i=0;i<vecLen;i++) {
    1678         tmp->data.F64[i] = psDPolynomial2DEval(myPoly,
    1679                                                myX->data.F64[i],
    1680                                                myY->data.F64[i]);
    1681 
    1682     }
    1683 
    1684     if (x->type.type != PS_TYPE_F64) {
    1685         psFree(myX);
    1686     }
    1687     if (y->type.type != PS_TYPE_F64) {
    1688         psFree(myY);
    1689     }
     1665
     1666    // Evaluate the polynomial
     1667    for (psS32 i = 0; i < vecLen; i++) {
     1668        tmp->data.F64[i] = psDPolynomial2DEval(myPoly,x->data.F64[i],y->data.F64[i]);
     1669    }
     1670
     1671    // Return output vector
    16901672    return(tmp);
    16911673}
  • trunk/psLib/src/math/psSpline.c

    r3380 r3384  
    77 *  polynomials.  It also contains a Gaussian functions.
    88 *
    9  *  @version $Revision: 1.91 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2005-03-07 20:56:13 $
     9 *  @version $Revision: 1.92 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2005-03-08 02:27:47 $
    1111 *
    1212 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    249249
    250250    psPolynomial1D **chebPolys = NULL;
    251     psS32 i = 0;
    252     psS32 j = 0;
    253251
    254252    chebPolys = (psPolynomial1D **) psAlloc(maxChebyPoly * sizeof(psPolynomial1D *));
    255     for (i = 0; i < maxChebyPoly; i++) {
     253    for (psS32 i = 0; i < maxChebyPoly; i++) {
    256254        chebPolys[i] = psPolynomial1DAlloc(i + 1, PS_POLYNOMIAL_ORD);
    257255    }
     
    265263        chebPolys[1]->coeff[1] = 1;
    266264    }
    267     for (i = 2; i < maxChebyPoly; i++) {
    268         for (j = 0; j < chebPolys[i - 1]->n; j++) {
     265    for (psS32 i = 2; i < maxChebyPoly; i++) {
     266        for (psS32 j = 0; j < chebPolys[i - 1]->n; j++) {
    269267            chebPolys[i]->coeff[j + 1] = 2 * chebPolys[i - 1]->coeff[j];
    270268        }
    271         for (j = 0; j < chebPolys[i - 2]->n; j++) {
     269        for (psS32 j = 0; j < chebPolys[i - 2]->n; j++) {
    272270            chebPolys[i]->coeff[j] -= chebPolys[i - 2]->coeff[j];
    273271        }
     
    12651263
    12661264    psVector *tmp;
    1267     psVector *myX;
    1268     psVector *myY;
    1269     psS32 i;
    12701265    psS32 vecLen=x->n;
    12711266
    1272     vecLen=x->n;
     1267    // Determine the length of the output vector to by the minimum of the x,y vectors
    12731268    if (y->n < vecLen) {
    12741269        vecLen = y->n;
    12751270    }
    12761271
     1272    // Create output vector to return
    12771273    tmp = psVectorAlloc(vecLen, PS_TYPE_F32);
    1278     for (i=0;i<vecLen;i++) {
    1279         tmp->data.F32[i] = psPolynomial2DEval(myPoly,
    1280                                               myX->data.F32[i],
    1281                                               myY->data.F32[i]);
    1282 
    1283     }
    1284 
    1285     if (x->type.type != PS_TYPE_F32) {
    1286         psFree(myX);
    1287     }
    1288     if (y->type.type != PS_TYPE_F32) {
    1289         psFree(myY);
    1290     }
     1274
     1275    // Evaluate the polynomial at the specified points
     1276    for (psS32 i=0; i<vecLen; i++) {
     1277        tmp->data.F32[i] = psPolynomial2DEval(myPoly,x->data.F32[i],y->data.F32[i]);
     1278    }
     1279
     1280    // Return output vector
    12911281    return(tmp);
    12921282}
     
    16641654
    16651655    psVector *tmp;
    1666     psVector *myX;
    1667     psVector *myY;
    1668     psS32 i;
    16691656    psS32 vecLen=x->n;
    16701657
    1671     vecLen=x->n;
     1658    // Determine the output vector length from minimum length of input vectors
    16721659    if (y->n < vecLen) {
    16731660        vecLen = y->n;
    16741661    }
    16751662
     1663    // Allocate output vector
    16761664    tmp = psVectorAlloc(vecLen, PS_TYPE_F64);
    1677     for (i=0;i<vecLen;i++) {
    1678         tmp->data.F64[i] = psDPolynomial2DEval(myPoly,
    1679                                                myX->data.F64[i],
    1680                                                myY->data.F64[i]);
    1681 
    1682     }
    1683 
    1684     if (x->type.type != PS_TYPE_F64) {
    1685         psFree(myX);
    1686     }
    1687     if (y->type.type != PS_TYPE_F64) {
    1688         psFree(myY);
    1689     }
     1665
     1666    // Evaluate the polynomial
     1667    for (psS32 i = 0; i < vecLen; i++) {
     1668        tmp->data.F64[i] = psDPolynomial2DEval(myPoly,x->data.F64[i],y->data.F64[i]);
     1669    }
     1670
     1671    // Return output vector
    16901672    return(tmp);
    16911673}
Note: See TracChangeset for help on using the changeset viewer.