diff liboctave/DASPK.cc @ 5275:23b37da9fd5b

[project @ 2005-04-08 16:07:35 by jwe]
author jwe
date Fri, 08 Apr 2005 16:07:37 +0000
parents e35b034d3523
children 4c8a2e4e0717
line wrap: on
line diff
--- a/liboctave/DASPK.cc	Thu Apr 07 21:51:37 2005 +0000
+++ b/liboctave/DASPK.cc	Fri Apr 08 16:07:37 2005 +0000
@@ -33,39 +33,39 @@
 #include "lo-sstream.h"
 #include "quit.h"
 
-typedef int (*daspk_fcn_ptr) (const double&, const double*,
+typedef octave_idx_type (*daspk_fcn_ptr) (const double&, const double*,
 			      const double*, const double&,
-			      double*, int&, double*, int*);
+			      double*, octave_idx_type&, double*, octave_idx_type*);
 
-typedef int (*daspk_jac_ptr) (const double&, const double*,
+typedef octave_idx_type (*daspk_jac_ptr) (const double&, const double*,
 			      const double*, double*,
-			      const double&, double*, int*);
+			      const double&, double*, octave_idx_type*);
 
-typedef int (*daspk_psol_ptr) (const int&, const double&,
+typedef octave_idx_type (*daspk_psol_ptr) (const octave_idx_type&, const double&,
 			       const double*, const double*,
 			       const double*, const double&,
-			       const double*, double*, int*,
-			       double*, const double&, int&,
-			       double*, int*);
+			       const double*, double*, octave_idx_type*,
+			       double*, const double&, octave_idx_type&,
+			       double*, octave_idx_type*);
 
 extern "C"
 {
   F77_RET_T
-  F77_FUNC (ddaspk, DDASPK) (daspk_fcn_ptr, const int&, double&,
-			     double*, double*, double&, const int*,
-			     const double*, const double*, int&,
-			     double*, const int&, int*, const int&,
-			     const double*, const int*,
+  F77_FUNC (ddaspk, DDASPK) (daspk_fcn_ptr, const octave_idx_type&, double&,
+			     double*, double*, double&, const octave_idx_type*,
+			     const double*, const double*, octave_idx_type&,
+			     double*, const octave_idx_type&, octave_idx_type*, const octave_idx_type&,
+			     const double*, const octave_idx_type*,
 			     daspk_jac_ptr, daspk_psol_ptr);
 }
 
 static DAEFunc::DAERHSFunc user_fun;
 static DAEFunc::DAEJacFunc user_jac;
-static int nn;
+static octave_idx_type nn;
 
-static int
+static octave_idx_type
 ddaspk_f (const double& time, const double *state, const double *deriv,
-	  const double&, double *delta, int& ires, double *, int *)
+	  const double&, double *delta, octave_idx_type& ires, double *, octave_idx_type *)
 {
   BEGIN_INTERRUPT_WITH_EXCEPTIONS;
 
@@ -73,7 +73,7 @@
   ColumnVector tmp_state (nn);
   ColumnVector tmp_delta (nn);
 
-  for (int i = 0; i < nn; i++)
+  for (octave_idx_type i = 0; i < nn; i++)
     {
       tmp_deriv.elem (i) = deriv [i];
       tmp_state.elem (i) = state [i];
@@ -87,7 +87,7 @@
 	ires = -2;
       else
 	{
-	  for (int i = 0; i < nn; i++)
+	  for (octave_idx_type i = 0; i < nn; i++)
 	    delta [i] = tmp_delta.elem (i);
 	}
     }
@@ -100,11 +100,11 @@
 //NEQ, T, Y, YPRIME, SAVR, WK, CJ, WGHT,
 //C                          WP, IWP, B, EPLIN, IER, RPAR, IPAR)
 
-static int
-ddaspk_psol (const int&, const double&, const double *,
+static octave_idx_type
+ddaspk_psol (const octave_idx_type&, const double&, const double *,
 	     const double *, const double *, const double&,
-	     const double *, double *, int *, double *,
-	     const double&, int&, double *, int*)
+	     const double *, double *, octave_idx_type *, double *,
+	     const double&, octave_idx_type&, double *, octave_idx_type*)
 {
   BEGIN_INTERRUPT_WITH_EXCEPTIONS;
 
@@ -116,9 +116,9 @@
 }
 
 
-static int
+static octave_idx_type
 ddaspk_j (const double& time, const double *state, const double *deriv,
-	  double *pd, const double& cj, double *, int *)
+	  double *pd, const double& cj, double *, octave_idx_type *)
 {
   BEGIN_INTERRUPT_WITH_EXCEPTIONS;
 
@@ -127,7 +127,7 @@
   ColumnVector tmp_state (nn);
   ColumnVector tmp_deriv (nn);
 
-  for (int i = 0; i < nn; i++)
+  for (octave_idx_type i = 0; i < nn; i++)
     {
       tmp_deriv.elem (i) = deriv [i];
       tmp_state.elem (i) = state [i];
@@ -135,8 +135,8 @@
 
   Matrix tmp_pd = user_jac (tmp_state, tmp_deriv, time, cj);
 
-  for (int j = 0; j < nn; j++)
-    for (int i = 0; i < nn; i++)
+  for (octave_idx_type j = 0; j < nn; j++)
+    for (octave_idx_type i = 0; i < nn; i++)
       pd [nn * j + i] = tmp_pd.elem (i, j);
 
   END_INTERRUPT_WITH_EXCEPTIONS;
@@ -160,12 +160,12 @@
 
       info.resize (20);
 
-      for (int i = 0; i < 20; i++)
+      for (octave_idx_type i = 0; i < 20; i++)
 	info(i) = 0;
 
       pinfo = info.fortran_vec ();
 
-      int n = size ();
+      octave_idx_type n = size ();
 
       nn = n;
 
@@ -189,7 +189,7 @@
 
       if (user_fun)
 	{
-	  int ires = 0;
+	  octave_idx_type ires = 0;
 
 	  ColumnVector res = (*user_fun) (x, xdot, t, ires);
 
@@ -215,9 +215,9 @@
 
       DAEFunc::reset = false;
 
-      int eiq = enforce_inequality_constraints ();
-      int ccic = compute_consistent_initial_condition ();
-      int eavfet = exclude_algebraic_variables_from_error_test ();
+      octave_idx_type eiq = enforce_inequality_constraints ();
+      octave_idx_type ccic = compute_consistent_initial_condition ();
+      octave_idx_type eavfet = exclude_algebraic_variables_from_error_test ();
 
       liw = 40 + n;
       if (eiq == 1 || eiq == 3)
@@ -240,8 +240,8 @@
       abs_tol = absolute_tolerance ();
       rel_tol = relative_tolerance ();
 
-      int abs_tol_len = abs_tol.length ();
-      int rel_tol_len = rel_tol.length ();
+      octave_idx_type abs_tol_len = abs_tol.length ();
+      octave_idx_type rel_tol_len = rel_tol.length ();
 
       if (abs_tol_len == 1 && rel_tol_len == 1)
 	{
@@ -281,7 +281,7 @@
       else
 	info(7) = 0;
 
-      int maxord = maximum_order ();
+      octave_idx_type maxord = maximum_order ();
       if (maxord >= 0)
 	{
 	  if (maxord > 0 && maxord < 6)
@@ -303,13 +303,13 @@
 	case 1:
 	case 3:
 	  {
-	    Array<int> ict = inequality_constraint_types ();
+	    Array<octave_idx_type> ict = inequality_constraint_types ();
 
 	    if (ict.length () == n)
 	      {
-		for (int i = 0; i < n; i++)
+		for (octave_idx_type i = 0; i < n; i++)
 		  {
-		    int val = ict(i);
+		    octave_idx_type val = ict(i);
 		    if (val < -2 || val > 2)
 		      {
 			(*current_liboctave_error_handler)
@@ -348,11 +348,11 @@
 	    {
 	      // XXX FIXME XXX -- this code is duplicated below.
 
-	      Array<int> av = algebraic_variables ();
+	      Array<octave_idx_type> av = algebraic_variables ();
 
 	      if (av.length () == n)
 		{
-		  int lid;
+		  octave_idx_type lid;
 		  if (eiq == 0 || eiq == 2)
 		    lid = 40;
 		  else if (eiq == 1 || eiq == 3)
@@ -360,7 +360,7 @@
 		  else
 		    abort ();
 
-		  for (int i = 0; i < n; i++)
+		  for (octave_idx_type i = 0; i < n; i++)
 		    iwork(lid+i) = av(i) ? -1 : 1;
 		}
 	      else
@@ -388,11 +388,11 @@
 
 	  // XXX FIXME XXX -- this code is duplicated above.
 
-	  Array<int> av = algebraic_variables ();
+	  Array<octave_idx_type> av = algebraic_variables ();
 
 	  if (av.length () == n)
 	    {
-	      int lid;
+	      octave_idx_type lid;
 	      if (eiq == 0 || eiq == 2)
 		lid = 40;
 	      else if (eiq == 1 || eiq == 3)
@@ -400,7 +400,7 @@
 	      else
 		abort ();
 
-	      for (int i = 0; i < n; i++)
+	      for (octave_idx_type i = 0; i < n; i++)
 		iwork(lid+i) = av(i) ? -1 : 1;
 	    }
 	}
@@ -411,10 +411,10 @@
 
 	  if (ich.length () == 6)
 	    {
-	      iwork(31) = NINT (ich(0));
-	      iwork(32) = NINT (ich(1));
-	      iwork(33) = NINT (ich(2));
-	      iwork(34) = NINT (ich(3));
+	      iwork(31) = NINTbig (ich(0));
+	      iwork(32) = NINTbig (ich(1));
+	      iwork(33) = NINTbig (ich(2));
+	      iwork(34) = NINTbig (ich(3));
 
 	      rwork(13) = ich(4);
 	      rwork(14) = ich(5);
@@ -430,7 +430,7 @@
 	  info(16) = 1;
 	}
 
-      int pici = print_initial_condition_info ();
+      octave_idx_type pici = print_initial_condition_info ();
       switch (pici)
 	{
 	case 0:
@@ -453,7 +453,7 @@
     }
 
   static double *dummy = 0;
-  static int *idummy = 0;
+  static octave_idx_type *idummy = 0;
 
   F77_XFCN (ddaspk, DDASPK, (ddaspk_f, nn, t, px, pxdot, tout, pinfo,
 			     prel_tol, pabs_tol, istate, prwork, lrw,
@@ -538,28 +538,28 @@
 {
   Matrix retval;
 
-  int n_out = tout.capacity ();
-  int n = size ();
+  octave_idx_type n_out = tout.capacity ();
+  octave_idx_type n = size ();
 
   if (n_out > 0 && n > 0)
     {
       retval.resize (n_out, n);
       xdot_out.resize (n_out, n);
 
-      for (int i = 0; i < n; i++)
+      for (octave_idx_type i = 0; i < n; i++)
 	{
 	  retval.elem (0, i) = x.elem (i);
 	  xdot_out.elem (0, i) = xdot.elem (i);
 	}
 
-      for (int j = 1; j < n_out; j++)
+      for (octave_idx_type j = 1; j < n_out; j++)
 	{
 	  ColumnVector x_next = do_integrate (tout.elem (j));
 
 	  if (integration_error)
 	    return retval;
 
-	  for (int i = 0; i < n; i++)
+	  for (octave_idx_type i = 0; i < n; i++)
 	    {
 	      retval.elem (j, i) = x_next.elem (i);
 	      xdot_out.elem (j, i) = xdot.elem (i);
@@ -583,26 +583,26 @@
 {
   Matrix retval;
 
-  int n_out = tout.capacity ();
-  int n = size ();
+  octave_idx_type n_out = tout.capacity ();
+  octave_idx_type n = size ();
 
   if (n_out > 0 && n > 0)
     {
       retval.resize (n_out, n);
       xdot_out.resize (n_out, n);
 
-      for (int i = 0; i < n; i++)
+      for (octave_idx_type i = 0; i < n; i++)
 	{
 	  retval.elem (0, i) = x.elem (i);
 	  xdot_out.elem (0, i) = xdot.elem (i);
 	}
 
-      int n_crit = tcrit.capacity ();
+      octave_idx_type n_crit = tcrit.capacity ();
 
       if (n_crit > 0)
 	{
-	  int i_crit = 0;
-	  int i_out = 1;
+	  octave_idx_type i_crit = 0;
+	  octave_idx_type i_out = 1;
 	  double next_crit = tcrit.elem (0);
 	  double next_out;
 	  while (i_out < n_out)
@@ -658,7 +658,7 @@
 
 	      if (save_output)
 		{
-		  for (int i = 0; i < n; i++)
+		  for (octave_idx_type i = 0; i < n; i++)
 		    {
 		      retval.elem (i_out-1, i) = x_next.elem (i);
 		      xdot_out.elem (i_out-1, i) = xdot.elem (i);