Main Page | Modules | Class List | File List | Class Members | File Members

lev_marq.h

Go to the documentation of this file.
00001 
00014 /* This library is free software; you can redistribute it and/or
00015    modify it under the terms of the GNU Lesser General Public
00016    License as published by the Free Software Foundation; either
00017    version 2.1 of the License, or (at your option) any later version.
00018 
00019    This library is distributed in the hope that it will be useful,
00020    but WITHOUT ANY WARRANTY; without even the implied warranty of
00021    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00022    Lesser General Public License for more details.
00023 
00024    You should have received a copy of the GNU Lesser General Public
00025    License along with this library; if not, write to the Free Software
00026    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00027 */
00028 
00029 #ifndef _GAN_LEV_MARQ_H
00030 #define _GAN_LEV_MARQ_H
00031 
00032 #include <gandalf/linalg/vec_gen.h>
00033 #include <gandalf/linalg/mat_gen.h>
00034 #include <gandalf/linalg/mat_square.h>
00035 #include <gandalf/common/linked_list.h>
00036 
00037 #ifdef __cplusplus
00038 extern "C" {
00039 #endif
00040 
00054 typedef enum
00055 {
00056    GAN_LEV_MARQ_OBS_H,        
00057    GAN_LEV_MARQ_OBS_H_ROBUST, 
00058    GAN_LEV_MARQ_OBS_F         
00059 } Gan_LevMarqObsType;
00060 
00069  typedef Gan_Bool (*Gan_LevMarqObsFunc_h) ( Gan_Vector *x,
00070                                            Gan_Vector *z, void *zdata,
00071                                            Gan_Vector *h, Gan_Matrix *H );
00072 
00081  typedef Gan_Bool (*Gan_LevMarqObsFunc_F) ( Gan_Vector *x,
00082                                            Gan_Vector *z, void *zdata,
00083                                            Gan_Vector *F, Gan_Matrix *Hx,
00084                                            Gan_Matrix *Hz );
00085 
00089 typedef struct Gan_LevMarqObs
00090 {
00092    Gan_LevMarqObsType type;
00093 
00094    union
00095    {
00096       struct
00097       {
00099          Gan_LevMarqObsFunc_h func;
00100 
00102          Gan_Vector z;
00103 
00105          void *zdata;
00106 
00108          Gan_SquMatrix Ni;
00109 
00111          double var_scale;
00112 
00115          double chi2;
00116 
00119          double chi2_offset;
00120       } h;
00121 
00122       struct
00123       {
00125          Gan_LevMarqObsFunc_F func;
00126 
00128          Gan_Vector z;
00129 
00131          void *zdata;
00132 
00134          Gan_SquMatrix N;
00135       } F;
00136    } details;
00137 
00139    Gan_Bool outlier;
00140 } Gan_LevMarqObs;
00141 
00145 typedef struct Gan_LevMarqStruct
00146 {
00148    Gan_Vector x, xold;
00149 
00151    double residual;
00152 
00154    Gan_SquMatrix A;
00155    Gan_Vector    a;
00156 
00158    Gan_SquMatrix P;
00159 
00161    Gan_List *obs_list;
00162 
00165    Gan_Vector hF;
00166    Gan_Matrix Hx, Hz;
00167 
00170    Gan_Matrix    NiHx;
00171    Gan_SquMatrix HxTNiHx;
00172    Gan_Vector    HxTNiv;
00173    Gan_Vector    Niv;
00174 
00176    Gan_SquMatrix Ni;
00177 
00179    Gan_Bool alloc;
00180 } Gan_LevMarqStruct;
00181 
00183 typedef Gan_Bool (*Gan_LevMarqInitFunc) ( Gan_Vector *x, Gan_List *obs_list,
00184                                           void *data );
00185 
00186  Gan_LevMarqStruct *gan_lev_marq_form ( Gan_LevMarqStruct *lm );
00187  Gan_LevMarqObs *gan_lev_marq_obs_h ( Gan_LevMarqStruct *lm,
00188                                      Gan_Vector *z, void *zdata,
00189                                      Gan_SquMatrix *Ni,
00190                                      Gan_LevMarqObsFunc_h obs_func );
00191  Gan_LevMarqObs *gan_lev_marq_obs_h_robust ( Gan_LevMarqStruct *lm,
00192                                             Gan_Vector *z, void *zdata,
00193                                             Gan_SquMatrix *Ni,
00194                                             Gan_LevMarqObsFunc_h obs_func,
00195                                             double var_scale, double chi2 );
00196  Gan_LevMarqObs *gan_lev_marq_obs_F ( Gan_LevMarqStruct *lm,
00197                                      Gan_Vector *z, void *zdata,
00198                                      Gan_SquMatrix *Ni,
00199                                      Gan_LevMarqObsFunc_F obs_func );
00200  Gan_Bool gan_lev_marq_init ( Gan_LevMarqStruct *lm,
00201                              Gan_LevMarqInitFunc init_func,
00202                              void *data, double *residualp );
00203  Gan_Bool gan_lev_marq_iteration ( Gan_LevMarqStruct *lm, double lambda,
00204                                   double *residual );
00205  Gan_Vector    *gan_lev_marq_get_x ( Gan_LevMarqStruct *lm );
00206  Gan_SquMatrix *gan_lev_marq_get_P ( Gan_LevMarqStruct *lm );
00207  void gan_lev_marq_free ( Gan_LevMarqStruct *lm );
00208 
00217  Gan_LevMarqStruct *gan_lev_marq_alloc(void);
00218 
00227 #ifdef __cplusplus
00228 }
00229 #endif
00230 
00231 #endif /* #ifndef _GAN_LEV_MARQ_H */

Generated on Fri Mar 17 12:44:47 2006 by  doxygen 1.3.9.1