Changeset 3384
- Timestamp:
- Mar 7, 2005, 4:27:47 PM (21 years ago)
- Location:
- trunk/psLib/src
- Files:
-
- 3 edited
-
dataManip/psFunctions.c (modified) (5 diffs)
-
math/psPolynomial.c (modified) (5 diffs)
-
math/psSpline.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/dataManip/psFunctions.c
r3380 r3384 7 7 * polynomials. It also contains a Gaussian functions. 8 8 * 9 * @version $Revision: 1.9 1$ $Name: not supported by cvs2svn $10 * @date $Date: 2005-03-0 7 20:56:13$9 * @version $Revision: 1.92 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2005-03-08 02:27:47 $ 11 11 * 12 12 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 249 249 250 250 psPolynomial1D **chebPolys = NULL; 251 psS32 i = 0;252 psS32 j = 0;253 251 254 252 chebPolys = (psPolynomial1D **) psAlloc(maxChebyPoly * sizeof(psPolynomial1D *)); 255 for ( i = 0; i < maxChebyPoly; i++) {253 for (psS32 i = 0; i < maxChebyPoly; i++) { 256 254 chebPolys[i] = psPolynomial1DAlloc(i + 1, PS_POLYNOMIAL_ORD); 257 255 } … … 265 263 chebPolys[1]->coeff[1] = 1; 266 264 } 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++) { 269 267 chebPolys[i]->coeff[j + 1] = 2 * chebPolys[i - 1]->coeff[j]; 270 268 } 271 for ( j = 0; j < chebPolys[i - 2]->n; j++) {269 for (psS32 j = 0; j < chebPolys[i - 2]->n; j++) { 272 270 chebPolys[i]->coeff[j] -= chebPolys[i - 2]->coeff[j]; 273 271 } … … 1265 1263 1266 1264 psVector *tmp; 1267 psVector *myX;1268 psVector *myY;1269 psS32 i;1270 1265 psS32 vecLen=x->n; 1271 1266 1272 vecLen=x->n;1267 // Determine the length of the output vector to by the minimum of the x,y vectors 1273 1268 if (y->n < vecLen) { 1274 1269 vecLen = y->n; 1275 1270 } 1276 1271 1272 // Create output vector to return 1277 1273 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 1291 1281 return(tmp); 1292 1282 } … … 1664 1654 1665 1655 psVector *tmp; 1666 psVector *myX;1667 psVector *myY;1668 psS32 i;1669 1656 psS32 vecLen=x->n; 1670 1657 1671 vecLen=x->n;1658 // Determine the output vector length from minimum length of input vectors 1672 1659 if (y->n < vecLen) { 1673 1660 vecLen = y->n; 1674 1661 } 1675 1662 1663 // Allocate output vector 1676 1664 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 1690 1672 return(tmp); 1691 1673 } -
trunk/psLib/src/math/psPolynomial.c
r3380 r3384 7 7 * polynomials. It also contains a Gaussian functions. 8 8 * 9 * @version $Revision: 1.9 1$ $Name: not supported by cvs2svn $10 * @date $Date: 2005-03-0 7 20:56:13$9 * @version $Revision: 1.92 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2005-03-08 02:27:47 $ 11 11 * 12 12 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 249 249 250 250 psPolynomial1D **chebPolys = NULL; 251 psS32 i = 0;252 psS32 j = 0;253 251 254 252 chebPolys = (psPolynomial1D **) psAlloc(maxChebyPoly * sizeof(psPolynomial1D *)); 255 for ( i = 0; i < maxChebyPoly; i++) {253 for (psS32 i = 0; i < maxChebyPoly; i++) { 256 254 chebPolys[i] = psPolynomial1DAlloc(i + 1, PS_POLYNOMIAL_ORD); 257 255 } … … 265 263 chebPolys[1]->coeff[1] = 1; 266 264 } 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++) { 269 267 chebPolys[i]->coeff[j + 1] = 2 * chebPolys[i - 1]->coeff[j]; 270 268 } 271 for ( j = 0; j < chebPolys[i - 2]->n; j++) {269 for (psS32 j = 0; j < chebPolys[i - 2]->n; j++) { 272 270 chebPolys[i]->coeff[j] -= chebPolys[i - 2]->coeff[j]; 273 271 } … … 1265 1263 1266 1264 psVector *tmp; 1267 psVector *myX;1268 psVector *myY;1269 psS32 i;1270 1265 psS32 vecLen=x->n; 1271 1266 1272 vecLen=x->n;1267 // Determine the length of the output vector to by the minimum of the x,y vectors 1273 1268 if (y->n < vecLen) { 1274 1269 vecLen = y->n; 1275 1270 } 1276 1271 1272 // Create output vector to return 1277 1273 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 1291 1281 return(tmp); 1292 1282 } … … 1664 1654 1665 1655 psVector *tmp; 1666 psVector *myX;1667 psVector *myY;1668 psS32 i;1669 1656 psS32 vecLen=x->n; 1670 1657 1671 vecLen=x->n;1658 // Determine the output vector length from minimum length of input vectors 1672 1659 if (y->n < vecLen) { 1673 1660 vecLen = y->n; 1674 1661 } 1675 1662 1663 // Allocate output vector 1676 1664 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 1690 1672 return(tmp); 1691 1673 } -
trunk/psLib/src/math/psSpline.c
r3380 r3384 7 7 * polynomials. It also contains a Gaussian functions. 8 8 * 9 * @version $Revision: 1.9 1$ $Name: not supported by cvs2svn $10 * @date $Date: 2005-03-0 7 20:56:13$9 * @version $Revision: 1.92 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2005-03-08 02:27:47 $ 11 11 * 12 12 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 249 249 250 250 psPolynomial1D **chebPolys = NULL; 251 psS32 i = 0;252 psS32 j = 0;253 251 254 252 chebPolys = (psPolynomial1D **) psAlloc(maxChebyPoly * sizeof(psPolynomial1D *)); 255 for ( i = 0; i < maxChebyPoly; i++) {253 for (psS32 i = 0; i < maxChebyPoly; i++) { 256 254 chebPolys[i] = psPolynomial1DAlloc(i + 1, PS_POLYNOMIAL_ORD); 257 255 } … … 265 263 chebPolys[1]->coeff[1] = 1; 266 264 } 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++) { 269 267 chebPolys[i]->coeff[j + 1] = 2 * chebPolys[i - 1]->coeff[j]; 270 268 } 271 for ( j = 0; j < chebPolys[i - 2]->n; j++) {269 for (psS32 j = 0; j < chebPolys[i - 2]->n; j++) { 272 270 chebPolys[i]->coeff[j] -= chebPolys[i - 2]->coeff[j]; 273 271 } … … 1265 1263 1266 1264 psVector *tmp; 1267 psVector *myX;1268 psVector *myY;1269 psS32 i;1270 1265 psS32 vecLen=x->n; 1271 1266 1272 vecLen=x->n;1267 // Determine the length of the output vector to by the minimum of the x,y vectors 1273 1268 if (y->n < vecLen) { 1274 1269 vecLen = y->n; 1275 1270 } 1276 1271 1272 // Create output vector to return 1277 1273 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 1291 1281 return(tmp); 1292 1282 } … … 1664 1654 1665 1655 psVector *tmp; 1666 psVector *myX;1667 psVector *myY;1668 psS32 i;1669 1656 psS32 vecLen=x->n; 1670 1657 1671 vecLen=x->n;1658 // Determine the output vector length from minimum length of input vectors 1672 1659 if (y->n < vecLen) { 1673 1660 vecLen = y->n; 1674 1661 } 1675 1662 1663 // Allocate output vector 1676 1664 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 1690 1672 return(tmp); 1691 1673 }
Note:
See TracChangeset
for help on using the changeset viewer.
