IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 9, 2005, 3:11:12 PM (21 years ago)
Author:
evanalst
Message:

Fix psPolynomialXDEvalVector functions.

File:
1 edited

Legend:

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

    r3384 r3397  
    77 *  polynomials.  It also contains a Gaussian functions.
    88 *
    9  *  @version $Revision: 1.92 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2005-03-08 02:27:47 $
     9 *  @version $Revision: 1.93 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2005-03-10 01:11:12 $
    1111 *
    1212 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    13131313
    13141314    psVector *tmp;
    1315     psVector *myX;
    1316     psVector *myY;
    1317     psVector *myZ;
    1318     psS32 i;
    13191315    psS32 vecLen=x->n;
    13201316
    1321     vecLen=x->n;
     1317    // Determine the length of output vector from min of the input vectors
    13221318    if (y->n < vecLen) {
    13231319        vecLen = y->n;
     
    13271323    }
    13281324
     1325    // Allocate output vector
    13291326    tmp = psVectorAlloc(vecLen, PS_TYPE_F32);
    1330     for (i=0;i<vecLen;i++) {
     1327
     1328    // Evaluate polynomial
     1329    for (psS32 i = 0; i < vecLen; i++) {
    13311330        tmp->data.F32[i] = psPolynomial3DEval(myPoly,
    1332                                               myX->data.F32[i],
    1333                                               myY->data.F32[i],
    1334                                               myZ->data.F32[i]);
    1335 
    1336     }
    1337 
    1338     if (x->type.type != PS_TYPE_F32) {
    1339         psFree(myX);
    1340     }
    1341     if (y->type.type != PS_TYPE_F32) {
    1342         psFree(myY);
    1343     }
    1344     if (z->type.type != PS_TYPE_F32) {
    1345         psFree(myZ);
    1346     }
     1331                                              x->data.F32[i],
     1332                                              y->data.F32[i],
     1333                                              z->data.F32[i]);
     1334    }
     1335
     1336    // Return output vector
    13471337    return(tmp);
    13481338}
     
    13811371
    13821372    psVector *tmp;
    1383     psVector *myW;
    1384     psVector *myX;
    1385     psVector *myY;
    1386     psVector *myZ;
    1387     psS32 i;
    1388     psS32 vecLen=x->n;
    1389 
    1390     vecLen=w->n;
     1373    psS32 vecLen=w->n;
     1374
     1375    // Determine output vector size from min of input vectors
    13911376    if (y->n < vecLen) {
    13921377        vecLen = y->n;
     
    13991384    }
    14001385
     1386    // Allocate output vector
    14011387    tmp = psVectorAlloc(vecLen, PS_TYPE_F32);
    1402     for (i=0;i<vecLen;i++) {
     1388
     1389    // Evaluate polynomial
     1390    for (psS32 i = 0; i < vecLen; i++) {
    14031391        tmp->data.F32[i] = psPolynomial4DEval(myPoly,
    1404                                               myW->data.F32[i],
    1405                                               myX->data.F32[i],
    1406                                               myY->data.F32[i],
    1407                                               myZ->data.F32[i]);
    1408 
    1409     }
    1410 
    1411     if (w->type.type != PS_TYPE_F32) {
    1412         psFree(myW);
    1413     }
    1414     if (x->type.type != PS_TYPE_F32) {
    1415         psFree(myX);
    1416     }
    1417     if (y->type.type != PS_TYPE_F32) {
    1418         psFree(myY);
    1419     }
    1420     if (z->type.type != PS_TYPE_F32) {
    1421         psFree(myZ);
    1422     }
     1392                                              w->data.F32[i],
     1393                                              x->data.F32[i],
     1394                                              y->data.F32[i],
     1395                                              z->data.F32[i]);
     1396    }
     1397
     1398    // Return output vector
    14231399    return(tmp);
    14241400}
     
    17081684
    17091685    psVector *tmp;
    1710     psVector *myX;
    1711     psVector *myY;
    1712     psVector *myZ;
    1713     psS32 i;
    17141686    psS32 vecLen=x->n;
    17151687
    1716     vecLen=x->n;
     1688    // Determine the size of output vector from min of input vectors
    17171689    if (y->n < vecLen) {
    17181690        vecLen = y->n;
     
    17221694    }
    17231695
     1696    // Allocate output vector
    17241697    tmp = psVectorAlloc(vecLen, PS_TYPE_F64);
    1725     for (i=0;i<vecLen;i++) {
     1698
     1699    // Evaluate polynomial
     1700    for (psS32 i = 0; i < vecLen; i++) {
    17261701        tmp->data.F64[i] = psDPolynomial3DEval(myPoly,
    1727                                                myX->data.F64[i],
    1728                                                myY->data.F64[i],
    1729                                                myZ->data.F64[i]);
    1730 
    1731     }
    1732 
    1733     if (x->type.type != PS_TYPE_F64) {
    1734         psFree(myX);
    1735     }
    1736     if (y->type.type != PS_TYPE_F64) {
    1737         psFree(myY);
    1738     }
    1739     if (z->type.type != PS_TYPE_F64) {
    1740         psFree(myZ);
    1741     }
     1702                                               x->data.F64[i],
     1703                                               y->data.F64[i],
     1704                                               z->data.F64[i]);
     1705    }
     1706
     1707    // Return output vector
    17421708    return(tmp);
    17431709}
Note: See TracChangeset for help on using the changeset viewer.