IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 26, 2004, 11:25:59 AM (22 years ago)
Author:
gusciora
Message:

...

File:
1 edited

Legend:

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

    r1992 r2197  
    88 *  @author GLG, MHPCC
    99 *
    10  *  @version $Revision: 1.29 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2004-10-06 23:38:49 $
     10 *  @version $Revision: 1.30 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2004-10-26 21:24:43 $
    1212 *
    1313 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    8484
    8585
     86/*
     87   Bug 203:
     88 
     89typedef float (*psMinimizeLMChi2Func)(psVector *deriv, const psVector *params,
     90const psVector *x);
     91 
     92This function takes the current guess for the parameters for which we are
     93trying to get the best values (params), and a single vector (x) of
     94conditions 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 
     105This takes the minimization specs (min), returns the covariance matrix
     106(covar), takes the best guess of initial parameters (params), the parameter
     107mask (paramMask), and takes multiple vectors of conditions in an array (x),
     108the corresponding measured values (y) and errors (yErr) and the function to
     109fit (func).
     110 
     111For example, for GRB afterglows, I have flux as a function of time and
     112frequency.  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
     114errors in "yErr".  Then each of the time-frequency pairs are passed to my model
     115function with the current parameters, and the model function returns the flux
     116for that time-frequency pair, and the derivative with respect to each of the
     117parameters.
     118 
     119This seems reasonable.  The only thing we could change would be to have the
     120function be defined:
     121 
     122typedef psVector* (*psMinimizeLMChi2Func)(psImage *deriv,
     123                                          const psVector *params,
     124                                          const psArray *x);
     125 
     126So it would return the model value for each of the measurements at once, and
     127return for each the derivatives (so that it returns a matrix).
     128 
     129What do you think?
     130 
     131 
     132 
     133I'm not sure I understand how LM chi-squared minimization will work with the
     134following function that you define:
     135 
     136    typedef psVector* (*psMinimizeLMChi2Func)(psImage *deriv,
     137                                              const psVector *params,
     138                                              const psArray *x);
     139 
     140The chi-squared minimization algorithm, as defined in NR, requires that
     141function to be minimized be evaluated at each data point, and that all
     142derivatives, with respect to each parameter, be calculated at each data
     143point.  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
    86161// XXX: What if any of these arguments are NULL?
     162
     163
    87164typedef
    88165float (*psMinimizeLMChi2Func)(psVector *deriv,
     
    98175                      psMinimizeLMChi2Func func);
    99176
     177
     178typedef
     179psVector* (*psMyMinimizeLMChi2Func)(psImage *deriv,
     180                                    const psVector *params,
     181                                    const psArray *x);
     182
     183bool 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);
     191
    100192typedef
    101193float (*psMinimizePowellFunc)(const psVector *params,
Note: See TracChangeset for help on using the changeset viewer.