IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 10, 2004, 5:17:03 PM (22 years ago)
Author:
desonia
Message:

cleanup.

File:
1 edited

Legend:

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

    r1441 r1468  
    1515 */
    1616
    17 /** This routine must minimize a non-linear function */
    18 psVector* psMinimize(psVector* restrict initialGuess,
    19                      float (*myFunction) (const psVector* restrict, const psVector* restrict),
    20                      float (*myFunctionDeriv) (const psVector* restrict, const psVector* restrict, int),
    21                      const psVector* restrict coord, const psVector* restrict paramMask);
     17/** function of a collection of parameters and coordinate vector.
     18 *
     19 *  @return float    value to minimize
     20 */
     21typedef float (*psMinimizeFunction)(
     22    const psVector* restrict params,   ///< collection of parameters
     23    const psVector* restrict coord     ///< coordinates
     24);
    2225
    23 /** Minimize chi^2 for input data */
    24 psVector* psMinimizeChi2(float (*evalModel) (const psVector* restrict, const psVector* restrict),     ///<
    25                          // Model
    26                          // to
    27                          // fit;
    28                          // (domain
    29                          // and
    30                          // params)
    31                          float (*DevalModel) (const psVector* restrict, const psVector* restrict, int),       ///<
    32                          // Derivative
    33                          // of
    34                          // model
    35                          // to
    36                          // fit;
    37                          // (domain
    38                          // and
    39                          // params)
    40                          const psImage* restrict domain,       ///< The domain values for the corresponding
    41                          // measurements
    42                          const psVector* restrict data,        ///< Data to fit
    43                          const psVector* restrict errors,      ///< Errors in the data
    44                          psVector* restrict initialGuess,      ///< Initial guess
    45                          const psVector* restrict paramMask,   ///< 1 = fit for parameter, 0 = hold
    46                          // parameter constant
    47                          float *chiSq);
     26typedef float (*psMinimizeFunctionDeriv) (
     27    const psVector* restrict params,   ///< collection of parameters
     28    const psVector* restrict coord,    ///< coordinates
     29    int derivParam                     ///< index of parameter to calculate derivative of
     30);
    4831
    49 /** Derive a polynomial fit by chi^2 minimisation (analytically) */
    50 psPolynomial1D* psVectorFitPolynomial1D(psPolynomial1D* myPoly,        ///< Polynomial to fit
    51                                         const psVector* restrict x,    ///< Ordinates (or NULL to just use
    52                                         // the indices)
    53                                         const psVector* restrict y,    ///< Coordinates
    54                                         const psVector* restrict yErr  ///< Errors in coordinates, or NULL
    55                                        );
     32/** Minimizes a non-linear function.
     33 *
     34 *  psMinimize determines and returns the vector that minimizes the specified
     35 *  function. It takes as input a function, myFunction, an initial guess for
     36 *  the vector that minimizes the function, initialGuess, the current
     37 *  coordiate coord, and an optional mask for the vector elements (function
     38 *  parameters) to minimize, paramMask (all parameters are fit if PSLib SDRS
     39 *  25 July 13, 2004 Pan-STARRS Image Processing Pipeline PSDC-430-007-04
     40 *  NULL). Note that paramMask must be of type psU8, while params must be of
     41 *  type psF32. The optional function, myFuncDeriv returns the derivative of
     42 *  the function. This function must be valid only for types psF32, psF64.
     43 *
     44 *  @return psVector*    minimized vector
     45 */
     46psVector* psMinimize(
     47    psVector* restrict initialGuess,
     48    psMinimizeFunction myFunction,
     49    psMinimizeFunctionDeriv myFunctionDeriv,
     50    const psVector* restrict coord,
     51    const psVector* restrict paramMask
     52);
     53
     54/** Minimize chi^2 for input data.
     55 *
     56 *  psMinimizeChi2 fits a model to observations by minimizing chi^2, returning
     57 *  the best-fit parameters. The input parameters are a function that
     58 *  evaluates the model for a specified domain, given the parameters,
     59 *  evalModel; a list of observations, (domain, data, and errors); an initial
     60 *  guess at the best-fit parameters, initialGuess which is returned with the
     61 *  best-fit parameters, and an optional mask specifying which parameters are
     62 *  to be fit, paramMask, which must be of type psU8. All parameters are fit
     63 *  if this vector is NULL. This function must be valid only for types psF32,
     64 *  psF64.
     65 *
     66 *  @return psVector*      minimized vector
     67 */
     68psVector* psMinimizeChi2(
     69    psMinimizeFunction evalModel,      ///< Model to fit; (domain and params)
     70    psMinimizeFunctionDeriv DevalModel,///< Derivative of model to fit; (domain and params)
     71    const psImage* restrict domain,    ///< The domain values for the corresponding measurements
     72    const psVector* restrict data,     ///< Data to fit
     73    const psVector* restrict errors,   ///< Errors in the data
     74    psVector* restrict initialGuess,   ///< Initial guess
     75    const psVector* restrict paramMask,///< 1 = fit for parameter, 0 = hold parameter constant
     76    float *chiSq                       ///< chi squared
     77);
     78
     79/** Derive a polynomial fit by chi^2 minimisation (analytically)
     80 *
     81 *  psVectorFitPolynomial1d returns the polynomial that best fits the
     82 *  observations. The input parameters are a polynomial that specifies the
     83 *  fit order, myPoly, which will be altered and returned with the best-fit
     84 *  coefficients; and the observations, x, y and yErr. The independent
     85 *  variable list, x may be NULL, in which case the vector index is used.
     86 *  The dependent variable error, yErr may be null, in which case the solution
     87 *  is determined in the assumption that all data errors are equal. This
     88 *  function must be valid only for types psF32, psF64.
     89 *
     90 *  @return psPolynomial1D*    polynomial fit
     91 */
     92psPolynomial1D* psVectorFitPolynomial1D(
     93    psPolynomial1D* myPoly,            ///< Polynomial to fit
     94    const psVector* restrict x,        ///< Ordinates (or NULL to just use the indices)
     95    const psVector* restrict y,        ///< Coordinates
     96    const psVector* restrict yErr      ///< Errors in coordinates, or NULL
     97);
    5698
    5799/* \} */// End of MathGroup Functions
Note: See TracChangeset for help on using the changeset viewer.