Changeset 1784
- Timestamp:
- Sep 10, 2004, 1:20:41 PM (22 years ago)
- Location:
- trunk/psLib
- Files:
-
- 4 edited
-
src/dataManip/psFunctions.c (modified) (14 diffs)
-
src/math/psPolynomial.c (modified) (14 diffs)
-
src/math/psSpline.c (modified) (14 diffs)
-
test/dataManip/tst_psFunc00.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/dataManip/psFunctions.c
r1781 r1784 7 7 * polynomials. It also contains a Gaussian functions. 8 8 * 9 * @version $Revision: 1.3 4$ $Name: not supported by cvs2svn $10 * @date $Date: 2004-09-10 2 2:25:59 $9 * @version $Revision: 1.35 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2004-09-10 23:20:29 $ 11 11 * 12 12 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 560 560 int loop_x = 0; 561 561 int loop_y = 0; 562 int i = 0; 562 563 float polySum = 0.0; 563 564 psPolynomial1D* *chebPolys = NULL; … … 581 582 } 582 583 } 583 584 for (i=0;i<maxChebyPoly;i++) { 585 psFree(chebPolys[i]); 586 } 584 587 psFree(chebPolys); 585 588 return(polySum); … … 667 670 int loop_y = 0; 668 671 int loop_z = 0; 672 int i = 0; 669 673 float polySum = 0.0; 670 674 psPolynomial1D* *chebPolys = NULL; … … 695 699 } 696 700 701 for (i=0;i<maxChebyPoly;i++) { 702 psFree(chebPolys[i]); 703 } 697 704 psFree(chebPolys); 698 705 return(polySum); … … 799 806 int loop_y = 0; 800 807 int loop_z = 0; 808 int i = 0; 801 809 float polySum = 0.0; 802 810 psPolynomial1D* *chebPolys = NULL; … … 833 841 } 834 842 843 for (i=0;i<maxChebyPoly;i++) { 844 psFree(chebPolys[i]); 845 } 835 846 psFree(chebPolys); 836 847 return(polySum); … … 1235 1246 int loop_x = 0; 1236 1247 int loop_y = 0; 1248 int i = 0; 1237 1249 double polySum = 0.0; 1238 1250 psPolynomial1D* *chebPolys = NULL; … … 1257 1269 } 1258 1270 1271 for (i=0;i<maxChebyPoly;i++) { 1272 psFree(chebPolys[i]); 1273 } 1259 1274 psFree(chebPolys); 1260 1275 return(polySum); … … 1341 1356 int loop_y = 0; 1342 1357 int loop_z = 0; 1358 int i = 0; 1343 1359 double polySum = 0.0; 1344 1360 psPolynomial1D* *chebPolys = NULL; … … 1369 1385 } 1370 1386 1387 for (i=0;i<maxChebyPoly;i++) { 1388 psFree(chebPolys[i]); 1389 } 1371 1390 psFree(chebPolys); 1372 1391 return(polySum); … … 1475 1494 int loop_y = 0; 1476 1495 int loop_z = 0; 1496 int i = 0; 1477 1497 double polySum = 0.0; 1478 1498 psPolynomial1D* *chebPolys = NULL; … … 1509 1529 } 1510 1530 1531 for (i=0;i<maxChebyPoly;i++) { 1532 psFree(chebPolys[i]); 1533 } 1511 1534 psFree(chebPolys); 1512 1535 return(polySum); … … 1750 1773 1751 1774 1775 1776 /***************************************************************************** 1777 psSpline1DGen(): This routine will take an existing spline data structure, 1778 along with a set of data values for each of the domains, and fit splines of 1779 the specified order (currently, linear only), and set the coefficients in the 1780 appropriate spline polynomials. This function is not part of the API in the 1781 latest SDR, but I'm guessing it will be, and I need it to generate test 1782 cases, so I included it here. 1783 *****************************************************************************/ 1752 1784 1753 1785 psSpline1D *psSpline1DGen(const psSpline1D *spline, -
trunk/psLib/src/math/psPolynomial.c
r1781 r1784 7 7 * polynomials. It also contains a Gaussian functions. 8 8 * 9 * @version $Revision: 1.3 4$ $Name: not supported by cvs2svn $10 * @date $Date: 2004-09-10 2 2:25:59 $9 * @version $Revision: 1.35 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2004-09-10 23:20:29 $ 11 11 * 12 12 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 560 560 int loop_x = 0; 561 561 int loop_y = 0; 562 int i = 0; 562 563 float polySum = 0.0; 563 564 psPolynomial1D* *chebPolys = NULL; … … 581 582 } 582 583 } 583 584 for (i=0;i<maxChebyPoly;i++) { 585 psFree(chebPolys[i]); 586 } 584 587 psFree(chebPolys); 585 588 return(polySum); … … 667 670 int loop_y = 0; 668 671 int loop_z = 0; 672 int i = 0; 669 673 float polySum = 0.0; 670 674 psPolynomial1D* *chebPolys = NULL; … … 695 699 } 696 700 701 for (i=0;i<maxChebyPoly;i++) { 702 psFree(chebPolys[i]); 703 } 697 704 psFree(chebPolys); 698 705 return(polySum); … … 799 806 int loop_y = 0; 800 807 int loop_z = 0; 808 int i = 0; 801 809 float polySum = 0.0; 802 810 psPolynomial1D* *chebPolys = NULL; … … 833 841 } 834 842 843 for (i=0;i<maxChebyPoly;i++) { 844 psFree(chebPolys[i]); 845 } 835 846 psFree(chebPolys); 836 847 return(polySum); … … 1235 1246 int loop_x = 0; 1236 1247 int loop_y = 0; 1248 int i = 0; 1237 1249 double polySum = 0.0; 1238 1250 psPolynomial1D* *chebPolys = NULL; … … 1257 1269 } 1258 1270 1271 for (i=0;i<maxChebyPoly;i++) { 1272 psFree(chebPolys[i]); 1273 } 1259 1274 psFree(chebPolys); 1260 1275 return(polySum); … … 1341 1356 int loop_y = 0; 1342 1357 int loop_z = 0; 1358 int i = 0; 1343 1359 double polySum = 0.0; 1344 1360 psPolynomial1D* *chebPolys = NULL; … … 1369 1385 } 1370 1386 1387 for (i=0;i<maxChebyPoly;i++) { 1388 psFree(chebPolys[i]); 1389 } 1371 1390 psFree(chebPolys); 1372 1391 return(polySum); … … 1475 1494 int loop_y = 0; 1476 1495 int loop_z = 0; 1496 int i = 0; 1477 1497 double polySum = 0.0; 1478 1498 psPolynomial1D* *chebPolys = NULL; … … 1509 1529 } 1510 1530 1531 for (i=0;i<maxChebyPoly;i++) { 1532 psFree(chebPolys[i]); 1533 } 1511 1534 psFree(chebPolys); 1512 1535 return(polySum); … … 1750 1773 1751 1774 1775 1776 /***************************************************************************** 1777 psSpline1DGen(): This routine will take an existing spline data structure, 1778 along with a set of data values for each of the domains, and fit splines of 1779 the specified order (currently, linear only), and set the coefficients in the 1780 appropriate spline polynomials. This function is not part of the API in the 1781 latest SDR, but I'm guessing it will be, and I need it to generate test 1782 cases, so I included it here. 1783 *****************************************************************************/ 1752 1784 1753 1785 psSpline1D *psSpline1DGen(const psSpline1D *spline, -
trunk/psLib/src/math/psSpline.c
r1781 r1784 7 7 * polynomials. It also contains a Gaussian functions. 8 8 * 9 * @version $Revision: 1.3 4$ $Name: not supported by cvs2svn $10 * @date $Date: 2004-09-10 2 2:25:59 $9 * @version $Revision: 1.35 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2004-09-10 23:20:29 $ 11 11 * 12 12 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 560 560 int loop_x = 0; 561 561 int loop_y = 0; 562 int i = 0; 562 563 float polySum = 0.0; 563 564 psPolynomial1D* *chebPolys = NULL; … … 581 582 } 582 583 } 583 584 for (i=0;i<maxChebyPoly;i++) { 585 psFree(chebPolys[i]); 586 } 584 587 psFree(chebPolys); 585 588 return(polySum); … … 667 670 int loop_y = 0; 668 671 int loop_z = 0; 672 int i = 0; 669 673 float polySum = 0.0; 670 674 psPolynomial1D* *chebPolys = NULL; … … 695 699 } 696 700 701 for (i=0;i<maxChebyPoly;i++) { 702 psFree(chebPolys[i]); 703 } 697 704 psFree(chebPolys); 698 705 return(polySum); … … 799 806 int loop_y = 0; 800 807 int loop_z = 0; 808 int i = 0; 801 809 float polySum = 0.0; 802 810 psPolynomial1D* *chebPolys = NULL; … … 833 841 } 834 842 843 for (i=0;i<maxChebyPoly;i++) { 844 psFree(chebPolys[i]); 845 } 835 846 psFree(chebPolys); 836 847 return(polySum); … … 1235 1246 int loop_x = 0; 1236 1247 int loop_y = 0; 1248 int i = 0; 1237 1249 double polySum = 0.0; 1238 1250 psPolynomial1D* *chebPolys = NULL; … … 1257 1269 } 1258 1270 1271 for (i=0;i<maxChebyPoly;i++) { 1272 psFree(chebPolys[i]); 1273 } 1259 1274 psFree(chebPolys); 1260 1275 return(polySum); … … 1341 1356 int loop_y = 0; 1342 1357 int loop_z = 0; 1358 int i = 0; 1343 1359 double polySum = 0.0; 1344 1360 psPolynomial1D* *chebPolys = NULL; … … 1369 1385 } 1370 1386 1387 for (i=0;i<maxChebyPoly;i++) { 1388 psFree(chebPolys[i]); 1389 } 1371 1390 psFree(chebPolys); 1372 1391 return(polySum); … … 1475 1494 int loop_y = 0; 1476 1495 int loop_z = 0; 1496 int i = 0; 1477 1497 double polySum = 0.0; 1478 1498 psPolynomial1D* *chebPolys = NULL; … … 1509 1529 } 1510 1530 1531 for (i=0;i<maxChebyPoly;i++) { 1532 psFree(chebPolys[i]); 1533 } 1511 1534 psFree(chebPolys); 1512 1535 return(polySum); … … 1750 1773 1751 1774 1775 1776 /***************************************************************************** 1777 psSpline1DGen(): This routine will take an existing spline data structure, 1778 along with a set of data values for each of the domains, and fit splines of 1779 the specified order (currently, linear only), and set the coefficients in the 1780 appropriate spline polynomials. This function is not part of the API in the 1781 latest SDR, but I'm guessing it will be, and I need it to generate test 1782 cases, so I included it here. 1783 *****************************************************************************/ 1752 1784 1753 1785 psSpline1D *psSpline1DGen(const psSpline1D *spline, -
trunk/psLib/test/dataManip/tst_psFunc00.c
r1722 r1784 279 279 testStatus); 280 280 281 282 283 /*************************************************************************/ 284 /* Allocate and initialize data structures */ 285 /*************************************************************************/ 286 printPositiveTestHeader(stdout, 287 "psFunctions functions", 288 "Allocate/Deallocate the psPolynomial1D structure (CHEBYSHEV)."); 289 290 my1DPoly = psPolynomial1DAlloc(AN, PS_POLYNOMIAL_CHEB); 291 for (a = 0; a < AN ; a++) { 292 my1DPoly->coeff[a] = MISC_FLOAT_NUMBER; 293 my1DPoly->coeffErr[a] = MISC_FLOAT_NUMBER; 294 my1DPoly->mask[a] = MISC_INT_NUMBER; 295 } 296 psMemCheckCorruption(1); 297 298 printf("At (x) = (%f): %f\n", MISC_X_VALUE, 299 psPolynomial1DEval(MISC_X_VALUE, my1DPoly)); 300 301 psFree(my1DPoly); 302 memLeaks = psMemCheckLeaks(currentId,NULL,NULL); 303 if (0 != memLeaks) { 304 psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks); 305 } 306 printFooter(stdout, 307 "psStats functions", 308 "Allocate/Deallocate the psPolynomial1D structure (CHEBYSHEV).", 309 testStatus); 310 311 312 313 314 printPositiveTestHeader(stdout, 315 "psFunctions functions", 316 "Allocate/Deallocate the psPolynomial2D structure (CHEBYSHEV)."); 317 my2DPoly = psPolynomial2DAlloc(AN, BN, PS_POLYNOMIAL_CHEB); 318 for (a = 0; a < AN ; a++) { 319 for (b = 0; b < BN ; b++) { 320 my2DPoly->coeff[a][b] = MISC_FLOAT_NUMBER; 321 my2DPoly->coeffErr[a][b] = MISC_FLOAT_NUMBER; 322 my2DPoly->mask[a][b] = MISC_INT_NUMBER; 323 } 324 } 325 psMemCheckCorruption(1); 326 327 printf("At (x, y) = (%f, %f): %f\n", MISC_X_VALUE, MISC_X_VALUE, 328 psPolynomial2DEval(MISC_X_VALUE, MISC_X_VALUE, my2DPoly)); 329 330 psFree(my2DPoly); 331 memLeaks = psMemCheckLeaks(currentId,NULL,NULL); 332 if (0 != memLeaks) { 333 psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks); 334 } 335 printFooter(stdout, 336 "psStats functions", 337 "Allocate/Deallocate the psPolynomial2D structure (CHEBYSHEV).", 338 testStatus); 339 340 341 342 printPositiveTestHeader(stdout, 343 "psFunctions functions", 344 "Allocate/Deallocate the psPolynomial3D structure (CHEBYSHEV)."); 345 my3DPoly = psPolynomial3DAlloc(AN, BN, CN, PS_POLYNOMIAL_CHEB); 346 for (a = 0; a < AN ; a++) { 347 for (b = 0; b < BN ; b++) { 348 for (c = 0; c < CN ; c++) { 349 my3DPoly->coeff[a][b][c] = MISC_FLOAT_NUMBER; 350 my3DPoly->coeffErr[a][b][c] = MISC_FLOAT_NUMBER; 351 my3DPoly->mask[a][b][c] = MISC_INT_NUMBER; 352 } 353 } 354 } 355 psMemCheckCorruption(1); 356 357 printf("At (x, y, z) = (%f, %f, %f): %f\n", MISC_X_VALUE, MISC_X_VALUE, 358 MISC_X_VALUE, 359 psPolynomial3DEval(MISC_X_VALUE, MISC_X_VALUE, MISC_X_VALUE, my3DPoly)); 360 361 psFree(my3DPoly); 362 memLeaks = psMemCheckLeaks(currentId,NULL,NULL); 363 if (0 != memLeaks) { 364 psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks); 365 } 366 printFooter(stdout, 367 "psStats functions", 368 "Allocate/Deallocate the psPolynomial3D structure (CHEBYSHEV).", 369 testStatus); 370 371 372 373 374 printPositiveTestHeader(stdout, 375 "psFunctions functions", 376 "Allocate/Deallocate the psPolynomial4D structure (CHEBYSHEV)."); 377 my4DPoly = psPolynomial4DAlloc(AN, BN, CN, DN, PS_POLYNOMIAL_CHEB); 378 for (a = 0; a < AN ; a++) { 379 for (b = 0; b < BN ; b++) { 380 for (c = 0; c < CN ; c++) { 381 for (d = 0; d < DN ; d++) { 382 my4DPoly->coeff[a][b][c][d] = MISC_FLOAT_NUMBER; 383 my4DPoly->coeffErr[a][b][c][d] = MISC_FLOAT_NUMBER; 384 my4DPoly->mask[a][b][c][d] = MISC_INT_NUMBER; 385 } 386 } 387 } 388 } 389 psMemCheckCorruption(1); 390 391 printf("At (w, x, y, z) = (%f, %f, %f, %f): %f\n", MISC_X_VALUE, MISC_X_VALUE, 392 MISC_X_VALUE, MISC_X_VALUE, 393 psPolynomial4DEval(MISC_X_VALUE, MISC_X_VALUE, MISC_X_VALUE, MISC_X_VALUE, my4DPoly)); 394 395 psFree(my4DPoly); 396 memLeaks = psMemCheckLeaks(currentId,NULL,NULL); 397 if (0 != memLeaks) { 398 psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks); 399 } 400 printFooter(stdout, 401 "psStats functions", 402 "Allocate/Deallocate the psPolynomial4D structure (CHEBYSHEV).", 403 testStatus); 404 405 406 407 /*************************************************************************/ 408 /* Allocate and initialize data structures */ 409 /*************************************************************************/ 410 printPositiveTestHeader(stdout, 411 "psFunctions functions", 412 "Allocate/Deallocate the psDPolynomial1D structure (CHEBYSHEV)."); 413 414 my1DPolyD = psDPolynomial1DAlloc(AN, PS_POLYNOMIAL_CHEB); 415 for (a = 0; a < AN ; a++) { 416 my1DPolyD->coeff[a] = MISC_FLOAT_NUMBER; 417 my1DPolyD->coeffErr[a] = MISC_FLOAT_NUMBER; 418 my1DPolyD->mask[a] = MISC_INT_NUMBER; 419 } 420 psMemCheckCorruption(1); 421 422 printf("At (x) = (%f): %f\n", MISC_X_VALUE, 423 psDPolynomial1DEval(MISC_X_VALUE, my1DPolyD)); 424 425 psFree(my1DPolyD); 426 memLeaks = psMemCheckLeaks(currentId,NULL,NULL); 427 if (0 != memLeaks) { 428 psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks); 429 } 430 printFooter(stdout, 431 "psStats functions", 432 "Allocate/Deallocate the psDPolynomial1D structure (CHEBYSHEV).", 433 testStatus); 434 435 printPositiveTestHeader(stdout, 436 "psFunctions functions", 437 "Allocate/Deallocate the psDPolynomial2D structure (CHEBYSHEV)."); 438 my2DPolyD = psDPolynomial2DAlloc(AN, BN, PS_POLYNOMIAL_CHEB); 439 for (a = 0; a < AN ; a++) { 440 for (b = 0; b < BN ; b++) { 441 my2DPolyD->coeff[a][b] = MISC_FLOAT_NUMBER; 442 my2DPolyD->coeffErr[a][b] = MISC_FLOAT_NUMBER; 443 my2DPolyD->mask[a][b] = MISC_INT_NUMBER; 444 } 445 } 446 psMemCheckCorruption(1); 447 448 printf("At (x, y) = (%f, %f): %f\n", MISC_X_VALUE, MISC_X_VALUE, 449 psDPolynomial2DEval(MISC_X_VALUE, MISC_X_VALUE, my2DPolyD)); 450 451 psFree(my2DPolyD); 452 memLeaks = psMemCheckLeaks(currentId,NULL,NULL); 453 if (0 != memLeaks) { 454 psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks); 455 } 456 printFooter(stdout, 457 "psStats functions", 458 "Allocate/Deallocate the psDPolynomial2D structure (CHEBYSHEV).", 459 testStatus); 460 461 462 463 printPositiveTestHeader(stdout, 464 "psFunctions functions", 465 "Allocate/Deallocate the psDPolynomial3D structure (CHEBYSHEV)."); 466 my3DPolyD = psDPolynomial3DAlloc(AN, BN, CN, PS_POLYNOMIAL_CHEB); 467 for (a = 0; a < AN ; a++) { 468 for (b = 0; b < BN ; b++) { 469 for (c = 0; c < CN ; c++) { 470 my3DPolyD->coeff[a][b][c] = MISC_FLOAT_NUMBER; 471 my3DPolyD->coeffErr[a][b][c] = MISC_FLOAT_NUMBER; 472 my3DPolyD->mask[a][b][c] = MISC_INT_NUMBER; 473 } 474 } 475 } 476 psMemCheckCorruption(1); 477 478 printf("At (x, y, z) = (%f, %f, %f): %f\n", MISC_X_VALUE, MISC_X_VALUE, 479 MISC_X_VALUE, 480 psDPolynomial3DEval(MISC_X_VALUE, MISC_X_VALUE, MISC_X_VALUE, my3DPolyD)); 481 482 psFree(my3DPolyD); 483 memLeaks = psMemCheckLeaks(currentId,NULL,NULL); 484 if (0 != memLeaks) { 485 psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks); 486 } 487 printFooter(stdout, 488 "psStats functions", 489 "Allocate/Deallocate the psDPolynomial3D structure (CHEBYSHEV).", 490 testStatus); 491 492 493 494 495 printPositiveTestHeader(stdout, 496 "psFunctions functions", 497 "Allocate/Deallocate the psDPolynomial4D structure (CHEBYSHEV)."); 498 my4DPolyD = psDPolynomial4DAlloc(AN, BN, CN, DN, PS_POLYNOMIAL_CHEB); 499 for (a = 0; a < AN ; a++) { 500 for (b = 0; b < BN ; b++) { 501 for (c = 0; c < CN ; c++) { 502 for (d = 0; d < DN ; d++) { 503 my4DPolyD->coeff[a][b][c][d] = MISC_FLOAT_NUMBER; 504 my4DPolyD->coeffErr[a][b][c][d] = MISC_FLOAT_NUMBER; 505 my4DPolyD->mask[a][b][c][d] = MISC_INT_NUMBER; 506 } 507 } 508 } 509 } 510 psMemCheckCorruption(1); 511 512 printf("At (w, x, y, z) = (%f, %f, %f, %f): %f\n", MISC_X_VALUE, MISC_X_VALUE, 513 MISC_X_VALUE, MISC_X_VALUE, 514 psDPolynomial4DEval(MISC_X_VALUE, MISC_X_VALUE, MISC_X_VALUE, MISC_X_VALUE, my4DPolyD)); 515 516 psFree(my4DPolyD); 517 memLeaks = psMemCheckLeaks(currentId,NULL,NULL); 518 if (0 != memLeaks) { 519 psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks); 520 } 521 printFooter(stdout, 522 "psStats functions", 523 "Allocate/Deallocate the psDPolynomial4D structure (CHEBYSHEV).", 524 testStatus); 525 281 526 return (!testStatus); 282 527 }
Note:
See TracChangeset
for help on using the changeset viewer.
