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

psSpline.h

Go to the documentation of this file.
00001 /** @file psSpline.h
00002  *  @brief Standard Mathematical Functions.
00003  *  @ingroup GROUP00
00004  *
00005  *  This file will hold the prototypes for procedures which allocate, free,
00006  *  and evaluate splines.
00007  *
00008  *  @ingroup GROUP00
00009  *
00010  *  @author GLG, MHPCC
00011  *
00012  *  @version $Revision: 1.1.1.1 $ $Name:  $
00013  *  @date $Date: 2005/10/14 00:32:52 $
00014  *
00015  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
00016  */
00017 
00018 #ifndef PS_SPLINE_H
00019 #define PS_SPLINE_H
00020 
00021 #include <stdio.h>
00022 #include <stdbool.h>
00023 #include <float.h>
00024 #include <math.h>
00025 
00026 #include "psVector.h"
00027 #include "psScalar.h"
00028 #include "psPolynomial.h"
00029 
00030 /** \addtogroup GROUP00
00031  *  \{
00032  */
00033 
00034 /** One-Dimensional Spline */
00035 typedef struct
00036 {
00037     unsigned int n;                    ///< The number of spline pieces
00038     psPolynomial1D **spline;           ///< An array of n pointers to the spline polynomials
00039     psVector *knots;                   ///< The boundaries between each spline piece.  Size is n+1.
00040     psF32 *p_psDeriv2;                 ///< For cubic splines, the second derivative at each domain point.  Size is n+1.
00041 }
00042 psSpline1D;
00043 
00044 /** Allocates a psSpline1D structure
00045  *
00046  *  Allocator for psSpline1D.
00047  *
00048  *  @return psSpline1D*    new 1-D spline struct
00049  */
00050 psSpline1D *psSpline1DAlloc();
00051 
00052 /** Evaluates 1-D spline polynomials at a specific coordinate.
00053  *
00054  *  @return float    result of spline polynomials evaluated at given location
00055  */
00056 float psSpline1DEval(
00057     const psSpline1D *spline,          ///< Coefficients for spline polynomials
00058     float x                            ///< location at which to evaluate
00059 );
00060 
00061 /** Evaluates 1-D spline polynomials at a set of specific coordinates.
00062  *
00063  *  @return psVector*    results of spline polynomials evaluated at given locations
00064  */
00065 psVector *psSpline1DEvalVector(
00066     const psSpline1D *spline,          ///< Coefficients of spline polynomials
00067     const psVector *x                  ///< locations at which to evaluate
00068 );
00069 
00070 /** Derive a one-dimensional spline fit.
00071  *
00072  *  Given a psSpline1D data structure and a set of x,y vectors, this routine
00073  *  generates the linear splines which satisfy those data points.
00074  *
00075  *  @return psSpline1D*:  the calculated one-dimensional splines
00076  */
00077 psSpline1D *psVectorFitSpline1D(
00078     const psVector* x,                 ///< Ordinates (or NULL to just use the indices)
00079     const psVector* y                  ///< Coordinates
00080 );
00081 
00082 /** Checks the type of a particular pointer.
00083  *
00084  *  Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.
00085  *
00086  *  @return bool:       True if the pointer matches a psSpline1D structure, false otherwise.
00087  */
00088 bool psMemCheckSpline1D(
00089     psPtr ptr                          ///< the pointer whose type to check
00090 );
00091 
00092 /** Performs a binary disection on a given vector.
00093  *  Searches through an array of data for a specified value.
00094  *
00095  *  @return psS32    corresponding index number of specified value
00096  */
00097 psS32 p_psVectorBinDisect(
00098     psVector *bins,                    ///< Array of non-decreasing values
00099     psScalar *x                        ///< Target value to find
00100 );
00101 
00102 /** Interpolates a series of data points for evaluation at a specific coordinate.  Uses a
00103  *  Lagrange interpolation method.
00104  *
00105  *  @return psScalar*    Lagrange interpolation value at given location
00106  */
00107 psScalar *p_psVectorInterpolate(
00108     psVector *domain,                  ///< Domain (x coords) for interpolation
00109     psVector *range,                   ///< Range (y coords) for interpolation
00110     psS32 order,                       ///< Order of interpolation function
00111     psScalar *x                        ///< Location at which to evaluate
00112 );
00113 
00114 /** \} */ // End of MathGroup Functions
00115 
00116 #endif // #ifndef PS_SPLINE_H
00117 

Generated on Thu Oct 13 14:32:52 2005 for Pan-STARRS Foundation Library by  doxygen 1.4.2