use const for machine constants

This commit is contained in:
Thomas Capricelli 2009-08-22 07:31:14 +02:00
parent bb6ffafdb9
commit b3f8d02df4
6 changed files with 10 additions and 30 deletions

View File

@ -7,7 +7,7 @@ void ei_dogleg(int n, const Scalar *r__, int /* lr*/ ,
/* Local variables */
int i, j, k, l, jj, jp1;
Scalar sum, temp, alpha, bnorm;
Scalar gnorm, qnorm, epsmch;
Scalar gnorm, qnorm;
Scalar sgnorm;
/* Parameter adjustments */
@ -19,10 +19,7 @@ void ei_dogleg(int n, const Scalar *r__, int /* lr*/ ,
--r__;
/* Function Body */
/* epsmch is the machine precision. */
epsmch = epsilon<Scalar>();
const Scalar epsmch = epsilon<Scalar>();
/* first, calculate the gauss-newton direction. */

View File

@ -12,7 +12,6 @@ int ei_fdjac1(minpack_func_nn fcn, void *p, int n, Scalar *x, const Scalar *
int i, j, k;
Scalar eps, temp;
int msum;
Scalar epsmch;
int iflag = 0;
/* Parameter adjustments */
@ -25,10 +24,7 @@ int ei_fdjac1(minpack_func_nn fcn, void *p, int n, Scalar *x, const Scalar *
fjac -= fjac_offset;
/* Function Body */
/* epsmch is the machine precision. */
epsmch = epsilon<Scalar>();
const Scalar epsmch = epsilon<Scalar>();
eps = ei_sqrt((std::max(epsfcn,epsmch)));
msum = ml + mu + 1;

View File

@ -10,7 +10,7 @@ int ei_fdjac2(minpack_func_mn fcn, void *p, int m, int n, Scalar *x,
/* Local variables */
Scalar h__;
int i, j;
Scalar eps, temp, epsmch;
Scalar eps, temp;
int iflag;
/* Parameter adjustments */
@ -22,10 +22,7 @@ int ei_fdjac2(minpack_func_mn fcn, void *p, int m, int n, Scalar *x,
fjac -= fjac_offset;
/* Function Body */
/* epsmch is the machine precision. */
epsmch = epsilon<Scalar>();
const Scalar epsmch = epsilon<Scalar>();
eps = ei_sqrt((std::max(epsfcn,epsmch)));
for (j = 1; j <= n; ++j) {

View File

@ -15,7 +15,7 @@ void ei_lmpar(int n, Scalar *r__, int ldr,
int jm1, jp1;
Scalar sum, parc, parl;
int iter;
Scalar temp, paru, dwarf;
Scalar temp, paru;
int nsing;
Scalar gnorm;
Scalar dxnorm;
@ -33,10 +33,7 @@ void ei_lmpar(int n, Scalar *r__, int ldr,
r__ -= r_offset;
/* Function Body */
/* dwarf is the smallest positive magnitude. */
dwarf = std::numeric_limits<Scalar>::min();
const Scalar dwarf = std::numeric_limits<Scalar>::min();
/* compute and store in x the gauss-newton direction. if the */
/* jacobian is rank-deficient, obtain a least squares solution. */

View File

@ -13,7 +13,6 @@ void ei_qrfac(int m, int n, Scalar *a, int
int kmax;
Scalar temp;
int minmn;
Scalar epsmch;
Scalar ajnorm;
/* Parameter adjustments */
@ -26,10 +25,7 @@ void ei_qrfac(int m, int n, Scalar *a, int
--ipvt;
/* Function Body */
/* epsmch is the machine precision. */
epsmch = epsilon<Scalar>();
const Scalar epsmch = epsilon<Scalar>();
/* compute the initial column norms and initialize several arrays. */

View File

@ -6,7 +6,7 @@ void ei_r1updt(int m, int n, Scalar *s, int /* ls */, const Scalar *u, Scalar *v
int i, j, l, jj, nm1;
Scalar tan__;
int nmj;
Scalar cos__, sin__, tau, temp, giant, cotan;
Scalar cos__, sin__, tau, temp, cotan;
/* Parameter adjustments */
--w;
@ -15,10 +15,7 @@ void ei_r1updt(int m, int n, Scalar *s, int /* ls */, const Scalar *u, Scalar *v
--s;
/* Function Body */
/* giant is the largest magnitude. */
giant = std::numeric_limits<Scalar>::max();
const Scalar giant = std::numeric_limits<Scalar>::max();
/* initialize the diagonal element pointer. */