Mercurial > octave
diff liboctave/Quad.cc @ 260:74d73a4b3fc7
[project @ 1993-12-14 23:57:42 by jwe]
author | jwe |
---|---|
date | Tue, 14 Dec 1993 23:59:04 +0000 |
parents | 780cbbc57b7c |
children | c23f50e61c58 |
line wrap: on
line diff
--- a/liboctave/Quad.cc Tue Dec 14 22:21:35 1993 +0000 +++ b/liboctave/Quad.cc Tue Dec 14 23:59:04 1993 +0000 @@ -31,15 +31,21 @@ static integrand_fcn user_fcn; +// XXX FIXME XXX -- would be nice to not have to have this global +// variable. +// Nonzero means an error occurred in the calculation of the integrand +// function, and the user wants us to quit. +int quad_integration_error = 0; + extern "C" { - int F77_FCN (dqagp) (const double (*)(double*), const double*, + int F77_FCN (dqagp) (const double (*)(double*, int*), const double*, const double*, const int*, const double*, const double*, const double*, double*, double*, int*, int*, const int*, const int*, int*, int*, double*); - int F77_FCN (dqagi) (const double (*)(double*), const double*, + int F77_FCN (dqagi) (const double (*)(double*, int*), const double*, const int*, const double*, const double*, double*, double*, int*, int*, const int*, const int*, int*, int*, double*); @@ -83,7 +89,7 @@ } static double -user_function (double *x) +user_function (double *x, int *ierr) { #if defined (sun) && defined (__GNUC__) double xx = access_double (x); @@ -91,7 +97,14 @@ double xx = *x; #endif - return (*user_fcn) (xx); + quad_integration_error = 0; + + double retval = (*user_fcn) (xx); + + if (quad_integration_error) + *ierr = -1; + + return retval; } DefQuad::DefQuad (integrand_fcn fcn) : Quad (fcn)