00001
00020
00021
00022
00023
00024 #ifndef _SBA_H_
00025 #define _SBA_H_
00026
00027
00028
00029
00030 #define SBA_APPEND_UNDERSCORE_SUFFIX // undef this for AIX
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050 #ifdef __cplusplus
00051 extern "C" {
00052 #endif
00053
00054 #define SBA_MIN_DELTA 1E-06 // finite differentiation minimum delta
00055 #define SBA_DELTA_SCALE 1E-04 // finite differentiation delta scale
00056
00057 #define SBA_OPTSSZ 5
00058 #define SBA_INFOSZ 10
00059 #define SBA_ERROR -1
00060 #define SBA_INIT_MU 1E-03
00061 #define SBA_STOP_THRESH 1E-12
00062 #define SBA_CG_NOPREC 0
00063 #define SBA_CG_JACOBI 1
00064 #define SBA_CG_SSOR 2
00065 #define SBA_VERSION "1.6 (Aug. 2009)"
00066
00067
00068
00069
00070
00071
00072 struct sba_crsm{
00073 int nr, nc;
00074 int nnz;
00075 int *val;
00076 int *colidx;
00077 int *rowptr;
00078
00079
00080 };
00081
00082
00083
00084
00085 extern int
00086 sba_motstr_levmar(const int n, const int ncon, const int m, const int mcon, char *vmask,
00087 double *p, const int cnp, const int pnp, double *x, double *covx, const int mnp,
00088 void (*proj)(int j, int i, double *aj, double *bi, double *xij, void *adata),
00089 void (*projac)(int j, int i, double *aj, double *bi, double *Aij, double *Bij, void *adata),
00090 void *adata, const int itmax, const int verbose, const double opts[SBA_OPTSSZ], double info[SBA_INFOSZ]);
00091
00092 extern int
00093 sba_mot_levmar(const int n, const int m, const int mcon, char *vmask, double *p, const int cnp,
00094 double *x, double *covx, const int mnp,
00095 void (*proj)(int j, int i, double *aj, double *xij, void *adata),
00096 void (*projac)(int j, int i, double *aj, double *Aij, void *adata),
00097 void *adata, const int itmax, const int verbose, const double opts[SBA_OPTSSZ], double info[SBA_INFOSZ]);
00098
00099 extern int
00100 sba_str_levmar(const int n, const int ncon, const int m, char *vmask, double *p, const int pnp,
00101 double *x, double *covx, const int mnp,
00102 void (*proj)(int j, int i, double *bi, double *xij, void *adata),
00103 void (*projac)(int j, int i, double *bi, double *Bij, void *adata),
00104 void *adata, const int itmax, const int verbose, const double opts[SBA_OPTSSZ], double info[SBA_INFOSZ]);
00105
00106
00107
00108 extern int
00109 sba_motstr_levmar_x(const int n, const int ncon, const int m, const int mcon, char *vmask, double *p,
00110 const int cnp, const int pnp, double *x, double *covx, const int mnp,
00111 void (*func)(double *p, struct sba_crsm *idxij, int *rcidxs, int *rcsubs, double *hx, void *adata),
00112 void (*fjac)(double *p, struct sba_crsm *idxij, int *rcidxs, int *rcsubs, double *jac, void *adata),
00113 void *adata, const int itmax, const int verbose, const double opts[SBA_OPTSSZ], double info[SBA_INFOSZ]);
00114
00115 extern int
00116 sba_mot_levmar_x(const int n, const int m, const int mcon, char *vmask, double *p, const int cnp,
00117 double *x, double *covx, const int mnp,
00118 void (*func)(double *p, struct sba_crsm *idxij, int *rcidxs, int *rcsubs, double *hx, void *adata),
00119 void (*fjac)(double *p, struct sba_crsm *idxij, int *rcidxs, int *rcsubs, double *jac, void *adata),
00120 void *adata, const int itmax, const int verbose, const double opts[SBA_OPTSSZ], double info[SBA_INFOSZ]);
00121
00122 extern int
00123 sba_str_levmar_x(const int n, const int ncon, const int m, char *vmask, double *p, const int pnp,
00124 double *x, double *covx, const int mnp,
00125 void (*func)(double *p, struct sba_crsm *idxij, int *rcidxs, int *rcsubs, double *hx, void *adata),
00126 void (*fjac)(double *p, struct sba_crsm *idxij, int *rcidxs, int *rcsubs, double *jac, void *adata),
00127 void *adata, const int itmax, const int verbose, const double opts[SBA_OPTSSZ], double info[SBA_INFOSZ]);
00128
00129
00130
00131 extern int sba_Axb_QR(double *A, double *B, double *x, int m, int iscolmaj);
00132 extern int sba_Axb_QRnoQ(double *A, double *B, double *x, int m, int iscolmaj);
00133 extern int sba_Axb_Chol(double *A, double *B, double *x, int m, int iscolmaj);
00134 extern int sba_Axb_LDLt(double *A, double *B, double *x, int m, int iscolmaj);
00135 extern int sba_Axb_LU(double *A, double *B, double *x, int m, int iscolmaj);
00136 extern int sba_Axb_SVD(double *A, double *B, double *x, int m, int iscolmaj);
00137 extern int sba_Axb_BK(double *A, double *B, double *x, int m, int iscolmaj);
00138 extern int sba_Axb_CG(double *A, double *B, double *x, int m, int niter, double eps, int prec, int iscolmaj);
00139 extern int sba_symat_invert_LU(double *A, int m);
00140 extern int sba_symat_invert_Chol(double *A, int m);
00141 extern int sba_symat_invert_BK(double *A, int m);
00142 extern int sba_mat_cholinv(double *A, double *B, int m);
00143
00144
00145 extern void sba_crsm_alloc(struct sba_crsm *sm, int nr, int nc, int nnz);
00146 extern void sba_crsm_free(struct sba_crsm *sm);
00147 extern int sba_crsm_elmidx(struct sba_crsm *sm, int i, int j);
00148 extern int sba_crsm_elmidxp(struct sba_crsm *sm, int i, int j, int jp, int jpidx);
00149 extern int sba_crsm_row_elmidxs(struct sba_crsm *sm, int i, int *vidxs, int *jidxs);
00150 extern int sba_crsm_col_elmidxs(struct sba_crsm *sm, int j, int *vidxs, int *iidxs);
00151
00152
00153 #ifdef __cplusplus
00154 }
00155 #endif
00156
00157 #endif