Mercurial > hg > octave-terminal
changeset 1935:23c350d0cf9d
[project @ 1996-02-12 04:03:05 by jwe]
author | jwe |
---|---|
date | Mon, 12 Feb 1996 04:03:05 +0000 |
parents | 0e591d443ff0 |
children | 49f93fba6871 |
files | liboctave/Quad.cc |
diffstat | 1 files changed, 25 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/Quad.cc +++ b/liboctave/Quad.cc @@ -82,23 +82,28 @@ int npts = singularities.capacity () + 2; double *points = singularities.fortran_vec (); double result = 0.0; + int leniw = 183*npts - 122; + Array<int> iwork (leniw); + int *piwork = iwork.fortran_vec (); + int lenw = 2*leniw - npts; - int *iwork = new int [leniw]; - double *work = new double [lenw]; + Array<double> work (lenw); + double *pwork = work.fortran_vec (); + user_fcn = f; int last; double abs_tol = absolute_tolerance (); double rel_tol = relative_tolerance (); - F77_FCN (dqagp, DQAGP) (user_function, lower_limit, upper_limit, - npts, points, abs_tol, rel_tol, result, - abserr, neval, ier, leniw, lenw, last, - iwork, work); + F77_XFCN (dqagp, DQAGP, (user_function, lower_limit, upper_limit, + npts, points, abs_tol, rel_tol, result, + abserr, neval, ier, leniw, lenw, last, + piwork, pwork)); - delete [] iwork; - delete [] work; + if (f77_exception_encountered) + (*current_liboctave_error_handler) ("unrecoverable error in dqagp"); return result; } @@ -107,10 +112,15 @@ IndefQuad::integrate (int& ier, int& neval, double& abserr) { double result = 0.0; + int leniw = 128; + Array<int> iwork (leniw); + int *piwork = iwork.fortran_vec (); + int lenw = 8*leniw; - int *iwork = new int [leniw]; - double *work = new double [lenw]; + Array<double> work (lenw); + double *pwork = work.fortran_vec (); + user_fcn = f; int last; @@ -137,12 +147,12 @@ double abs_tol = absolute_tolerance (); double rel_tol = relative_tolerance (); - F77_FCN (dqagi, DQAGI) (user_function, bound, inf, abs_tol, rel_tol, - result, abserr, neval, ier, leniw, lenw, - last, iwork, work); + F77_XFCN (dqagi, DQAGI, (user_function, bound, inf, abs_tol, rel_tol, + result, abserr, neval, ier, leniw, lenw, + last, piwork, pwork)); - delete [] iwork; - delete [] work; + if (f77_exception_encountered) + (*current_liboctave_error_handler) ("unrecoverable error in dqagi"); return result; }