IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 12, 2004, 10:25:47 AM (22 years ago)
Author:
Paul Price
Message:

Expanded polynomials to four dimensions (both float and double versions)
for use astrometry (where we need to fit x,y,mag,colour).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/archive/pslib/include/psFunctions.h

    r217 r220  
    3131} psPolynomial2D;
    3232
     33/** Three-dimensional polynomial */
     34typedef struct {
     35    int nX, nY, nZ;                     //!< Number of terms in x, y and z
     36    float *restrict *restrict *restrict coeff; //!< Coefficients
     37    float *restrict *restrict *restrict coeffErr; //!< Error in coefficients
     38    char *restrict *restrict *restrict mask; //!< Coefficients mask
     39} psPolynomial3D;
     40
     41/** Four-dimensional polynomial */
     42typedef struct {
     43    int nW, nX, nY, nZ;                 //!< Number of terms in w, x, y and z
     44    float *restrict *restrict *restrict *restrict coeff; //!< Coefficients
     45    float *restrict *restrict *restrict *restrict coeffErr; //!< Error in coefficients
     46    char *restrict *restrict *restrict *restrict mask; //!< Coefficients mask
     47} psPolynomial4D;
     48
     49
     50/** Constructors */
     51psPolynomial1D *psPolynomial1DAlloc(int n //!< Number of terms
     52                                    );
     53psPolynomial2D *psPolynomial2DAlloc(int nX, int nY //!< Number of terms in x and y
     54                                    );
     55psPolynomial3D *psPolynomial3DAlloc(int nX, int nY, int nZ //!< Number of terms in x, y and z
     56                                    );
     57psPolynomial4D *psPolynomial4DAlloc(int nW, int nX, int nY, int nZ //!< Number of terms in w, x, y and z
     58                                    );
     59
     60/** Destructors */
     61void psPolynomial1DFree(psPolynomial1D *restrict myPoly //!< Polynomial to destroy
     62                        );
     63void psPolynomial2DFree(psPolynomial2D *restrict myPoly //!< Polynomial to destroy
     64                        );
     65void psPolynomial3DFree(psPolynomial3D *restrict myPoly //!< Polynomial to destroy
     66                        );
     67void psPolynomial4DFree(psPolynomial4D *restrict myPoly //!< Polynomial to destroy
     68                        );
     69
     70
     71/** Evaluate 1D polynomial */
     72float
     73psEvalPolynomial1D(float x,             //!< Value at which to evaluate
     74                   const psPolynomial1D *restrict myPoly //!< Coefficients for the polynomial
     75                   );
     76
     77/** Evaluate 2D polynomial */
     78float
     79psEvalPolynomial2D(float x,             //!< Value x at which to evaluate
     80                   float y,             //!< Value y at which to evaluate
     81                   const psPolynomial2D *restrict myPoly //!< Coefficients for the polynomial
     82                   );
     83
     84/** Evaluate 3D polynomial */
     85float
     86psEvalPolynomial3D(float x,             //!< Value x at which to evaluate
     87                   float y,             //!< Value y at which to evaluate
     88                   float z,             //!< Value z at which to evaluate
     89                   const psPolynomial3D *restrict myPoly //!< Coefficients for the polynomial
     90                   );
     91
     92/** Evaluate 4D polynomial */
     93float
     94psEvalPolynomial4D(float w,             //!< Value w at which to evaluate
     95                   float x,             //!< Value x at which to evaluate
     96                   float y,             //!< Value y at which to evaluate
     97                   float z,             //!< Value z at which to evaluate
     98                   const psPolynomial4D *restrict myPoly //!< Coefficients for the polynomial
     99                   );
     100
     101/************************************************************************************************************/
     102
     103/* Double-precision polynomials, mainly for use in astrometry */
    33104
    34105/** Double-precision one-dimensional polynomial */
     
    48119} psDPolynomial2D;
    49120
     121/** Double-precision three-dimensional polynomial */
     122typedef struct {
     123    int nX, nY, nZ;                     //!< Number of terms in x, y and z
     124    double *restrict *restrict *restrict coeff; //!< Coefficients
     125    double *restrict *restrict *restrict coeffErr; //!< Error in coefficients
     126    char *restrict *restrict *restrict mask; //!< Coefficient mask
     127} psDPolynomial3D;
     128
     129/** Double-precision four-dimensional polynomial */
     130typedef struct {
     131    int nW, nX, nY, nZ;                 //!< Number of terms in w, x, y and z
     132    double *restrict *restrict *restrict *restrict coeff; //!< Coefficients
     133    double *restrict *restrict *restrict *restrict coeffErr; //!< Error in coefficients
     134    char *restrict *restrict *restrict *restrict mask; //!< Coefficients mask
     135} psDPolynomial4D;
    50136
    51137/** Constructors */
    52 psPolynomial1D *psPolynomial1DAlloc(int n //!< Number of terms
    53                                     );
    54 psPolynomial2D *psPolynomial2DAlloc(int nX, int nY //!< Number of terms in x and y
    55                                     );
    56138psPolynomial1D *psDPolynomial1DAlloc(int n //!< Number of terms
    57139                                     );
    58140psPolynomial2D *psDPolynomial2DAlloc(int nX, int nY //!< Number of terms in x and y
    59141                                     );
     142psPolynomial3D *psDPolynomial3DAlloc(int nX, int nY, int nZ //!< Number of terms in x, y and z
     143                                     );
     144psPolynomial4D *psDPolynomial4DAlloc(int nW, int nX, int nY, int nZ //!< Number of terms in w, x, y and z
     145                                     );
     146
    60147
    61148/** Destructors */
    62 void psPolynomial1DFree(psPolynomial1D *restrict myPoly //!< Polynomial to destroy
    63                         );
    64 void psPolynomial2DFree(psPolynomial2D *restrict myPoly //!< Polynomial to destroy
    65                         );
    66149void psDPolynomial1DFree(psPolynomial1D *restrict myPoly //!< Polynomial to destroy
    67150                         );
    68 void psDPolynomial2DFree(psPolynomial1D *restrict myPoly //!< Polynomial to destroy
     151void psDPolynomial2DFree(psPolynomial2D *restrict myPoly //!< Polynomial to destroy
     152                         );
     153void psDPolynomial3DFree(psPolynomial3D *restrict myPoly //!< Polynomial to destroy
     154                         );
     155void psDPolynomial4DFree(psPolynomial4D *restrict myPoly //!< Polynomial to destroy
    69156                         );
    70157
    71 
    72 /** Evaluate 1D polynomial */
    73 float
    74 psEvalPolynomial1D(float x,             //!< Value at which to evaluate
    75                    const psPolynomial1D *restrict myPoly //!< Coefficients for the polynomial
    76                    );
    77 
    78 /** Evaluate 2D polynomial */
    79 float
    80 psEvalPolynomial2D(float x,             //!< Value x at which to evaluate
    81                    float y,             //!< Value y at which to evaluate
    82                    const psPolynomial2D *restrict myPoly //!< Coefficients for the polynomial
    83                    );
    84158
    85159/** Evaluate 1D polynomial (double precision) */
     
    96170                    );
    97171
     172/** Evaluate 3D polynomial (double precision) */
     173double
     174psEvalDPolynomial3D(double x,           //!< Value x at which to evaluate
     175                    double y,           //!< Value y at which to evaluate
     176                    double z,           //!< Value z at which to evaluate
     177                    const psDPolynomial3D *restrict myPoly //!< Coefficients for the polynomial
     178                    );
     179
     180/** Evaluate 4D polynomial (double precision) */
     181double
     182psEvalDPolynomial4D(double w,           //!< Value w at which to evaluate
     183                    double x,           //!< Value x at which to evaluate
     184                    double y,           //!< Value y at which to evaluate
     185                    double z,           //!< Value z at which to evaluate
     186                    const psDPolynomial4D *restrict myPoly //!< Coefficients for the polynomial
     187                    );
     188
     189
    98190#endif
Note: See TracChangeset for help on using the changeset viewer.