IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 27, 2005, 2:53:54 PM (21 years ago)
Author:
drobbin
Message:

psPolynomial fxns revised per apidelta-report-cycle6

File:
1 edited

Legend:

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

    r4330 r4405  
    1212 *  @author GLG, MHPCC
    1313 *
    14  *  @version $Revision: 1.48 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2005-06-21 03:01:37 $
     14 *  @version $Revision: 1.49 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2005-06-28 00:53:53 $
    1616 *
    1717 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    6767    PS_POLYNOMIAL_ORD,                 ///< Ordinary Polynomial
    6868    PS_POLYNOMIAL_CHEB                 ///< Chebyshev Polynomial
    69 } psPolynomialType;
     69}
     70psPolynomialType;
    7071
    7172/** One-dimensional polynomial */
     
    7374{
    7475    psPolynomialType type;             ///< Polynomial type
    75     psS32 n;                             ///< Number of terms
     76    psS32 n;                           ///< Number of terms
    7677    psF32 *coeff;                      ///< Coefficients
    7778    psF32 *coeffErr;                   ///< Error in coefficients
     
    8485{
    8586    psPolynomialType type;             ///< Polynomial type
    86     psS32 nX;                            ///< Number of terms in x
    87     psS32 nY;                            ///< Number of terms in y
     87    psS32 nX;                          ///< Number of terms in x
     88    psS32 nY;                          ///< Number of terms in y
    8889    psF32 **coeff;                     ///< Coefficients
    8990    psF32 **coeffErr;                  ///< Error in coefficients
     
    9697{
    9798    psPolynomialType type;             ///< Polynomial type
    98     psS32 nX;                            ///< Number of terms in x
    99     psS32 nY;                            ///< Number of terms in y
    100     psS32 nZ;                            ///< Number of terms in z
     99    psS32 nX;                          ///< Number of terms in x
     100    psS32 nY;                          ///< Number of terms in y
     101    psS32 nZ;                          ///< Number of terms in z
    101102    psF32 ***coeff;                    ///< Coefficients
    102103    psF32 ***coeffErr;                 ///< Error in coefficients
     
    109110{
    110111    psPolynomialType type;             ///< Polynomial type
    111     psS32 nW;                            ///< Number of terms in w
    112     psS32 nX;                            ///< Number of terms in x
    113     psS32 nY;                            ///< Number of terms in y
    114     psS32 nZ;                            ///< Number of terms in z
     112    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
    115116    psF32 ****coeff;                   ///< Coefficients
    116117    psF32 ****coeffErr;                ///< Error in coefficients
     
    125126 */
    126127psPolynomial1D* psPolynomial1DAlloc(
    127     psS32 n,                            ///< Number of terms
     128    psS32 n,                           ///< Number of terms
    128129    psPolynomialType type              ///< Polynomial Type
    129130);
     
    134135 */
    135136psPolynomial2D* psPolynomial2DAlloc(
    136     psS32 nX,                           ///< Number of terms in x
    137     psS32 nY,                           ///< Number of terms in y
     137    psS32 nX,                          ///< Number of terms in x
     138    psS32 nY,                          ///< Number of terms in y
    138139    psPolynomialType type              ///< Polynomial Type
    139140);
     
    144145 */
    145146psPolynomial3D* psPolynomial3DAlloc(
    146     psS32 nX,                           ///< Number of terms in x
    147     psS32 nY,                           ///< Number of terms in y
    148     psS32 nZ,                           ///< Number of terms in z
     147    psS32 nX,                          ///< Number of terms in x
     148    psS32 nY,                          ///< Number of terms in y
     149    psS32 nZ,                          ///< Number of terms in z
    149150    psPolynomialType type              ///< Polynomial Type
    150151);
     
    155156 */
    156157psPolynomial4D* psPolynomial4DAlloc(
    157     psS32 nW,                           ///< Number of terms in w
    158     psS32 nX,                           ///< Number of terms in x
    159     psS32 nY,                           ///< Number of terms in y
    160     psS32 nZ,                           ///< Number of terms in z
     158    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
    161162    psPolynomialType type              ///< Polynomial Type
    162163);
     
    164165/** Evaluates a 1-D polynomial at specific coordinates.
    165166 *
    166  *  @return psF32    result of polynomial at given location
    167  */
    168 psF32 psPolynomial1DEval(
    169     const psPolynomial1D* myPoly,      ///< Coefficients for the polynomial
    170     psF32 x                            ///< location at which to evaluate
     167 *  @return psF64    result of polynomial at given location
     168 */
     169psF64 psPolynomial1DEval(
     170    const psPolynomial1D* poly,        ///< Coefficients for the polynomial
     171    psF64 x                            ///< location at which to evaluate
    171172);
    172173
    173174/** Evaluates a 2-D polynomial at specific coordinates.
    174175 *
    175  *  @return psF32    result of polynomial at given location
    176  */
    177 psF32 psPolynomial2DEval(
    178     const psPolynomial2D* myPoly,      ///< Coefficients for the polynomial
    179     psF32 x,                            ///< x location at which to evaluate
    180     psF32 y                             ///< y location at which to evaluate
     176 *  @return psF64    result of polynomial at given location
     177 */
     178psF64 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
    181182);
    182183
    183184/** Evaluates a 3-D polynomial at specific coordinates.
    184185 *
    185  *  @return psF32    result of polynomial at given location
    186  */
    187 psF32 psPolynomial3DEval(
    188     const psPolynomial3D* myPoly,      ///< Coefficients for the polynomial
    189     psF32 x,                            ///< x location at which to evaluate
    190     psF32 y,                            ///< y location at which to evaluate
    191     psF32 z                             ///< z location at which to evaluate
     186 *  @return psF64    result of polynomial at given location
     187 */
     188psF64 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
    192193);
    193194
    194195/** Evaluates a 4-D polynomial at specific coordinates.
    195196 *
    196  *  @return psF32    result of polynomial at given location
    197  */
    198 psF32 psPolynomial4DEval(
    199     const psPolynomial4D* myPoly,      ///< Coefficients for the polynomial
    200     psF32 w,                            ///< w location at which to evaluate
    201     psF32 x,                            ///< x location at which to evaluate
    202     psF32 y,                            ///< y location at which to evaluate
    203     psF32 z                             ///< z location at which to evaluate
     197 *  @return psF64    result of polynomial at given location
     198 */
     199psF64 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
    204205);
    205206
     
    209210 */
    210211psVector *psPolynomial1DEvalVector(
    211     const psPolynomial1D *myPoly,      ///< Coefficients for the polynomial
    212     const psVector *x                   ///< x locations at which to evaluate
     212    const psPolynomial1D *poly,        ///< Coefficients for the polynomial
     213    const psVector *x                  ///< x locations at which to evaluate
    213214);
    214215
     
    218219 */
    219220psVector *psPolynomial2DEvalVector(
    220     const psPolynomial2D *poly,         ///< Coefficients for the polynomial
    221     const psVector *x,                  ///< x locations at which to evaluate
    222     const psVector *y                   ///< y locations at which to evaluate
     221    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
    223224);
    224225
     
    228229 */
    229230psVector *psPolynomial3DEvalVector(
    230     const psPolynomial3D *myPoly,      ///< Coefficients for the polynomial
    231     const psVector *x,                  ///< x locations at which to evaluate
    232     const psVector *y,                  ///< y locations at which to evaluate
    233     const psVector *z                   ///< z locations at which to evaluate
     231    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
    234235);
    235236
     
    239240 */
    240241psVector *psPolynomial4DEvalVector(
    241     const psPolynomial4D *myPoly,      ///< Coefficients for the polynomial
    242     const psVector *w,                  ///< w locations at which to evaluate
    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
     242    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
    246247);
    247248
     
    254255{
    255256    psPolynomialType type;             ///< Polynomial type
    256     psS32 n;                            ///< Number of terms
     257    psS32 n;                           ///< Number of terms
    257258    psF64 *coeff;                      ///< Coefficients
    258259    psF64 *coeffErr;                   ///< Error in coefficients
     
    265266{
    266267    psPolynomialType type;             ///< Polynomial type
    267     psS32 nX;                           ///< Number of terms in x
    268     psS32 nY;                           ///< Number of terms in y
     268    psS32 nX;                          ///< Number of terms in x
     269    psS32 nY;                          ///< Number of terms in y
    269270    psF64 **coeff;                     ///< Coefficients
    270271    psF64 **coeffErr;                  ///< Error in coefficients
     
    277278{
    278279    psPolynomialType type;             ///< Polynomial type
    279     psS32 nX;                           ///< Number of terms in x
    280     psS32 nY;                           ///< Number of terms in y
    281     psS32 nZ;                           ///< Number of terms in z
     280    psS32 nX;                          ///< Number of terms in x
     281    psS32 nY;                          ///< Number of terms in y
     282    psS32 nZ;                          ///< Number of terms in z
    282283    psF64 ***coeff;                    ///< Coefficients
    283284    psF64 ***coeffErr;                 ///< Error in coefficients
     
    290291{
    291292    psPolynomialType type;             ///< Polynomial type
    292     psS32 nW;                           ///< Number of terms in w
    293     psS32 nX;                           ///< Number of terms in x
    294     psS32 nY;                           ///< Number of terms in y
    295     psS32 nZ;                           ///< Number of terms in z
     293    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
    296297    psF64 ****coeff;                   ///< Coefficients
    297298    psF64 ****coeffErr;                ///< Error in coefficients
     
    305306 */
    306307psDPolynomial1D* psDPolynomial1DAlloc(
    307     psS32 n,                              ///< Number of terms
    308     psPolynomialType type                ///< Polynomial Type
     308    psS32 n,                           ///< Number of terms
     309    psPolynomialType type              ///< Polynomial Type
    309310);
    310311
     
    314315 */
    315316psDPolynomial2D* psDPolynomial2DAlloc(
    316     psS32 nX,                           ///< Number of terms in x
    317     psS32 nY,                           ///< Number of terms in y
     317    psS32 nX,                          ///< Number of terms in x
     318    psS32 nY,                          ///< Number of terms in y
    318319    psPolynomialType type              ///< Polynomial Type
    319320);
     
    324325 */
    325326psDPolynomial3D* psDPolynomial3DAlloc(
    326     psS32 nX,                           ///< Number of terms in x
    327     psS32 nY,                           ///< Number of terms in y
    328     psS32 nZ,                           ///< Number of terms in z
     327    psS32 nX,                          ///< Number of terms in x
     328    psS32 nY,                          ///< Number of terms in y
     329    psS32 nZ,                          ///< Number of terms in z
    329330    psPolynomialType type              ///< Polynomial Type
    330331);
     
    335336 */
    336337psDPolynomial4D* psDPolynomial4DAlloc(
    337     psS32 nW,                           ///< Number of terms in w
    338     psS32 nX,                           ///< Number of terms in x
    339     psS32 nY,                           ///< Number of terms in y
    340     psS32 nZ,                           ///< Number of terms in z
     338    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
    341342    psPolynomialType type              ///< Polynomial Type
    342343);
     
    348349psF64 psDPolynomial1DEval(
    349350    const psDPolynomial1D* myPoly,     ///< Coefficients for the polynomial
    350     psF64 x                             ///< Value at which to evaluate
     351    psF64 x                            ///< Value at which to evaluate
    351352);
    352353
     
    357358psF64 psDPolynomial2DEval(
    358359    const psDPolynomial2D* myPoly,      ///< Coefficients for the polynomial
    359     psF64 x,                             ///< Value x at which to evaluate
    360     psF64 y                              ///< Value y at which to evaluate
     360    psF64 x,                            ///< Value x at which to evaluate
     361    psF64 y                             ///< Value y at which to evaluate
    361362);
    362363
    363364/** Evaluates a double-precision 3-D polynomial at specific coordinates.
    364365 *
    365  *  @return psF32    result of polynomial at given location
     366 *  @return psF64    result of polynomial at given location
    366367 */
    367368psF64 psDPolynomial3DEval(
    368369    const psDPolynomial3D* myPoly,     ///< Coefficients for the polynomial
    369     psF64 x,                            ///< Value x at which to evaluate
    370     psF64 y,                            ///< Value y at which to evaluate
    371     psF64 z                             ///< Value z at which to evaluate
     370    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
    372373);
    373374
    374375/** Evaluates a double-precision 4-D polynomial at specific coordinates.
    375376 *
    376  *  @return psF32    result of polynomial at given location
     377 *  @return psF64    result of polynomial at given location
    377378 */
    378379psF64 psDPolynomial4DEval(
    379380    const psDPolynomial4D* myPoly,     ///< Coefficients for the polynomial
    380     psF64 w,                            ///< Value w at which to evaluate
    381     psF64 x,                            ///< Value x at which to evaluate
    382     psF64 y,                            ///< Value y at which to evaluate
    383     psF64 z                             ///< Value z at which to evaluate
     381    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
    384385);
    385386
     
    390391psVector *psDPolynomial1DEvalVector(
    391392    const psDPolynomial1D *myPoly,     ///< Coefficients for the polynomial
    392     const psVector *x                   ///< x locations at which to evaluate
     393    const psVector *x                  ///< x locations at which to evaluate
    393394);
    394395
     
    399400psVector *psDPolynomial2DEvalVector(
    400401    const psDPolynomial2D *myPoly,     ///< Coefficients for the polynomial
    401     const psVector *x,                  ///< x locations at which to evaluate
    402     const psVector *y                   ///< y locations at which to evaluate
     402    const psVector *x,                 ///< x locations at which to evaluate
     403    const psVector *y                  ///< y locations at which to evaluate
    403404);
    404405
     
    409410psVector *psDPolynomial3DEvalVector(
    410411    const psDPolynomial3D *myPoly,     ///< Coefficients for the polynomial
    411     const psVector *x,                  ///< x locations at which to evaluate
    412     const psVector *y,                  ///< y locations at which to evaluate
    413     const psVector *z                   ///< z locations at which to evaluate
     412    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
    414415);
    415416
     
    420421psVector *psDPolynomial4DEvalVector(
    421422    const psDPolynomial4D *myPoly,     ///< Coefficients for the polynomial
    422     const psVector *w,                  ///< w locations at which to evaluate
    423     const psVector *x,                  ///< x locations at which to evaluate
    424     const psVector *y,                  ///< y locations at which to evaluate
    425     const psVector *z                   ///< z locations at which to evaluate
     423    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
    426427);
    427428
     
    429430typedef struct
    430431{
    431     psS32 n;                            ///< The number of spline polynomials
     432    psS32 n;                           ///< The number of spline polynomials
    432433    psPolynomial1D **spline;           ///< An array of n pointers to the spline polynomials
    433434    psF32 *p_psDeriv2;                 ///< For cubic splines, the second derivative at each domain point.  Size is n+1.
     
    444445 *  @return psSpline1D*    new 1-D spline struct
    445446 */
    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
     447psSpline1D *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);
    450453
    451454/** Allocates a psSpline1D structure
     
    455458 *  @return psSpline1D*    new 1-D spline struct
    456459 */
    457 psSpline1D *psSpline1DAllocGeneric(const psVector *bounds,   ///< Bounds for spline polynomials
    458                                    int order);               ///< Order of spline polynomials
     460psSpline1D *psSpline1DAllocGeneric(
     461    const psVector *bounds,            ///< Bounds for spline polynomials
     462    int order                          ///< Order of spline polynomials
     463);
    459464
    460465/** Evaluates 1-D spline polynomials at a specific coordinate.
     
    481486 *  @return psS32    corresponding index number of specified value
    482487 */
    483 psS32 p_psVectorBinDisect(psVector *bins,        ///< Array of non-decreasing values
    484                           psScalar *x);          ///< Target value to find
     488psS32 p_psVectorBinDisect(
     489    psVector *bins,                    ///< Array of non-decreasing values
     490    psScalar *x                        ///< Target value to find
     491);
    485492
    486493/** Interpolates a series of data points for evaluation at a specific coordinate.  Uses a
     
    489496 *  @return psScalar*    Lagrange interpolation value at given location
    490497 */
    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
     498psScalar *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);
    495504
    496505#if 0
Note: See TracChangeset for help on using the changeset viewer.