Changeset 2202 for trunk/psLib/src/dataManip/psMinimize.h
- Timestamp:
- Oct 26, 2004, 1:14:04 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/dataManip/psMinimize.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/dataManip/psMinimize.h
r2197 r2202 8 8 * @author GLG, MHPCC 9 9 * 10 * @version $Revision: 1.3 0$ $Name: not supported by cvs2svn $11 * @date $Date: 2004-10-26 2 1:24:43$10 * @version $Revision: 1.31 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2004-10-26 23:14:04 $ 12 12 * 13 13 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 83 83 ); 84 84 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 are93 trying to get the best values (params), and a single vector (x) of94 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 matrix106 (covar), takes the best guess of initial parameters (params), the parameter107 mask (paramMask), and takes multiple vectors of conditions in an array (x),108 the corresponding measured values (y) and errors (yErr) and the function to109 fit (func).110 111 For example, for GRB afterglows, I have flux as a function of time and112 frequency. So I stuff into the "psArray *x" all my time and frequency values113 (so a whole heap of vectors of size 2), I have the measured values in "y" and114 errors in "yErr". Then each of the time-frequency pairs are passed to my model115 function with the current parameters, and the model function returns the flux116 for that time-frequency pair, and the derivative with respect to each of the117 parameters.118 119 This seems reasonable. The only thing we could change would be to have the120 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, and127 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 the134 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 that141 function to be minimized be evaluated at each data point, and that all142 derivatives, with respect to each parameter, be calculated at each data143 point. In the above, can I assume that144 145 x is an array of psVectors, with each vector corresponding to a single146 data point.147 148 The returned value has the same length as x. It contains the value of149 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 matrix153 holds the derivative of the function at the i-th data point with154 respect to the j-th parameter.155 156 157 158 */159 160 161 // XXX: What if any of these arguments are NULL?162 163 164 85 typedef 165 float (*psMinimizeLMChi2Func)(psVector*deriv,166 const psVector *params,167 const psVector *coords);86 psVector* (*psMinimizeLMChi2Func)(psImage *deriv, 87 const psVector *params, 88 const psArray *x); 168 89 169 90 bool psMinimizeLMChi2(psMinimization *min, 91 psImage *covar, 170 92 psVector *params, 171 93 const psVector *paramMask, 172 psImage *covar,173 const ps Array *coords,174 const psVector * value,94 const psArray *x, 95 const psVector *y, 96 const psVector *yErr, 175 97 psMinimizeLMChi2Func func); 176 177 178 typedef179 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);191 98 192 99 typedef
Note:
See TracChangeset
for help on using the changeset viewer.
