diff liboctave/DASSL.cc @ 3998:f6df65db67f9

[project @ 2002-07-24 18:10:39 by jwe]
author jwe
date Wed, 24 Jul 2002 18:10:40 +0000
parents d4091aff6468
children 6fae69a1796e
line wrap: on
line diff
--- a/liboctave/DASSL.cc
+++ b/liboctave/DASSL.cc
@@ -44,7 +44,7 @@
 extern "C"
 int F77_FUNC (ddassl, DDASSL) (dassl_fcn_ptr, const int&, double&,
 			       double*, double*, double&, const int*,
-			       const double&, const double&, int&,
+			       const double*, const double*, int&,
 			       double*, const int&, int*, const int&,
 			       const double*, const int*,
 			       dassl_jac_ptr);
@@ -214,8 +214,28 @@
   else
     info.elem (3) = 0;
 
-  double abs_tol = absolute_tolerance ();
-  double rel_tol = relative_tolerance ();
+  Array<double> abs_tol = absolute_tolerance ();
+  Array<double> rel_tol = relative_tolerance ();
+
+  int abs_tol_len = abs_tol.length ();
+  int rel_tol_len = rel_tol.length ();
+
+  if (abs_tol_len == 1 && rel_tol_len == 1)
+    {
+      info.elem (1) = 0;
+    }
+  else if (abs_tol_len == n && rel_tol_len == n)
+    {
+      info.elem (1) = 1;
+    }
+  else
+    {
+      (*current_liboctave_error_handler)
+	("dassl: inconsistent sizes for tolerance arrays");
+
+      integration_error = true;
+      return retval;
+    }
 
   if (initial_step_size () >= 0.0)
     {
@@ -239,11 +259,13 @@
   int *pinfo = info.fortran_vec ();
   int *piwork = iwork.fortran_vec ();
   double *prwork = rwork.fortran_vec ();
+  double *pabs_tol = abs_tol.fortran_vec ();
+  double *prel_tol = rel_tol.fortran_vec ();
 
 // again:
 
   F77_XFCN (ddassl, DDASSL, (ddassl_f, n, t, px, pxdot, tout, pinfo,
-			     rel_tol, abs_tol, istate, prwork, lrw,
+			     prel_tol, pabs_tol, istate, prwork, lrw,
 			     piwork, liw, dummy, idummy, ddassl_j));
 
   if (f77_exception_encountered)