IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 10252


Ignore:
Timestamp:
Nov 28, 2006, 4:17:15 PM (19 years ago)
Author:
magnier
Message:

changed psMinimizeLMM limits to a function call (from static vectors); added psMinConstraintMode, psMinimizeLMLimitFunc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/math/psMinimizeLMM.h

    r7766 r10252  
    88 *  @author GLG, MHPCC
    99 *
    10  *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2006-06-30 02:20:06 $
     10 *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2006-11-29 02:17:15 $
    1212 *
    1313 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    4141#define PS_MAX_LMM_ITERATIONS 100
    4242#define PS_MAX_MINIMIZE_ITERATIONS 100
     43#define P_PSMINIMIZATION_SET_MAXITER(m,val) *(int*)&m->maxIter = val
     44        #define P_PSMINIMIZATION_SET_TOL(m,val) *(float*)&m->tol = val
     45
     46                typedef enum {
     47                    PS_MINIMIZE_BETA_LIMIT,
     48                    PS_MINIMIZE_PARAM_MIN,
     49                    PS_MINIMIZE_PARAM_MAX
     50                } psMinConstraintMode;
     51
     52/** Specifies the format of a user-defined function that the general Levenberg-
     53 *  Marquardt minimizer routine will accept.
     54 *
     55 *  @return float:   the single float value of the function given the parameters,
     56 *       positions, and derivatives.
     57 */
     58typedef
     59float (*psMinimizeLMChi2Func)(
     60    psVector *deriv,                   ///< derivatives of the function
     61    const psVector *params,            ///< the parameters used to evaluate the function
     62    const psVector *x                  ///< positions for evaluation
     63);
     64
     65/** Specifies the format of a user-defined function which check the parameters
     66 *  against the allowed limits.  used by the general Levenberg-Marquardt minimizer.
     67 *
     68 *  @return float:   the single float value of the function given the parameters,
     69 *       positions, and derivatives.
     70 */
     71typedef
     72bool (*psMinimizeLMLimitFunc)(
     73    psMinConstraintMode mode,   ///< which limit to check
     74    int nParam,    ///< which param to check
     75    float *params,   ///< current param value set
     76    float *beta       ///< current beta value, if needed
     77);
    4378
    4479/** A data structure for minimization routines.
     
    5691psMinimization;
    5792
    58 
    5993/** A data structure for minimization routines.
    6094 *
     
    6498{
    6599    psVector *paramMask;                ///< valid / invalid parameters
    66     psVector *paramMax;                 ///< max allowed parameters
    67     psVector *paramMin;                 ///< min allowed parameters
    68     psVector *paramDelta;               ///< max allowed param swing
     100    psMinimizeLMLimitFunc checkLimits; ///< user-supplied function to test the parameter limits
    69101}
    70 psMinConstrain;
     102psMinConstraint;
    71103
    72 psMinConstrain *psMinConstrainAlloc();
     104psMinConstraint *psMinConstraintAlloc();
    73105
    74 #define P_PSMINIMIZATION_SET_MAXITER(m,val) *(int*)&m->maxIter = val
    75         #define P_PSMINIMIZATION_SET_TOL(m,val) *(float*)&m->tol = val
    76 
    77                 /** Allocates a psMinimization structure.
    78                  *
    79                  *  @return psMinimization* :   a new psMinimization struct
    80                 */
    81                 psMinimization *psMinimizationAlloc(
    82                     int maxIter,                       ///< Number of minimization iterations to perform.
    83                     float tol                          ///< Requested error tolerance
    84                 );
     106/** Allocates a psMinimization structure.
     107 *
     108 *  @return psMinimization* :   a new psMinimization struct
     109 */
     110psMinimization *psMinimizationAlloc(
     111    int maxIter,                       ///< Number of minimization iterations to perform.
     112    float tol                          ///< Requested error tolerance
     113);
    85114
    86115/*  Checks the type of a particular pointer.
     
    94123);
    95124
    96 
    97 /** Specifies the format of a user-defined function that the general Levenberg-
    98  *  Marquardt minimizer routine will accept.
    99  *
    100  *  @return float:   the single float value of the function given the parameters,
    101  *       positions, and derivatives.
    102  */
    103 typedef
    104 float (*psMinimizeLMChi2Func)(
    105     psVector *deriv,                   ///< derivatives of the function
    106     const psVector *params,            ///< the parameters used to evaluate the function
    107     const psVector *x                  ///< positions for evaluation
    108 );
    109 
    110125/** Minimizes a specified function based on the Levenberg-Marquardt method.
    111126 *
     
    116131    psImage *covar,                    ///< Covariance matrix
    117132    psVector *params,                  ///< "Best Guess" for the parameters that minimize func
    118     psMinConstrain *constrain,        ///< Constraints on the parameters
     133    psMinConstraint *constraint, ///< Constraints on the parameters
    119134    const psArray *x,                  ///< Measurement ordinates of multiple vectors
    120135    const psVector *y,                 ///< Measurement coordinates
     
    135150/** Function used to set parameters for generating "best guess" in minimizing Chi-Squared value.
    136151 *
    137  *  @return psF64:    Chi-squared value for new guess
     152 *  @return psF32:    Chi-squared value for new guess
    138153 */
    139 psF64 p_psMinLM_SetABX (
     154psF32 p_psMinLM_SetABX (
    140155    psImage  *alpha,                   ///< alpha guess
    141156    psVector *beta,                    ///< beta guess
     
    149164
    150165
     166psBool p_psMinLM_GuessABP(
     167    psImage  *Alpha,
     168    psVector *Beta,
     169    psVector *Params,
     170    const psImage  *alpha,
     171    const psVector *beta,
     172    const psVector *params,
     173    const psVector *paramMask,
     174    psMinimizeLMLimitFunc checkLimits,
     175    psF32 lambda
     176);
     177
    151178/* \} */// End of MathGroup Functions
    152 
    153 
    154 
    155179
    156180#endif // #ifndef PS_MINIMIZE_LMM_H
Note: See TracChangeset for help on using the changeset viewer.