IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 26, 2004, 1:14:04 PM (22 years ago)
Author:
gusciora
Message:

Modified the prototype for the LM minimization routines.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/dataManip/psMinimize.h

    r2197 r2202  
    88 *  @author GLG, MHPCC
    99 *
    10  *  @version $Revision: 1.30 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2004-10-26 21:24:43 $
     10 *  @version $Revision: 1.31 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2004-10-26 23:14:04 $
    1212 *
    1313 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    8383                               );
    8484
    85 
    86 /*
    87    Bug 203:
    88  
    89 typedef float (*psMinimizeLMChi2Func)(psVector *deriv, const psVector *params,
    90 const psVector *x);
    91  
    92 This function takes the current guess for the parameters for which we are
    93 trying to get the best values (params), and a single vector (x) of
    94 conditions from the array of x values fed into the minimiser.
    95  
    96     bool psMinimizeLMChi2(psMinimization *min,
    97                           psImage *covar,
    98                           psVector *params,
    99                           const psVector *paramMask,
    100                           const psArray *x,
    101                           const psVector *y,
    102                           const psVector *yErr,
    103                           psMinimizeLMChi2Func func);
    104  
    105 This takes the minimization specs (min), returns the covariance matrix
    106 (covar), takes the best guess of initial parameters (params), the parameter
    107 mask (paramMask), and takes multiple vectors of conditions in an array (x),
    108 the corresponding measured values (y) and errors (yErr) and the function to
    109 fit (func).
    110  
    111 For example, for GRB afterglows, I have flux as a function of time and
    112 frequency.  So I stuff into the "psArray *x" all my time and frequency values
    113 (so a whole heap of vectors of size 2), I have the measured values in "y" and
    114 errors in "yErr".  Then each of the time-frequency pairs are passed to my model
    115 function with the current parameters, and the model function returns the flux
    116 for that time-frequency pair, and the derivative with respect to each of the
    117 parameters.
    118  
    119 This seems reasonable.  The only thing we could change would be to have the
    120 function be defined:
    121  
    122 typedef psVector* (*psMinimizeLMChi2Func)(psImage *deriv,
    123                                           const psVector *params,
    124                                           const psArray *x);
    125  
    126 So it would return the model value for each of the measurements at once, and
    127 return for each the derivatives (so that it returns a matrix).
    128  
    129 What do you think?
    130  
    131  
    132  
    133 I'm not sure I understand how LM chi-squared minimization will work with the
    134 following function that you define:
    135  
    136     typedef psVector* (*psMinimizeLMChi2Func)(psImage *deriv,
    137                                               const psVector *params,
    138                                               const psArray *x);
    139  
    140 The chi-squared minimization algorithm, as defined in NR, requires that
    141 function to be minimized be evaluated at each data point, and that all
    142 derivatives, with respect to each parameter, be calculated at each data
    143 point.  In the above, can I assume that
    144  
    145     x is an array of psVectors, with each vector corresponding to a single
    146  data point.
    147  
    148     The returned value has the same length as x.  It contains the value of
    149  the function at each data point in x.
    150  
    151     deriv: an n-by-p matrix where "n" is the number of data points, and "p"
    152  is the number of parameters.  The [i][j] element of this matrix
    153  holds the derivative of the function at the i-th data point with
    154  respect to the j-th parameter.
    155  
    156  
    157  
    158 */
    159 
    160 
    161 // XXX: What if any of these arguments are NULL?
    162 
    163 
    16485typedef
    165 float (*psMinimizeLMChi2Func)(psVector *deriv,
    166                               const psVector *params,
    167                               const psVector *coords);
     86psVector* (*psMinimizeLMChi2Func)(psImage *deriv,
     87                                  const psVector *params,
     88                                  const psArray *x);
    16889
    16990bool psMinimizeLMChi2(psMinimization *min,
     91                      psImage *covar,
    17092                      psVector *params,
    17193                      const psVector *paramMask,
    172                       psImage *covar,
    173                       const psArray *coords,
    174                       const psVector *value,
     94                      const psArray *x,
     95                      const psVector *y,
     96                      const psVector *yErr,
    17597                      psMinimizeLMChi2Func func);
    176 
    177 
    178 typedef
    179 psVector* (*psMyMinimizeLMChi2Func)(psImage *deriv,
    180                                     const psVector *params,
    181                                     const psArray *x);
    182 
    183 bool psMyMinimizeLMChi2(psMinimization *min,
    184                         psImage *covar,
    185                         psVector *params,
    186                         const psVector *paramMask,
    187                         const psArray *x,
    188                         const psVector *y,
    189                         const psVector *yErr,
    190                         psMyMinimizeLMChi2Func func);
    19198
    19299typedef
Note: See TracChangeset for help on using the changeset viewer.