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

psMinimize.h

Go to the documentation of this file.
00001 /** @file  psMinimize.c
00002  *  \brief basic minimization functions
00003  *  @ingroup Math
00004  *
00005  *  This file will contain function prototypes for various minimization,
00006  *  chi-squared minimization, and 1-D polynomial fitting routines.
00007  *
00008  *  @author GLG, MHPCC
00009  *
00010  *  @version $Revision: 1.1.1.1 $ $Name:  $
00011  *  @date $Date: 2005/06/15 21:08:12 $
00012  *
00013  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
00014  *
00015  */
00016 
00017 #ifndef PS_MINIMIZE_H
00018 #define PS_MINIMIZE_H
00019 
00020 /** \file psMinimize.h
00021  *  \brief minimization operations
00022  *  \ingroup Stats
00023  */
00024 /** \addtogroup Stats
00025  *  \{
00026  */
00027 
00028 #include "psVector.h"
00029 #include "psMemory.h"
00030 #include "psArray.h"
00031 #include "psImage.h"
00032 #include "psMatrix.h"
00033 #include "psFunctions.h"
00034 #include "psStats.h"
00035 #include "psTrace.h"
00036 #include "psError.h"
00037 #include "psConstants.h"
00038 
00039 typedef struct
00040 {
00041     psS32 maxIter;                     ///< Convergence limit
00042     psF32 tol;                         ///< Error Tolerance
00043     psF32 value;                       ///< Value of function at minimum
00044     psS32 iter;                        ///< Number of iterations to date
00045     psF32 lastDelta;                   ///< The last difference for the fit
00046 }
00047 psMinimization;
00048 
00049 psMinimization *psMinimizationAlloc(psS32 maxIter,   ///< Number of minimization iterations to perform.
00050                                     psF32 tol        ///< Requested error tolerance
00051                                    );
00052 
00053 /** Derive a polynomial fit.
00054  *
00055  *  psVectorFitPolynomial1d returns the polynomial that best fits the
00056  *  observations. The input parameters are a polynomial that specifies the
00057  *  fit order, myPoly, which will be altered and returned with the best-fit
00058  *  coefficients; and the observations, x, y and yErr. The independent
00059  *  variable list, x may be NULL, in which case the vector index is used.
00060  *  The dependent variable error, yErr may be null, in which case the solution
00061  *  is determined in the assumption that all data errors are equal. This
00062  *  function must be valid only for types psF32, psF64.
00063  *
00064  *  @return psPolynomial1D*    polynomial fit
00065  */
00066 psPolynomial1D* psVectorFitPolynomial1D(
00067     psPolynomial1D* myPoly,            ///< Polynomial to fit
00068     const psVector* x,                 ///< Ordinates (or NULL to just use the indices)
00069     const psVector* y,                 ///< Coordinates
00070     const psVector* yErr               ///< Errors in coordinates, or NULL
00071 );
00072 
00073 psSpline1D *psVectorFitSpline1D(psSpline1D *mySpline,     ///< The spline which will be generated.
00074                                 const psVector* x,        ///< Ordinates (or NULL to just use the indices)
00075                                 const psVector* y,        ///< Coordinates
00076                                 const psVector* yErr      ///< Errors in coordinates, or NULL
00077                                );
00078 
00079 // XXX: Add Doxygen comments here.
00080 typedef
00081 psF64 (*psMinimizeLMChi2Func)(psVector *deriv,
00082                               psVector *params,
00083                               psVector *x);
00084 
00085 psBool psMinimizeLMChi2(psMinimization *min,
00086                         psImage *covar,
00087                         psVector *params,
00088                         const psVector *paramMask,
00089                         const psArray *x,
00090                         const psVector *y,
00091                         const psVector *yErr,
00092                         psMinimizeLMChi2Func func);
00093 
00094 psBool p_psMinLM_GuessABP (psImage  *Alpha,
00095                            psVector *Beta,
00096                            psVector *Params,
00097                            psImage  *alpha,
00098                            psVector *beta,
00099                            psVector *params,
00100                            psF64 lambda);
00101 
00102 psF64 p_psMinLM_SetABX (psImage  *alpha,
00103                         psVector *beta,
00104                         psVector *params,
00105                         const psArray  *x,
00106                         const psVector *y,
00107                         const psVector *dy,
00108                         psMinimizeLMChi2Func func);
00109 
00110 typedef
00111 psF32 (*psMinimizePowellFunc)(const psVector *params,
00112                               const psArray *coords);
00113 
00114 psBool psMinimizePowell(psMinimization *min,
00115                         psVector *params,
00116                         const psVector *paramMask,
00117                         const psArray *coords,
00118                         psMinimizePowellFunc func);
00119 
00120 psVector *psMinimizeLMChi2Gauss1D(psImage *deriv,
00121                                   const psVector *params,
00122                                   const psArray *coords);
00123 
00124 psVector *psMinimizePowellChi2Gauss1D(const psVector *params,
00125                                       const psArray *coords);
00126 
00127 typedef
00128 psVector *(*psMinimizeChi2PowellFunc)(const psVector *params,
00129                                       const psArray *coords);
00130 
00131 psBool psMinimizeChi2Powell(psMinimization *min,
00132                             psVector *params,
00133                             const psVector *paramMask,
00134                             const psArray *coords,
00135                             const psVector *value,
00136                             const psVector *error,
00137                             psMinimizeChi2PowellFunc func);
00138 
00139 // XXX EAM : psGaussJordan provided as an alternate to LU Decomp for psMinimizeLMChi2
00140 bool psGaussJordan (psImage *a, psVector *b);
00141 
00142 /* \} */// End of MathGroup Functions
00143 
00144 #endif // #ifndef PS_MINIMIZE_H
00145 

Generated on Wed Jun 15 11:00:57 2005 for Pan-STARRS Foundation Library by  doxygen 1.4.1