use math function adapted to the Scalar type instead of hardcoding float or

double
This commit is contained in:
Thomas Capricelli 2009-08-21 00:04:41 +02:00
parent d05af200a5
commit 054652b789
6 changed files with 16 additions and 16 deletions

View File

@ -15,7 +15,7 @@ void ei_chkder(
{
const Scalar eps = ei_sqrt(epsilon<Scalar>());
const Scalar epsf = chkder_factor * epsilon<Scalar>();
const Scalar epslog = chkder_log10e * log(eps);
const Scalar epslog = chkder_log10e * ei_log(eps);
Scalar temp;
int i,j;
@ -52,7 +52,7 @@ void ei_chkder(
}
err[i] = 1.;
if (temp > epsilon<Scalar>() && temp < eps) {
err[i] = (chkder_log10e * log(temp) - epslog) / epslog;
err[i] = (chkder_log10e * ei_log(temp) - epslog) / epslog;
}
if (temp >= eps) {
err[i] = 0.;

View File

@ -295,7 +295,7 @@ L230:
++ncsuc;
if (ratio >= p5 || ncsuc > 1) /* Computing MAX */
delta = max(delta, pnorm / p5);
if (fabs(ratio - 1.) <= p1) {
if (ei_abs(ratio - 1.) <= p1) {
delta = pnorm / p5;
}
L240:

View File

@ -289,7 +289,7 @@ L230:
++ncsuc;
if (ratio >= p5 || ncsuc > 1) /* Computing MAX */
delta = max(delta, pnorm / p5);
if (fabs(ratio - 1.) <= p1) {
if (ei_abs(ratio - 1.) <= p1) {
delta = pnorm / p5;
}
L240:

View File

@ -182,7 +182,7 @@ L120:
/* L140: */
}
/* Computing MAX */
gnorm = max(gnorm, fabs(sum / wa2[l]));
gnorm = max(gnorm, ei_abs(sum / wa2[l]));
L150:
/* L160: */
;
@ -325,13 +325,13 @@ L290:
/* tests for convergence. */
if (fabs(actred) <= ftol && prered <= ftol && p5 * ratio <= 1.) {
if (ei_abs(actred) <= ftol && prered <= ftol && p5 * ratio <= 1.) {
info = 1;
}
if (delta <= xtol * xnorm) {
info = 2;
}
if (fabs(actred) <= ftol && prered <= ftol && p5 * ratio <= 1. && info
if (ei_abs(actred) <= ftol && prered <= ftol && p5 * ratio <= 1. && info
== 2) {
info = 3;
}
@ -344,7 +344,7 @@ L290:
if (*nfev >= maxfev) {
info = 5;
}
if (fabs(actred) <= epsilon<Scalar>() && prered <= epsilon<Scalar>() && p5 * ratio <= 1.) {
if (ei_abs(actred) <= epsilon<Scalar>() && prered <= epsilon<Scalar>() && p5 * ratio <= 1.) {
info = 6;
}
if (delta <= epsilon<Scalar>() * xnorm) {

View File

@ -184,7 +184,7 @@ L120:
/* L140: */
}
/* Computing MAX */
gnorm = max(gnorm, fabs(sum / wa2[l]));
gnorm = max(gnorm, ei_abs(sum / wa2[l]));
L150:
/* L160: */
;
@ -327,13 +327,13 @@ L290:
/* tests for convergence. */
if (fabs(actred) <= ftol && prered <= ftol && p5 * ratio <= 1.) {
if (ei_abs(actred) <= ftol && prered <= ftol && p5 * ratio <= 1.) {
info = 1;
}
if (delta <= xtol * xnorm) {
info = 2;
}
if (fabs(actred) <= ftol && prered <= ftol && p5 * ratio <= 1. && info
if (ei_abs(actred) <= ftol && prered <= ftol && p5 * ratio <= 1. && info
== 2) {
info = 3;
}
@ -346,7 +346,7 @@ L290:
if (*nfev >= maxfev) {
info = 5;
}
if (fabs(actred) <= epsilon<Scalar>() && prered <= epsilon<Scalar>() && p5 * ratio <= 1.) {
if (ei_abs(actred) <= epsilon<Scalar>() && prered <= epsilon<Scalar>() && p5 * ratio <= 1.) {
info = 6;
}
if (delta <= epsilon<Scalar>() * xnorm) {

View File

@ -206,7 +206,7 @@ L170:
/* L180: */
}
/* Computing MAX */
gnorm = max(gnorm, abs(sum/wa2[l]));
gnorm = max(gnorm, ei_abs(sum/wa2[l]));
L190:
/* L200: */
;
@ -350,13 +350,13 @@ L330:
/* tests for convergence. */
if (abs(actred) <= ftol && prered <= ftol && p5 * ratio <= 1.) {
if (ei_abs(actred) <= ftol && prered <= ftol && p5 * ratio <= 1.) {
info = 1;
}
if (delta <= xtol * xnorm) {
info = 2;
}
if (abs(actred) <= ftol && prered <= ftol && p5 * ratio <= 1. && info
if (ei_abs(actred) <= ftol && prered <= ftol && p5 * ratio <= 1. && info
== 2) {
info = 3;
}
@ -369,7 +369,7 @@ L330:
if (*nfev >= maxfev) {
info = 5;
}
if (abs(actred) <= epsilon<Scalar>() && prered <= epsilon<Scalar>() && p5 * ratio <= 1.) {
if (ei_abs(actred) <= epsilon<Scalar>() && prered <= epsilon<Scalar>() && p5 * ratio <= 1.) {
info = 6;
}
if (delta <= epsilon<Scalar>() * xnorm) {