diff libinterp/dldfcn/__ode15__.cc @ 23022:305cdc1d444b

* __ode15__.cc: Disable sparse jacobian handling if IDAKLU is missing.
author John W. Eaton <jwe@octave.org>
date Sat, 07 Jan 2017 20:00:05 -0500
parents eb064b1b4269
children a6a7b054e4ba
line wrap: on
line diff
--- a/libinterp/dldfcn/__ode15__.cc	Sat Jan 07 18:42:35 2017 -0500
+++ b/libinterp/dldfcn/__ode15__.cc	Sat Jan 07 20:00:05 2017 -0500
@@ -40,6 +40,9 @@
 #  if defined (HAVE_IDA_IDA_H)
 #    include <ida/ida.h>
 #    include <ida/ida_dense.h>
+#  endif
+
+#  if defined (HAVE_IDA_IDA_KLU_H)
 #    include <ida/ida_klu.h>
 #    include <sundials/sundials_sparse.h>
 #  endif
@@ -205,6 +208,7 @@
     jacdense_impl (long int Neq, realtype t, realtype cj,
                    N_Vector& yy, N_Vector& yyp, DlsMat& JJ);
 
+#  if defined (HAVE_SUNDIALS_IDAKLU)
     static int
     jacsparse (realtype t, realtype cj, N_Vector yy, N_Vector yyp,
                N_Vector, SlsMat Jac, void *user_data, N_Vector,
@@ -218,6 +222,7 @@
     void
     jacsparse_impl (realtype t, realtype cj, N_Vector& yy,
                     N_Vector& yyp, SlsMat& Jac);
+#endif
 
     void set_maxstep (realtype maxstep);
 
@@ -316,10 +321,14 @@
   {
     if (havejacsparse)
       {
+#  if defined (HAVE_SUNDIALS_IDAKLU)
         if (IDAKLU (mem, num, num*num, CSC_MAT) != 0)
           error ("IDAKLU solver not initialized");
 
         IDASlsSetSparseJacFn (mem, IDA::jacsparse);
+#  else
+        error ("IDAKLU is not available in this version of Octave");
+#  endif
       }
     else
       {
@@ -356,6 +365,7 @@
     END_INTERRUPT_WITH_EXCEPTIONS;
   }
 
+#  if defined (HAVE_SUNDIALS_IDAKLU)
   void
   IDA::jacsparse_impl (realtype t, realtype cj, N_Vector& yy, N_Vector& yyp,
                        SlsMat& Jac)
@@ -389,6 +399,7 @@
 
     END_INTERRUPT_WITH_EXCEPTIONS;
   }
+#endif
 
   ColumnVector
   IDA::NVecToCol (N_Vector& v, long int n)