Main Page | Modules | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

psPolynomial.h

Go to the documentation of this file.
00001 /** @file psPolynomial.h
00002  *  @brief Standard Mathematical Functions.
00003  *  @ingroup Stats
00004  *
00005  *  This file will hold the prototypes for procedures which allocate, free,
00006  *  and evaluate various polynomials.  Those polynomial structures are also
00007  *  defined here.
00008  *
00009  *  @ingroup Stats
00010  *
00011  *  @author GLG, MHPCC
00012  *
00013  *  @version $Revision: 1.58 $ $Name: rel8_0 $
00014  *  @date $Date: 2005/10/12 21:02:20 $
00015  *
00016  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
00017  */
00018 
00019 #ifndef PS_POLYNOMIAL_H
00020 #define PS_POLYNOMIAL_H
00021 
00022 #include <stdio.h>
00023 #include <stdbool.h>
00024 #include <float.h>
00025 #include <math.h>
00026 
00027 #include "psVector.h"
00028 #include "psScalar.h"
00029 
00030 /** \addtogroup Stats
00031  *  \{
00032  */
00033 
00034 /** Evaluate a non-normalized Gaussian with the given mean and sigma at the
00035  *  given coordianate.
00036  *
00037  *  Note that this is not a Gaussian deviate.  The evaluated Gaussian is:
00038  *        \f[ exp(-\frac{(x-mean)^2}{2\sigma^2}) \f]
00039  *
00040  *  @return float      value on the gaussian curve given the input parameters
00041  */
00042 float psGaussian(
00043     float x,                           ///< Value at which to evaluate
00044     float mean,                        ///< Mean for the Gaussian
00045     float sigma,                       ///< Standard deviation for the Gaussian
00046     bool normal                        ///< Indicates whether result should be normalized
00047 );
00048 
00049 /** Produce a vector of random numbers from a Gaussian distribution with
00050  *  the specified mean and sigma
00051  *
00052  *  @return psVector*    vector of random numbers
00053  *
00054  */
00055 psVector* p_psGaussianDev(
00056     psF32 mean,                        ///< The mean of the Gaussian
00057     psF32 sigma,                       ///< The sigma of the Gaussian
00058     unsigned int Npts                  ///< The size of the vector
00059 );
00060 
00061 /** Polynomial Type.
00062  *
00063  *  Enumeration for Polynomial types.
00064  */
00065 typedef enum {
00066     PS_POLYNOMIAL_ORD,                  ///< Ordinary Polynomial
00067     PS_POLYNOMIAL_CHEB                  ///< Chebyshev Polynomial
00068 }
00069 psPolynomialType;
00070 
00071 // XXX: These are incorrect names for the order of the polynomial.  We
00072 // keep them here temporarily so we can later sed replace them with the
00073 // correct names.
00074 /** One-dimensional polynomial */
00075 typedef struct
00076 {
00077     psPolynomialType type;              ///< Polynomial type
00078     unsigned int nX;             ///< Polynomial order
00079     psF64 *coeff;                       ///< Coefficients
00080     psF64 *coeffErr;                    ///< Error in coefficients
00081     psMaskType *mask;                   ///< Coefficient mask
00082 }
00083 psPolynomial1D;
00084 
00085 // XXX: These are incorrect names for the order of the polynomial.  We
00086 // keep them here temporarily so we can later sed replace them with the
00087 // correct names.
00088 /** Two-dimensional polynomial */
00089 typedef struct
00090 {
00091     psPolynomialType type;              ///< Polynomial type
00092     unsigned int nX;            ///< Polynomial order in x
00093     unsigned int nY;            ///< Polynomial order in y
00094     psF64 **coeff;                      ///< Coefficients
00095     psF64 **coeffErr;                   ///< Error in coefficients
00096     psMaskType **mask;                  ///< Coefficients mask
00097 }
00098 psPolynomial2D;
00099 
00100 // XXX: These are incorrect names for the order of the polynomial.  We
00101 // keep them here temporarily so we can later sed replace them with the
00102 // correct names.
00103 /** Three-dimensional polynomial */
00104 typedef struct
00105 {
00106     psPolynomialType type;              ///< Polynomial type
00107     unsigned int nX;            ///< Polynomial order in x
00108     unsigned int nY;            ///< Polynomial order in y
00109     unsigned int nZ;            ///< Polynomial order in z
00110     psF64 ***coeff;                     ///< Coefficients
00111     psF64 ***coeffErr;                  ///< Error in coefficients
00112     psMaskType ***mask;                 ///< Coefficients mask
00113 }
00114 psPolynomial3D;
00115 
00116 // XXX: These are incorrect names for the order of the polynomial.  We
00117 // keep them here temporarily so we can later sed replace them with the
00118 // correct names.
00119 /** Four-dimensional polynomial */
00120 typedef struct
00121 {
00122     psPolynomialType type;              ///< Polynomial type
00123     unsigned int nX;            ///< Polynomial order in x
00124     unsigned int nY;            ///< Polynomial order in y
00125     unsigned int nZ;            ///< Polynomial order in z
00126     unsigned int nT;            ///< Polynomial order in t
00127     psF64 ****coeff;                    ///< Coefficients
00128     psF64 ****coeffErr;                 ///< Error in coefficients
00129     psMaskType ****mask;                ///< Coefficients mask
00130 }
00131 psPolynomial4D;
00132 
00133 
00134 /** Allocates a psPolynomial1D structure with n terms
00135  *
00136  *  @return  psPolynomial1D*    new 1-D polynomial struct
00137  */
00138 psPolynomial1D* psPolynomial1DAlloc(
00139     unsigned int n,                    ///< Number of terms
00140     psPolynomialType type              ///< Polynomial Type
00141 );
00142 
00143 /** Allocates a 2-D polynomial structure
00144  *
00145  *  @return  psPolynomial2D*    new 2-D polynomial struct
00146  */
00147 psPolynomial2D* psPolynomial2DAlloc(
00148     unsigned int nX,                   ///< Number of terms in x
00149     unsigned int nY,                   ///< Number of terms in y
00150     psPolynomialType type              ///< Polynomial Type
00151 );
00152 
00153 /** Allocates a 3-D polynomial structure
00154  *
00155  *  @return  psPolynomial3D*    new 3-D polynomial struct
00156  */
00157 psPolynomial3D* psPolynomial3DAlloc(
00158     unsigned int nX,                   ///< Number of terms in x
00159     unsigned int nY,                   ///< Number of terms in y
00160     unsigned int nZ,                   ///< Number of terms in z
00161     psPolynomialType type              ///< Polynomial Type
00162 );
00163 
00164 /** Allocates a 4-D polynomial structure
00165  *
00166  *  @return  psPolynomial4D*    new 4-D polynomial struct
00167  */
00168 psPolynomial4D* psPolynomial4DAlloc(
00169     unsigned int nX,                   ///< Number of terms in x
00170     unsigned int nY,                   ///< Number of terms in y
00171     unsigned int nZ,                   ///< Number of terms in z
00172     unsigned int nT,                   ///< Number of terms in t
00173     psPolynomialType type              ///< Polynomial Type
00174 );
00175 
00176 /** Evaluates a 1-D polynomial at specific coordinates.
00177  *
00178  *  @return psF64    result of polynomial at given location
00179  */
00180 psF64 psPolynomial1DEval(
00181     const psPolynomial1D* poly,        ///< Coefficients for the polynomial
00182     psF64 x                            ///< location at which to evaluate
00183 );
00184 
00185 /** Evaluates a 2-D polynomial at specific coordinates.
00186  *
00187  *  @return psF64    result of polynomial at given location
00188  */
00189 psF64 psPolynomial2DEval(
00190     const psPolynomial2D* poly,        ///< Coefficients for the polynomial
00191     psF64 x,                           ///< x location at which to evaluate
00192     psF64 y                            ///< y location at which to evaluate
00193 );
00194 
00195 /** Evaluates a 3-D polynomial at specific coordinates.
00196  *
00197  *  @return psF64    result of polynomial at given location
00198  */
00199 psF64 psPolynomial3DEval(
00200     const psPolynomial3D* poly,        ///< Coefficients for the polynomial
00201     psF64 x,                           ///< x location at which to evaluate
00202     psF64 y,                           ///< y location at which to evaluate
00203     psF64 z                            ///< z location at which to evaluate
00204 );
00205 
00206 /** Evaluates a 4-D polynomial at specific coordinates.
00207  *
00208  *  @return psF64    result of polynomial at given location
00209  */
00210 psF64 psPolynomial4DEval(
00211     const psPolynomial4D* poly,        ///< Coefficients for the polynomial
00212     psF64 x,                           ///< x location at which to evaluate
00213     psF64 y,                           ///< y location at which to evaluate
00214     psF64 z,                           ///< z location at which to evaluate
00215     psF64 t                            ///< t location at which to evaluate
00216 );
00217 
00218 /** Evaluates a 1-D polynomial at specific sets of coordinates
00219  *
00220  *  @return psVector*    results of polynomials at given locations
00221  */
00222 psVector *psPolynomial1DEvalVector(
00223     const psPolynomial1D *poly,        ///< Coefficients for the polynomial
00224     const psVector *x                  ///< x locations at which to evaluate
00225 );
00226 
00227 /** Evaluates a 2-D polynomial at specific sets of coordinates
00228  *
00229  *  @return psVector*    results of polynomial at given locations
00230  */
00231 psVector *psPolynomial2DEvalVector(
00232     const psPolynomial2D *poly,        ///< Coefficients for the polynomial
00233     const psVector *x,                 ///< x locations at which to evaluate
00234     const psVector *y                  ///< y locations at which to evaluate
00235 );
00236 
00237 /** Evaluates a 3-D polynomial at specific sets of coordinates
00238  *
00239  *  @return psVector*    results of polynomial at given locations
00240  */
00241 psVector *psPolynomial3DEvalVector(
00242     const psPolynomial3D *poly,        ///< Coefficients for the polynomial
00243     const psVector *x,                 ///< x locations at which to evaluate
00244     const psVector *y,                 ///< y locations at which to evaluate
00245     const psVector *z                  ///< z locations at which to evaluate
00246 );
00247 
00248 /** Evaluates a 4-D polynomial at specific sets of coordinates
00249  *
00250  *  @return psVector*    results of polynomial at given locations
00251  */
00252 psVector *psPolynomial4DEvalVector(
00253     const psPolynomial4D *poly,        ///< Coefficients for the polynomial
00254     const psVector *x,                 ///< x locations at which to evaluate
00255     const psVector *y,                 ///< y locations at which to evaluate
00256     const psVector *z,                 ///< z locations at which to evaluate
00257     const psVector *t                  ///< t locations at which to evaluate
00258 );
00259 
00260 /** Checks the type of a particular pointer.
00261  *
00262  *  Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.
00263  *
00264  *  @return bool:       True if the pointer matches a psPolynomial1D structure, false otherwise.
00265  */
00266 bool psMemCheckPolynomial1D(
00267     psPtr ptr                          ///< the pointer whose type to check
00268 );
00269 
00270 /** Checks the type of a particular pointer.
00271  *
00272  *  Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.
00273  *
00274  *  @return bool:       True if the pointer matches a psPolynomial2D structure, false otherwise.
00275  */
00276 bool psMemCheckPolynomial2D(
00277     psPtr ptr                          ///< the pointer whose type to check
00278 );
00279 
00280 /** Checks the type of a particular pointer.
00281  *
00282  *  Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.
00283  *
00284  *  @return bool:       True if the pointer matches a psPolynomial3D structure, false otherwise.
00285  */
00286 bool psMemCheckPolynomial3D(
00287     psPtr ptr                          ///< the pointer whose type to check
00288 );
00289 
00290 /** Checks the type of a particular pointer.
00291  *
00292  *  Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.
00293  *
00294  *  @return bool:       True if the pointer matches a psPolynomial4D structure, false otherwise.
00295  */
00296 bool psMemCheckPolynomial4D(
00297     psPtr ptr                          ///< the pointer whose type to check
00298 );
00299 
00300 /** \} */ // End of MathGroup Functions
00301 
00302 #endif // #ifndef PS_POLYNOMIAL_H
00303 

Generated on Tue Dec 6 17:18:42 2005 for Pan-STARRS Foundation Library by  doxygen 1.4.2