diff liboctave/DASPK.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/DASPK.cc
+++ b/liboctave/DASPK.cc
@@ -53,7 +53,7 @@
 extern "C"
 int F77_FUNC (ddaspk, DDASPK) (daspk_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*,
 			      daspk_jac_ptr, daspk_psol_ptr);
@@ -240,8 +240,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)
     {
@@ -265,11 +285,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 (ddaspk, DDASPK, (ddaspk_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, ddaspk_j,
 			     ddaspk_psol));