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

psMinimizeLMM.h

Go to the documentation of this file.
00001 /** @file  psMinimizeLMM.c
00002  *  \brief basic minimization functions
00003  *  @ingroup Math
00004  *
00005  *  This file will contain function prototypes for various Levenberg-Marquadt
00006  *  minimization routines.
00007  *
00008  *  @author GLG, MHPCC
00009  *
00010  *  @version $Revision: 1.6 $ $Name: rel12 $
00011  *  @date $Date: 2006/06/30 02:20:06 $
00012  *
00013  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
00014  *
00015  */
00016 
00017 #ifndef PS_MINIMIZE_LMM_H
00018 #define PS_MINIMIZE_LMM_H
00019 
00020 /** \file psMinimizeLMM.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 "psPolynomial.h"
00034 #include "psSpline.h"
00035 #include "psStats.h"
00036 #include "psTrace.h"
00037 #include "psError.h"
00038 #include "psConstants.h"
00039 
00040 #define PS_DETERMINE_BRACKET_STEP_SIZE 0.10
00041 #define PS_MAX_LMM_ITERATIONS 100
00042 #define PS_MAX_MINIMIZE_ITERATIONS 100
00043 
00044 /** A data structure for minimization routines.
00045  *
00046  *  Contains numerical analysis parameters/values
00047  */
00048 typedef struct
00049 {
00050     const int maxIter;                 ///< Convergence limit
00051     const float tol;                   ///< Error Tolerance
00052     float value;                       ///< Value of function at minimum
00053     int iter;                          ///< Number of iterations to date
00054     float lastDelta;                   ///< The last difference for the fit
00055 }
00056 psMinimization;
00057 
00058 
00059 /** A data structure for minimization routines.
00060  *
00061  *
00062  */
00063 typedef struct
00064 {
00065     psVector *paramMask;                ///< valid / invalid parameters
00066     psVector *paramMax;                 ///< max allowed parameters
00067     psVector *paramMin;                 ///< min allowed parameters
00068     psVector *paramDelta;               ///< max allowed param swing
00069 }
00070 psMinConstrain;
00071 
00072 psMinConstrain *psMinConstrainAlloc();
00073 
00074 #define P_PSMINIMIZATION_SET_MAXITER(m,val) *(int*)&m->maxIter = val
00075         #define P_PSMINIMIZATION_SET_TOL(m,val) *(float*)&m->tol = val
00076 
00077                 /** Allocates a psMinimization structure.
00078                  *
00079                  *  @return psMinimization* :   a new psMinimization struct
00080                 */
00081                 psMinimization *psMinimizationAlloc(
00082                     int maxIter,                       ///< Number of minimization iterations to perform.
00083                     float tol                          ///< Requested error tolerance
00084                 );
00085 
00086 /*  Checks the type of a particular pointer.
00087  *
00088  *  Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.
00089  *
00090  *  @return bool:       True if the pointer matches a psMinimization structure, false otherwise.
00091  */
00092 bool psMemCheckMinimization(
00093     psPtr ptr                          ///< the pointer whose type to check
00094 );
00095 
00096 
00097 /** Specifies the format of a user-defined function that the general Levenberg-
00098  *  Marquardt minimizer routine will accept.
00099  *
00100  *  @return float:   the single float value of the function given the parameters,
00101  *       positions, and derivatives.
00102  */
00103 typedef
00104 float (*psMinimizeLMChi2Func)(
00105     psVector *deriv,                   ///< derivatives of the function
00106     const psVector *params,            ///< the parameters used to evaluate the function
00107     const psVector *x                  ///< positions for evaluation
00108 );
00109 
00110 /** Minimizes a specified function based on the Levenberg-Marquardt method.
00111  *
00112  *  @return bool:   True if successful.
00113  */
00114 bool psMinimizeLMChi2(
00115     psMinimization *min,               ///< Minimization specification
00116     psImage *covar,                    ///< Covariance matrix
00117     psVector *params,                  ///< "Best Guess" for the parameters that minimize func
00118     psMinConstrain *constrain,         ///< Constraints on the parameters
00119     const psArray *x,                  ///< Measurement ordinates of multiple vectors
00120     const psVector *y,                 ///< Measurement coordinates
00121     const psVector *yWt,               ///< Errors in the measurement coordinates
00122     psMinimizeLMChi2Func func          ///< Specified function
00123 );
00124 
00125 bool psMinimizeGaussNewtonDelta (
00126     psVector *delta,
00127     const psVector *params,
00128     const psVector *paramMask,
00129     const psArray  *x,
00130     const psVector *y,
00131     const psVector *yErr,
00132     psMinimizeLMChi2Func func
00133 );
00134 
00135 /** Function used to set parameters for generating "best guess" in minimizing Chi-Squared value.
00136  *
00137  *  @return psF64:    Chi-squared value for new guess
00138  */
00139 psF64 p_psMinLM_SetABX (
00140     psImage  *alpha,                   ///< alpha guess
00141     psVector *beta,                    ///< beta guess
00142     const psVector *params,            ///< params guess
00143     const psVector *paramMask,         ///< param mask
00144     const psArray  *x,                 ///< Measurement ordinates
00145     const psVector *y,                 ///< Measurement coordinates
00146     const psVector *dy,                ///< Weights calculated from y-errors
00147     psMinimizeLMChi2Func func          ///< Specified function
00148 );
00149 
00150 
00151 /* \} */// End of MathGroup Functions
00152 
00153 
00154 
00155 
00156 #endif // #ifndef PS_MINIMIZE_LMM_H
00157 

Generated on Mon Jul 3 14:13:44 2006 for Pan-STARRS Foundation Library by  doxygen 1.4.4