| 1 | /* minpack/lmder1.f -- translated by f2c (version 20050501). |
| 2 | You must link the resulting object file with libf2c: |
| 3 | on Microsoft Windows system, link with libf2c.lib; |
| 4 | on Linux or Unix systems, link with .../path/to/libf2c.a -lm |
| 5 | or, if you install libf2c.a in a standard place, with -lf2c -lm |
| 6 | -- in that order, at the end of the command line, as in |
| 7 | cc *.o -lf2c -lm |
| 8 | Source for libf2c is in /netlib/f2c/libf2c.zip, e.g., |
| 9 | |
| 10 | http://www.netlib.org/f2c/libf2c.zip |
| 11 | */ |
| 12 | |
| 13 | #ifdef __cplusplus |
| 14 | extern "C" { |
| 15 | #endif |
| 16 | #include "v3p_netlib.h"cxx . . $ `<file>/Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_netlib.h`/ |
| 17 | |
| 18 | /*< >*/ |
| 19 | /* Subroutine */ int lmder1_cxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_netlib_mangle.h:189:9`!( |
| 20 | void (*fcn)(v3p_netlib_integercxx . . $ v3p_netlib_integer#*, |
| 21 | v3p_netlib_integercxx . . $ v3p_netlib_integer#*, |
| 22 | v3p_netlib_doublerealcxx . . $ v3p_netlib_doublereal#*, |
| 23 | v3p_netlib_doublerealcxx . . $ v3p_netlib_doublereal#*, |
| 24 | v3p_netlib_doublerealcxx . . $ v3p_netlib_doublereal#*, |
| 25 | v3p_netlib_integercxx . . $ v3p_netlib_integer#*, |
| 26 | v3p_netlib_integercxx . . $ v3p_netlib_integer#*, |
| 27 | void*), |
| 28 | integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! *m, integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! *n, doublerealcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:57:9`! *x, |
| 29 | doublerealcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:57:9`! *fvec, doublerealcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:57:9`! *fjac, integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! *ldfjac, doublerealcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:57:9`! *tol, |
| 30 | integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! *info, integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! *ipvt, doublerealcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:57:9`! *wa, integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! *lwa, |
| 31 | void* userdata) |
| 32 | { |
| 33 | /* Initialized data */ |
| 34 | |
| 35 | static doublerealcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:57:9`! factor = 100.; /* constant */ |
| 36 | static doublerealcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:57:9`! zero = 0.; /* constant */ |
| 37 | |
| 38 | /* System generated locals */ |
| 39 | integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! fjac_dim1, fjac_offset; |
| 40 | |
| 41 | /* Local variables */ |
| 42 | integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! mode, nfev, njev; |
| 43 | doublerealcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:57:9`! ftol, gtol, xtol; |
| 44 | extern /* Subroutine */ int lmder_cxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_netlib_mangle.h:190:9`!( |
| 45 | void (*fcn)(v3p_netlib_integercxx . . $ v3p_netlib_integer#*, |
| 46 | v3p_netlib_integercxx . . $ v3p_netlib_integer#*, |
| 47 | v3p_netlib_doublerealcxx . . $ v3p_netlib_doublereal#*, |
| 48 | v3p_netlib_doublerealcxx . . $ v3p_netlib_doublereal#*, |
| 49 | v3p_netlib_doublerealcxx . . $ v3p_netlib_doublereal#*, |
| 50 | v3p_netlib_integercxx . . $ v3p_netlib_integer#*, |
| 51 | v3p_netlib_integercxx . . $ v3p_netlib_integer#*, |
| 52 | void*), |
| 53 | integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! *, integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! *, doublerealcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:57:9`! |
| 54 | *, doublerealcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:57:9`! *, doublerealcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:57:9`! *, integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! *, doublerealcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:57:9`! *, |
| 55 | doublerealcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:57:9`! *, doublerealcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:57:9`! *, integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! *, doublerealcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:57:9`! *, integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! *, |
| 56 | doublerealcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:57:9`! *, integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! *, integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! *, integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! *, integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! *, integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! |
| 57 | *, doublerealcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:57:9`! *, doublerealcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:57:9`! *, doublerealcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:57:9`! *, doublerealcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:57:9`! *, |
| 58 | doublerealcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:57:9`! *, void*); |
| 59 | integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! maxfev, nprint; |
| 60 | |
| 61 | /*< integer m,n,ldfjac,info,lwa >*/ |
| 62 | /*< integer ipvt(n) >*/ |
| 63 | /*< double precision tol >*/ |
| 64 | /*< double precision x(n),fvec(m),fjac(ldfjac,n),wa(lwa) >*/ |
| 65 | /*< external fcn >*/ |
| 66 | /* ********** */ |
| 67 | |
| 68 | /* subroutine lmder1 */ |
| 69 | |
| 70 | /* the purpose of lmder1 is to minimize the sum of the squares of */ |
| 71 | /* m nonlinear functions in n variables by a modification of the */ |
| 72 | /* levenberg-marquardt algorithm. this is done by using the more */ |
| 73 | /* general least-squares solver lmder. the user must provide a */ |
| 74 | /* subroutine which calculates the functions and the jacobian. */ |
| 75 | |
| 76 | /* the subroutine statement is */ |
| 77 | |
| 78 | /* subroutine lmder1(fcn,m,n,x,fvec,fjac,ldfjac,tol,info, */ |
| 79 | /* ipvt,wa,lwa) */ |
| 80 | |
| 81 | /* where */ |
| 82 | |
| 83 | /* fcn is the name of the user-supplied subroutine which */ |
| 84 | /* calculates the functions and the jacobian. fcn must */ |
| 85 | /* be declared in an external statement in the user */ |
| 86 | /* calling program, and should be written as follows. */ |
| 87 | |
| 88 | /* subroutine fcn(m,n,x,fvec,fjac,ldfjac,iflag) */ |
| 89 | /* integer m,n,ldfjac,iflag */ |
| 90 | /* double precision x(n),fvec(m),fjac(ldfjac,n) */ |
| 91 | /* ---------- */ |
| 92 | /* if iflag = 1 calculate the functions at x and */ |
| 93 | /* return this vector in fvec. do not alter fjac. */ |
| 94 | /* if iflag = 2 calculate the jacobian at x and */ |
| 95 | /* return this matrix in fjac. do not alter fvec. */ |
| 96 | /* ---------- */ |
| 97 | /* return */ |
| 98 | /* end */ |
| 99 | |
| 100 | /* the value of iflag should not be changed by fcn unless */ |
| 101 | /* the user wants to terminate execution of lmder1. */ |
| 102 | /* in this case set iflag to a negative integer. */ |
| 103 | |
| 104 | /* m is a positive integer input variable set to the number */ |
| 105 | /* of functions. */ |
| 106 | |
| 107 | /* n is a positive integer input variable set to the number */ |
| 108 | /* of variables. n must not exceed m. */ |
| 109 | |
| 110 | /* x is an array of length n. on input x must contain */ |
| 111 | /* an initial estimate of the solution vector. on output x */ |
| 112 | /* contains the final estimate of the solution vector. */ |
| 113 | |
| 114 | /* fvec is an output array of length m which contains */ |
| 115 | /* the functions evaluated at the output x. */ |
| 116 | |
| 117 | /* fjac is an output m by n array. the upper n by n submatrix */ |
| 118 | /* of fjac contains an upper triangular matrix r with */ |
| 119 | /* diagonal elements of nonincreasing magnitude such that */ |
| 120 | |
| 121 | /* t t t */ |
| 122 | /* p *(jac *jac)*p = r *r, */ |
| 123 | |
| 124 | /* where p is a permutation matrix and jac is the final */ |
| 125 | /* calculated jacobian. column j of p is column ipvt(j) */ |
| 126 | /* (see below) of the identity matrix. the lower trapezoidal */ |
| 127 | /* part of fjac contains information generated during */ |
| 128 | /* the computation of r. */ |
| 129 | |
| 130 | /* ldfjac is a positive integer input variable not less than m */ |
| 131 | /* which specifies the leading dimension of the array fjac. */ |
| 132 | |
| 133 | /* tol is a nonnegative input variable. termination occurs */ |
| 134 | /* when the algorithm estimates either that the relative */ |
| 135 | /* error in the sum of squares is at most tol or that */ |
| 136 | /* the relative error between x and the solution is at */ |
| 137 | /* most tol. */ |
| 138 | |
| 139 | /* info is an integer output variable. if the user has */ |
| 140 | /* terminated execution, info is set to the (negative) */ |
| 141 | /* value of iflag. see description of fcn. otherwise, */ |
| 142 | /* info is set as follows. */ |
| 143 | |
| 144 | /* info = 0 improper input parameters. */ |
| 145 | |
| 146 | /* info = 1 algorithm estimates that the relative error */ |
| 147 | /* in the sum of squares is at most tol. */ |
| 148 | |
| 149 | /* info = 2 algorithm estimates that the relative error */ |
| 150 | /* between x and the solution is at most tol. */ |
| 151 | |
| 152 | /* info = 3 conditions for info = 1 and info = 2 both hold. */ |
| 153 | |
| 154 | /* info = 4 fvec is orthogonal to the columns of the */ |
| 155 | /* jacobian to machine precision. */ |
| 156 | |
| 157 | /* info = 5 number of calls to fcn with iflag = 1 has */ |
| 158 | /* reached 100*(n+1). */ |
| 159 | |
| 160 | /* info = 6 tol is too small. no further reduction in */ |
| 161 | /* the sum of squares is possible. */ |
| 162 | |
| 163 | /* info = 7 tol is too small. no further improvement in */ |
| 164 | /* the approximate solution x is possible. */ |
| 165 | |
| 166 | /* ipvt is an integer output array of length n. ipvt */ |
| 167 | /* defines a permutation matrix p such that jac*p = q*r, */ |
| 168 | /* where jac is the final calculated jacobian, q is */ |
| 169 | /* orthogonal (not stored), and r is upper triangular */ |
| 170 | /* with diagonal elements of nonincreasing magnitude. */ |
| 171 | /* column j of p is column ipvt(j) of the identity matrix. */ |
| 172 | |
| 173 | /* wa is a work array of length lwa. */ |
| 174 | |
| 175 | /* lwa is a positive integer input variable not less than 5*n+m. */ |
| 176 | |
| 177 | /* subprograms called */ |
| 178 | |
| 179 | /* user-supplied ...... fcn */ |
| 180 | |
| 181 | /* minpack-supplied ... lmder */ |
| 182 | |
| 183 | /* argonne national laboratory. minpack project. march 1980. */ |
| 184 | /* burton s. garbow, kenneth e. hillstrom, jorge j. more */ |
| 185 | |
| 186 | /* ********** */ |
| 187 | /*< integer maxfev,mode,nfev,njev,nprint >*/ |
| 188 | /*< double precision factor,ftol,gtol,xtol,zero >*/ |
| 189 | /*< data factor,zero /1.0d2,0.0d0/ >*/ |
| 190 | /* Parameter adjustments */ |
| 191 | --fvec; |
| 192 | --ipvt; |
| 193 | --x; |
| 194 | fjac_dim1 = *ldfjac; |
| 195 | fjac_offset = 1 + fjac_dim1; |
| 196 | fjac -= fjac_offset; |
| 197 | --wa; |
| 198 | |
| 199 | /* Function Body */ |
| 200 | /*< info = 0 >*/ |
| 201 | *info = 0; |
| 202 | |
| 203 | /* check the input parameters for errors. */ |
| 204 | |
| 205 | /*< >*/ |
| 206 | if (*n <= 0 || *m < *n || *ldfjac < *m || *tol < zero || *lwa < *n * 5 + * |
| 207 | m) { |
| 208 | goto L10; |
| 209 | } |
| 210 | |
| 211 | /* call lmder. */ |
| 212 | |
| 213 | /*< maxfev = 100*(n + 1) >*/ |
| 214 | maxfev = (*n + 1) * 100; |
| 215 | /*< ftol = tol >*/ |
| 216 | ftol = *tol; |
| 217 | /*< xtol = tol >*/ |
| 218 | xtol = *tol; |
| 219 | /*< gtol = zero >*/ |
| 220 | gtol = zero; |
| 221 | /*< mode = 1 >*/ |
| 222 | mode = 1; |
| 223 | /*< nprint = 0 >*/ |
| 224 | nprint = 0; |
| 225 | /*< >*/ |
| 226 | lmder_cxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_netlib_mangle.h:190:9`!(fcn, m, n, &x[1], &fvec[1], &fjac[fjac_offset], ldfjac, & |
| 227 | ftol, &xtol, >ol, &maxfev, &wa[1], &mode, &factor, &nprint, |
| 228 | info, &nfev, &njev, &ipvt[1], &wa[*n + 1], &wa[(*n << 1) + 1], & |
| 229 | wa[*n * 3 + 1], &wa[(*n << 2) + 1], &wa[*n * 5 + 1], |
| 230 | userdata); |
| 231 | /*< if (info .eq. 8) info = 4 >*/ |
| 232 | if (*info == 8) { |
| 233 | *info = 4; |
| 234 | } |
| 235 | /*< 10 continue >*/ |
| 236 | L10: |
| 237 | /*< return >*/ |
| 238 | return 0; |
| 239 | |
| 240 | /* last card of subroutine lmder1. */ |
| 241 | |
| 242 | /*< end >*/ |
| 243 | } /* lmder1_ */ |
| 244 | |
| 245 | #ifdef __cplusplus |
| 246 | } |
| 247 | #endif |