Changeset 4405 for trunk/psLib/src/math/psPolynomial.h
- Timestamp:
- Jun 27, 2005, 2:53:54 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/math/psPolynomial.h (modified) (34 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/math/psPolynomial.h
r4330 r4405 12 12 * @author GLG, MHPCC 13 13 * 14 * @version $Revision: 1.4 8$ $Name: not supported by cvs2svn $15 * @date $Date: 2005-06-2 1 03:01:37$14 * @version $Revision: 1.49 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2005-06-28 00:53:53 $ 16 16 * 17 17 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 67 67 PS_POLYNOMIAL_ORD, ///< Ordinary Polynomial 68 68 PS_POLYNOMIAL_CHEB ///< Chebyshev Polynomial 69 } psPolynomialType; 69 } 70 psPolynomialType; 70 71 71 72 /** One-dimensional polynomial */ … … 73 74 { 74 75 psPolynomialType type; ///< Polynomial type 75 psS32 n; ///< Number of terms76 psS32 n; ///< Number of terms 76 77 psF32 *coeff; ///< Coefficients 77 78 psF32 *coeffErr; ///< Error in coefficients … … 84 85 { 85 86 psPolynomialType type; ///< Polynomial type 86 psS32 nX; ///< Number of terms in x87 psS32 nY; ///< Number of terms in y87 psS32 nX; ///< Number of terms in x 88 psS32 nY; ///< Number of terms in y 88 89 psF32 **coeff; ///< Coefficients 89 90 psF32 **coeffErr; ///< Error in coefficients … … 96 97 { 97 98 psPolynomialType type; ///< Polynomial type 98 psS32 nX; ///< Number of terms in x99 psS32 nY; ///< Number of terms in y100 psS32 nZ; ///< Number of terms in z99 psS32 nX; ///< Number of terms in x 100 psS32 nY; ///< Number of terms in y 101 psS32 nZ; ///< Number of terms in z 101 102 psF32 ***coeff; ///< Coefficients 102 103 psF32 ***coeffErr; ///< Error in coefficients … … 109 110 { 110 111 psPolynomialType type; ///< Polynomial type 111 psS32 nW; ///< Number of terms in w112 psS32 nX; ///< Number of terms in x113 psS32 nY; ///< Number of terms in y114 psS32 nZ; ///< Number of terms in z112 psS32 nW; ///< Number of terms in w 113 psS32 nX; ///< Number of terms in x 114 psS32 nY; ///< Number of terms in y 115 psS32 nZ; ///< Number of terms in z 115 116 psF32 ****coeff; ///< Coefficients 116 117 psF32 ****coeffErr; ///< Error in coefficients … … 125 126 */ 126 127 psPolynomial1D* psPolynomial1DAlloc( 127 psS32 n, ///< Number of terms128 psS32 n, ///< Number of terms 128 129 psPolynomialType type ///< Polynomial Type 129 130 ); … … 134 135 */ 135 136 psPolynomial2D* psPolynomial2DAlloc( 136 psS32 nX, ///< Number of terms in x137 psS32 nY, ///< Number of terms in y137 psS32 nX, ///< Number of terms in x 138 psS32 nY, ///< Number of terms in y 138 139 psPolynomialType type ///< Polynomial Type 139 140 ); … … 144 145 */ 145 146 psPolynomial3D* psPolynomial3DAlloc( 146 psS32 nX, ///< Number of terms in x147 psS32 nY, ///< Number of terms in y148 psS32 nZ, ///< Number of terms in z147 psS32 nX, ///< Number of terms in x 148 psS32 nY, ///< Number of terms in y 149 psS32 nZ, ///< Number of terms in z 149 150 psPolynomialType type ///< Polynomial Type 150 151 ); … … 155 156 */ 156 157 psPolynomial4D* psPolynomial4DAlloc( 157 psS32 nW, ///< Number of terms in w158 psS32 nX, ///< Number of terms in x159 psS32 nY, ///< Number of terms in y160 psS32 nZ, ///< Number of terms in z158 psS32 nW, ///< Number of terms in w 159 psS32 nX, ///< Number of terms in x 160 psS32 nY, ///< Number of terms in y 161 psS32 nZ, ///< Number of terms in z 161 162 psPolynomialType type ///< Polynomial Type 162 163 ); … … 164 165 /** Evaluates a 1-D polynomial at specific coordinates. 165 166 * 166 * @return psF 32result of polynomial at given location167 */ 168 psF 32psPolynomial1DEval(169 const psPolynomial1D* myPoly,///< Coefficients for the polynomial170 psF 32x ///< location at which to evaluate167 * @return psF64 result of polynomial at given location 168 */ 169 psF64 psPolynomial1DEval( 170 const psPolynomial1D* poly, ///< Coefficients for the polynomial 171 psF64 x ///< location at which to evaluate 171 172 ); 172 173 173 174 /** Evaluates a 2-D polynomial at specific coordinates. 174 175 * 175 * @return psF 32result of polynomial at given location176 */ 177 psF 32psPolynomial2DEval(178 const psPolynomial2D* myPoly,///< Coefficients for the polynomial179 psF 32x, ///< x location at which to evaluate180 psF 32y ///< y location at which to evaluate176 * @return psF64 result of polynomial at given location 177 */ 178 psF64 psPolynomial2DEval( 179 const psPolynomial2D* poly, ///< Coefficients for the polynomial 180 psF64 x, ///< x location at which to evaluate 181 psF64 y ///< y location at which to evaluate 181 182 ); 182 183 183 184 /** Evaluates a 3-D polynomial at specific coordinates. 184 185 * 185 * @return psF 32result of polynomial at given location186 */ 187 psF 32psPolynomial3DEval(188 const psPolynomial3D* myPoly,///< Coefficients for the polynomial189 psF 32 x,///< x location at which to evaluate190 psF 32 y,///< y location at which to evaluate191 psF 32 z///< z location at which to evaluate186 * @return psF64 result of polynomial at given location 187 */ 188 psF64 psPolynomial3DEval( 189 const psPolynomial3D* poly, ///< Coefficients for the polynomial 190 psF64 x, ///< x location at which to evaluate 191 psF64 y, ///< y location at which to evaluate 192 psF64 z ///< z location at which to evaluate 192 193 ); 193 194 194 195 /** Evaluates a 4-D polynomial at specific coordinates. 195 196 * 196 * @return psF 32result of polynomial at given location197 */ 198 psF 32psPolynomial4DEval(199 const psPolynomial4D* myPoly,///< Coefficients for the polynomial200 psF 32 w, ///< wlocation at which to evaluate201 psF 32 x, ///< xlocation at which to evaluate202 psF 32 y, ///< ylocation at which to evaluate203 psF 32 z ///< zlocation at which to evaluate197 * @return psF64 result of polynomial at given location 198 */ 199 psF64 psPolynomial4DEval( 200 const psPolynomial4D* poly, ///< Coefficients for the polynomial 201 psF64 x, ///< x location at which to evaluate 202 psF64 y, ///< y location at which to evaluate 203 psF64 z, ///< z location at which to evaluate 204 psF64 t ///< t location at which to evaluate 204 205 ); 205 206 … … 209 210 */ 210 211 psVector *psPolynomial1DEvalVector( 211 const psPolynomial1D * myPoly,///< Coefficients for the polynomial212 const psVector *x ///< x locations at which to evaluate212 const psPolynomial1D *poly, ///< Coefficients for the polynomial 213 const psVector *x ///< x locations at which to evaluate 213 214 ); 214 215 … … 218 219 */ 219 220 psVector *psPolynomial2DEvalVector( 220 const psPolynomial2D *poly, ///< Coefficients for the polynomial221 const psVector *x, ///< x locations at which to evaluate222 const psVector *y ///< y locations at which to evaluate221 const psPolynomial2D *poly, ///< Coefficients for the polynomial 222 const psVector *x, ///< x locations at which to evaluate 223 const psVector *y ///< y locations at which to evaluate 223 224 ); 224 225 … … 228 229 */ 229 230 psVector *psPolynomial3DEvalVector( 230 const psPolynomial3D * myPoly,///< Coefficients for the polynomial231 const psVector *x, ///< x locations at which to evaluate232 const psVector *y, ///< y locations at which to evaluate233 const psVector *z ///< z locations at which to evaluate231 const psPolynomial3D *poly, ///< Coefficients for the polynomial 232 const psVector *x, ///< x locations at which to evaluate 233 const psVector *y, ///< y locations at which to evaluate 234 const psVector *z ///< z locations at which to evaluate 234 235 ); 235 236 … … 239 240 */ 240 241 psVector *psPolynomial4DEvalVector( 241 const psPolynomial4D * myPoly,///< Coefficients for the polynomial242 const psVector * w, ///< wlocations at which to evaluate243 const psVector * x, ///< xlocations at which to evaluate244 const psVector * y, ///< ylocations at which to evaluate245 const psVector * z ///< zlocations at which to evaluate242 const psPolynomial4D *poly, ///< Coefficients for the polynomial 243 const psVector *x, ///< x locations at which to evaluate 244 const psVector *y, ///< y locations at which to evaluate 245 const psVector *z, ///< z locations at which to evaluate 246 const psVector *t ///< t locations at which to evaluate 246 247 ); 247 248 … … 254 255 { 255 256 psPolynomialType type; ///< Polynomial type 256 psS32 n; ///< Number of terms257 psS32 n; ///< Number of terms 257 258 psF64 *coeff; ///< Coefficients 258 259 psF64 *coeffErr; ///< Error in coefficients … … 265 266 { 266 267 psPolynomialType type; ///< Polynomial type 267 psS32 nX; ///< Number of terms in x268 psS32 nY; ///< Number of terms in y268 psS32 nX; ///< Number of terms in x 269 psS32 nY; ///< Number of terms in y 269 270 psF64 **coeff; ///< Coefficients 270 271 psF64 **coeffErr; ///< Error in coefficients … … 277 278 { 278 279 psPolynomialType type; ///< Polynomial type 279 psS32 nX; ///< Number of terms in x280 psS32 nY; ///< Number of terms in y281 psS32 nZ; ///< Number of terms in z280 psS32 nX; ///< Number of terms in x 281 psS32 nY; ///< Number of terms in y 282 psS32 nZ; ///< Number of terms in z 282 283 psF64 ***coeff; ///< Coefficients 283 284 psF64 ***coeffErr; ///< Error in coefficients … … 290 291 { 291 292 psPolynomialType type; ///< Polynomial type 292 psS32 nW; ///< Number of terms in w293 psS32 nX; ///< Number of terms in x294 psS32 nY; ///< Number of terms in y295 psS32 nZ; ///< Number of terms in z293 psS32 nW; ///< Number of terms in w 294 psS32 nX; ///< Number of terms in x 295 psS32 nY; ///< Number of terms in y 296 psS32 nZ; ///< Number of terms in z 296 297 psF64 ****coeff; ///< Coefficients 297 298 psF64 ****coeffErr; ///< Error in coefficients … … 305 306 */ 306 307 psDPolynomial1D* psDPolynomial1DAlloc( 307 psS32 n, ///< Number of terms308 psPolynomialType type ///< Polynomial Type308 psS32 n, ///< Number of terms 309 psPolynomialType type ///< Polynomial Type 309 310 ); 310 311 … … 314 315 */ 315 316 psDPolynomial2D* psDPolynomial2DAlloc( 316 psS32 nX, ///< Number of terms in x317 psS32 nY, ///< Number of terms in y317 psS32 nX, ///< Number of terms in x 318 psS32 nY, ///< Number of terms in y 318 319 psPolynomialType type ///< Polynomial Type 319 320 ); … … 324 325 */ 325 326 psDPolynomial3D* psDPolynomial3DAlloc( 326 psS32 nX, ///< Number of terms in x327 psS32 nY, ///< Number of terms in y328 psS32 nZ, ///< Number of terms in z327 psS32 nX, ///< Number of terms in x 328 psS32 nY, ///< Number of terms in y 329 psS32 nZ, ///< Number of terms in z 329 330 psPolynomialType type ///< Polynomial Type 330 331 ); … … 335 336 */ 336 337 psDPolynomial4D* psDPolynomial4DAlloc( 337 psS32 nW, ///< Number of terms in w338 psS32 nX, ///< Number of terms in x339 psS32 nY, ///< Number of terms in y340 psS32 nZ, ///< Number of terms in z338 psS32 nW, ///< Number of terms in w 339 psS32 nX, ///< Number of terms in x 340 psS32 nY, ///< Number of terms in y 341 psS32 nZ, ///< Number of terms in z 341 342 psPolynomialType type ///< Polynomial Type 342 343 ); … … 348 349 psF64 psDPolynomial1DEval( 349 350 const psDPolynomial1D* myPoly, ///< Coefficients for the polynomial 350 psF64 x ///< Value at which to evaluate351 psF64 x ///< Value at which to evaluate 351 352 ); 352 353 … … 357 358 psF64 psDPolynomial2DEval( 358 359 const psDPolynomial2D* myPoly, ///< Coefficients for the polynomial 359 psF64 x, ///< Value x at which to evaluate360 psF64 y ///< Value y at which to evaluate360 psF64 x, ///< Value x at which to evaluate 361 psF64 y ///< Value y at which to evaluate 361 362 ); 362 363 363 364 /** Evaluates a double-precision 3-D polynomial at specific coordinates. 364 365 * 365 * @return psF 32result of polynomial at given location366 * @return psF64 result of polynomial at given location 366 367 */ 367 368 psF64 psDPolynomial3DEval( 368 369 const psDPolynomial3D* myPoly, ///< Coefficients for the polynomial 369 psF64 x, ///< Value x at which to evaluate370 psF64 y, ///< Value y at which to evaluate371 psF64 z ///< Value z at which to evaluate370 psF64 x, ///< Value x at which to evaluate 371 psF64 y, ///< Value y at which to evaluate 372 psF64 z ///< Value z at which to evaluate 372 373 ); 373 374 374 375 /** Evaluates a double-precision 4-D polynomial at specific coordinates. 375 376 * 376 * @return psF 32result of polynomial at given location377 * @return psF64 result of polynomial at given location 377 378 */ 378 379 psF64 psDPolynomial4DEval( 379 380 const psDPolynomial4D* myPoly, ///< Coefficients for the polynomial 380 psF64 w, ///< Value w at which to evaluate381 psF64 x, ///< Value x at which to evaluate382 psF64 y, ///< Value y at which to evaluate383 psF64 z ///< Value z at which to evaluate381 psF64 w, ///< Value w at which to evaluate 382 psF64 x, ///< Value x at which to evaluate 383 psF64 y, ///< Value y at which to evaluate 384 psF64 z ///< Value z at which to evaluate 384 385 ); 385 386 … … 390 391 psVector *psDPolynomial1DEvalVector( 391 392 const psDPolynomial1D *myPoly, ///< Coefficients for the polynomial 392 const psVector *x ///< x locations at which to evaluate393 const psVector *x ///< x locations at which to evaluate 393 394 ); 394 395 … … 399 400 psVector *psDPolynomial2DEvalVector( 400 401 const psDPolynomial2D *myPoly, ///< Coefficients for the polynomial 401 const psVector *x, ///< x locations at which to evaluate402 const psVector *y ///< y locations at which to evaluate402 const psVector *x, ///< x locations at which to evaluate 403 const psVector *y ///< y locations at which to evaluate 403 404 ); 404 405 … … 409 410 psVector *psDPolynomial3DEvalVector( 410 411 const psDPolynomial3D *myPoly, ///< Coefficients for the polynomial 411 const psVector *x, ///< x locations at which to evaluate412 const psVector *y, ///< y locations at which to evaluate413 const psVector *z ///< z locations at which to evaluate412 const psVector *x, ///< x locations at which to evaluate 413 const psVector *y, ///< y locations at which to evaluate 414 const psVector *z ///< z locations at which to evaluate 414 415 ); 415 416 … … 420 421 psVector *psDPolynomial4DEvalVector( 421 422 const psDPolynomial4D *myPoly, ///< Coefficients for the polynomial 422 const psVector *w, ///< w locations at which to evaluate423 const psVector *x, ///< x locations at which to evaluate424 const psVector *y, ///< y locations at which to evaluate425 const psVector *z ///< z locations at which to evaluate423 const psVector *w, ///< w locations at which to evaluate 424 const psVector *x, ///< x locations at which to evaluate 425 const psVector *y, ///< y locations at which to evaluate 426 const psVector *z ///< z locations at which to evaluate 426 427 ); 427 428 … … 429 430 typedef struct 430 431 { 431 psS32 n; ///< The number of spline polynomials432 psS32 n; ///< The number of spline polynomials 432 433 psPolynomial1D **spline; ///< An array of n pointers to the spline polynomials 433 434 psF32 *p_psDeriv2; ///< For cubic splines, the second derivative at each domain point. Size is n+1. … … 444 445 * @return psSpline1D* new 1-D spline struct 445 446 */ 446 psSpline1D *psSpline1DAlloc(int n, ///< Number of spline polynomials 447 int order, ///< Order of spline polynomials 448 float min, ///< Lower boundary value of spline polynomials 449 float max); ///< Upper boundary value of spline polynomials 447 psSpline1D *psSpline1DAlloc( 448 int n, ///< Number of spline polynomials 449 int order, ///< Order of spline polynomials 450 float min, ///< Lower boundary value of spline polynomials 451 float max ///< Upper boundary value of spline polynomials 452 ); 450 453 451 454 /** Allocates a psSpline1D structure … … 455 458 * @return psSpline1D* new 1-D spline struct 456 459 */ 457 psSpline1D *psSpline1DAllocGeneric(const psVector *bounds, ///< Bounds for spline polynomials 458 int order); ///< Order of spline polynomials 460 psSpline1D *psSpline1DAllocGeneric( 461 const psVector *bounds, ///< Bounds for spline polynomials 462 int order ///< Order of spline polynomials 463 ); 459 464 460 465 /** Evaluates 1-D spline polynomials at a specific coordinate. … … 481 486 * @return psS32 corresponding index number of specified value 482 487 */ 483 psS32 p_psVectorBinDisect(psVector *bins, ///< Array of non-decreasing values 484 psScalar *x); ///< Target value to find 488 psS32 p_psVectorBinDisect( 489 psVector *bins, ///< Array of non-decreasing values 490 psScalar *x ///< Target value to find 491 ); 485 492 486 493 /** Interpolates a series of data points for evaluation at a specific coordinate. Uses a … … 489 496 * @return psScalar* Lagrange interpolation value at given location 490 497 */ 491 psScalar *p_psVectorInterpolate(psVector *domain, ///< Domain (x coords) for interpolation 492 psVector *range, ///< Range (y coords) for interpolation 493 psS32 order, ///< Order of interpolation function 494 psScalar *x); ///< Location at which to evaluate 498 psScalar *p_psVectorInterpolate( 499 psVector *domain, ///< Domain (x coords) for interpolation 500 psVector *range, ///< Range (y coords) for interpolation 501 psS32 order, ///< Order of interpolation function 502 psScalar *x ///< Location at which to evaluate 503 ); 495 504 496 505 #if 0
Note:
See TracChangeset
for help on using the changeset viewer.
