diff liboctave/LSODE.cc @ 4231:1032fb9ec0d1

[project @ 2002-12-19 19:58:29 by jwe]
author jwe
date Thu, 19 Dec 2002 19:59:13 +0000
parents 5719210fff4c
children 6f3382e08a52
line wrap: on
line diff
--- a/liboctave/LSODE.cc	Thu Dec 19 05:28:02 2002 +0000
+++ b/liboctave/LSODE.cc	Thu Dec 19 19:59:13 2002 +0000
@@ -123,8 +123,12 @@
 
       nn = n;
 
+      int max_maxord = 0;
+
       if (integration_method () == "stiff")
 	{
+	  max_maxord = 5;
+
 	  if (jac)
 	    method_flag = 21;
 	  else
@@ -135,12 +139,32 @@
 	}
       else
 	{
+	  max_maxord = 12;
+
 	  method_flag = 10;
 
 	  liw = 20;
 	  lrw = 22 + 16 * n;
 	}
 
+      maxord = maximum_order ();
+
+      if (maxord >= 0)
+	{
+	  if (maxord > 0 && maxord <= max_maxord)
+	    {
+	      iwork(4) = maxord;
+	      iopt = 1;
+	    }	  
+	  else
+	    {
+	      (*current_liboctave_error_handler)
+		("lsode: invalid value for maximum order");
+	      integration_error = true;
+	      return retval;
+	    }
+	}
+
       iwork.resize (liw);
 
       for (int i = 4; i < 9; i++)