26 #if defined (HAVE_CONFIG_H)
46 #if defined (HAVE_SUNDIALS)
48 # if defined (HAVE_NVECTOR_NVECTOR_SERIAL_H)
49 # include <nvector/nvector_serial.h>
52 # if defined (HAVE_IDA_IDA_H)
54 # elif defined (HAVE_IDA_H)
57 # if defined (HAVE_IDA_IDA_DIRECT_H)
58 # include <ida/ida_direct.h>
59 # elif defined (HAVE_IDA_DIRECT_H)
60 # include <ida_direct.h>
63 # if defined (HAVE_SUNLINSOL_SUNLINSOL_DENSE_H)
64 # include <sunlinsol/sunlinsol_dense.h>
67 # if defined (HAVE_SUNLINSOL_SUNLINSOL_KLU_H)
68 # if defined (HAVE_KLU_H)
71 # if defined (HAVE_KLU_KLU_H)
74 # if defined (HAVE_SUITESPARSE_KLU_H)
75 # include <suitesparse/klu.h>
77 # if defined (HAVE_UFPARSE_KLU_H)
78 # include <ufsparse/klu.h>
80 # include <sunlinsol/sunlinsol_klu.h>
87 #if defined (HAVE_SUNDIALS)
89 # if ! defined (HAVE_IDASETJACFN) && defined (HAVE_IDADLSSETJACFN)
91 IDASetJacFn (
void *ida_mem, IDADlsJacFn jac)
93 return IDADlsSetJacFn (ida_mem, jac);
97 # if ! defined (HAVE_IDASETLINEARSOLVER) && defined (HAVE_IDADLSSETLINEARSOLVER)
99 IDASetLinearSolver (
void *ida_mem, SUNLinearSolver LS, SUNMatrix
A)
101 return IDADlsSetLinearSolver (ida_mem, LS,
A);
105 # if ! defined (HAVE_SUNLINSOL_DENSE) && defined (HAVE_SUNDENSELINEARSOLVER)
106 static inline SUNLinearSolver
107 SUNLinSol_Dense (N_Vector y, SUNMatrix
A)
109 return SUNDenseLinearSolver (y,
A);
113 # if defined (HAVE_SUNDIALS_SUNLINSOL_KLU)
114 # if ! defined (HAVE_SUNLINSOL_KLU) && defined (HAVE_SUNKLU)
115 static inline SUNLinearSolver
116 SUNLinSol_KLU (N_Vector y, SUNMatrix
A)
118 return SUNKLU (y,
A);
123 static inline realtype *
124 nv_data_s (N_Vector& v)
126 # if defined (HAVE_PRAGMA_GCC_DIAGNOSTIC)
130 # pragma GCC diagnostic push
131 # pragma GCC diagnostic ignored "-Wold-style-cast"
134 return NV_DATA_S (v);
136 # if defined (HAVE_PRAGMA_GCC_DIAGNOSTIC)
138 # pragma GCC diagnostic pop
159 realtype t, realtype cj,
172 : m_t0 (0.0), m_y0 (), m_yp0 (), m_havejac (false), m_havejacfcn (false),
173 m_havejacsparse (false), m_mem (nullptr), m_num (), m_ida_fcn (),
174 m_ida_jac (), m_dfdy (nullptr), m_dfdyp (nullptr), m_spdfdy (nullptr),
175 m_spdfdyp (nullptr), m_fcn (nullptr), m_jacfcn (nullptr),
176 m_jacspfcn (nullptr), m_jacdcell (nullptr), m_jacspcell (nullptr),
177 m_sunJacMatrix (nullptr), m_sunLinearSolver (nullptr)
183 : m_t0 (t), m_y0 (y), m_yp0 (yp), m_havejac (false), m_havejacfcn (false),
184 m_havejacsparse (false), m_mem (nullptr), m_num (), m_ida_fcn (ida_fcn),
185 m_ida_jac (), m_dfdy (nullptr), m_dfdyp (nullptr), m_spdfdy (nullptr),
186 m_spdfdyp (nullptr), m_fcn (daefun), m_jacfcn (nullptr),
187 m_jacspfcn (nullptr), m_jacdcell (nullptr), m_jacspcell (nullptr),
188 m_sunJacMatrix (nullptr), m_sunLinearSolver (nullptr)
195 SUNLinSolFree (m_sunLinearSolver);
196 SUNMatDestroy (m_sunJacMatrix);
197 # if defined (HAVE_SUNDIALS_SUNCONTEXT)
198 SUNContext_Free (&m_sunContext);
203 set_jacobian (
const octave_value& jac, DAEJacFuncDense j)
209 m_havejacsparse =
false;
215 set_jacobian (
const octave_value& jac, DAEJacFuncSparse j)
221 m_havejacsparse =
true;
227 set_jacobian (
Matrix *dy,
Matrix *dyp, DAEJacCellDense j)
233 m_havejacfcn =
false;
234 m_havejacsparse =
false;
247 m_havejacfcn =
false;
248 m_havejacsparse =
true;
253 void set_userdata (
void);
257 static ColumnVector NVecToCol (N_Vector& v, octave_f77_int_type
n);
259 # if defined (HAVE_SUNDIALS_SUNCONTEXT)
260 N_Vector ColToNVec (
const ColumnVector& data, octave_f77_int_type
n);
262 static N_Vector ColToNVec (
const ColumnVector& data, octave_f77_int_type
n);
272 set_tolerance (realtype abstol, realtype reltol);
275 resfun (realtype t, N_Vector yy, N_Vector yyp,
276 N_Vector rr,
void *user_data);
279 resfun_impl (realtype t, N_Vector& yy,
280 N_Vector& yyp, N_Vector& rr);
282 jacdense (realtype t, realtype cj, N_Vector yy, N_Vector yyp,
283 N_Vector, SUNMatrix JJ,
void *user_data, N_Vector,
286 IDA *
self =
static_cast <IDA *
> (user_data);
287 self->jacdense_impl (t, cj, yy, yyp, JJ);
292 jacdense_impl (realtype t, realtype cj,
293 N_Vector& yy, N_Vector& yyp, SUNMatrix& JJ);
295 # if defined (HAVE_SUNDIALS_SUNLINSOL_KLU)
297 jacsparse (realtype t, realtype cj, N_Vector yy, N_Vector yyp,
298 N_Vector, SUNMatrix Jac,
void *user_data, N_Vector,
301 IDA *
self =
static_cast <IDA *
> (user_data);
302 self->jacsparse_impl (t, cj, yy, yyp, Jac);
307 jacsparse_impl (realtype t, realtype cj,
308 N_Vector& yy, N_Vector& yyp, SUNMatrix& Jac);
311 void set_maxstep (realtype maxstep);
313 void set_initialstep (realtype initialstep);
317 int refine, realtype tend,
bool haveoutputfcn,
327 outputfun (
const octave_value& output_fcn,
bool haveoutputsel,
328 const ColumnVector& output, realtype tout, realtype tend,
335 realtype tsol,
const ColumnVector& y,
const std::string& flag,
342 void set_maxorder (
int maxorder);
347 const int refine,
bool haverefine,
bool haveoutputfcn,
353 void print_stat (
void);
362 bool m_havejacsparse;
364 octave_f77_int_type m_num;
372 DAEJacFuncDense m_jacfcn;
373 DAEJacFuncSparse m_jacspfcn;
374 DAEJacCellDense m_jacdcell;
375 DAEJacCellSparse m_jacspcell;
376 # if defined (HAVE_SUNDIALS_SUNCONTEXT)
377 SUNContext m_sunContext;
379 SUNMatrix m_sunJacMatrix;
380 SUNLinearSolver m_sunLinearSolver;
384 IDA::resfun (realtype t, N_Vector yy, N_Vector yyp, N_Vector rr,
387 IDA *
self =
static_cast <IDA *
> (user_data);
388 self->resfun_impl (t, yy, yyp, rr);
393 IDA::resfun_impl (realtype t, N_Vector& yy,
394 N_Vector& yyp, N_Vector& rr)
402 realtype *puntrr = nv_data_s (rr);
408 # if defined (HAVE_SUNDIALS_SUNCONTEXT)
409 # define OCTAVE_SUNCONTEXT , m_sunContext
411 # define OCTAVE_SUNCONTEXT
417 N_Vector yy = ColToNVec (y, m_num);
421 # if defined (HAVE_SUNDIALS_SUNLINSOL_KLU)
422 # if defined (HAVE_SUNSPARSEMATRIX_REALLOCATE)
426 m_sunJacMatrix = SUNSparseMatrix (m_num, m_num, 0, CSC_MAT
429 octave_f77_int_type max_elems;
431 error (
"Unable to allocate memory for sparse Jacobian");
433 m_sunJacMatrix = SUNSparseMatrix (m_num, m_num, max_elems, CSC_MAT
436 if (! m_sunJacMatrix)
437 error (
"Unable to create sparse Jacobian for Sundials");
439 m_sunLinearSolver = SUNLinSol_KLU (yy, m_sunJacMatrix
441 if (! m_sunLinearSolver)
442 error (
"Unable to create KLU sparse solver");
444 if (IDASetLinearSolver (m_mem, m_sunLinearSolver, m_sunJacMatrix))
445 error (
"Unable to set sparse linear solver");
447 IDASetJacFn (m_mem, IDA::jacsparse);
450 error (
"SUNDIALS SUNLINSOL KLU was unavailable or disabled when "
459 m_sunJacMatrix = SUNDenseMatrix (m_num, m_num OCTAVE_SUNCONTEXT);
460 if (! m_sunJacMatrix)
461 error (
"Unable to create dense Jacobian for Sundials");
463 m_sunLinearSolver = SUNLinSol_Dense (yy, m_sunJacMatrix
465 if (! m_sunLinearSolver)
466 error (
"Unable to create dense linear solver");
468 if (IDASetLinearSolver (m_mem, m_sunLinearSolver, m_sunJacMatrix))
469 error (
"Unable to set dense linear solver");
471 if (m_havejac && IDASetJacFn (m_mem, IDA::jacdense) != 0)
472 error (
"Unable to set dense Jacobian function");
478 IDA::jacdense_impl (realtype t, realtype cj,
479 N_Vector& yy, N_Vector& yyp, SUNMatrix& JJ)
482 octave_f77_int_type Neq = NV_LENGTH_S (yy);
491 jac = (*m_jacfcn) (y, yp, t, cj, m_ida_jac);
493 jac = (*m_jacdcell) (m_dfdy, m_dfdyp, cj);
495 octave_f77_int_type num_jac = to_f77_int (jac.numel ());
496 std::copy (jac.fortran_vec (),
497 jac.fortran_vec () + num_jac,
498 SUNDenseMatrix_Data (JJ));
501 # if defined (HAVE_SUNDIALS_SUNLINSOL_KLU)
503 IDA::jacsparse_impl (realtype t, realtype cj, N_Vector& yy, N_Vector& yyp,
514 jac = (*m_jacspfcn) (y, yp, t, cj, m_ida_jac);
516 jac = (*m_jacspcell) (m_spdfdy, m_spdfdyp, cj);
518 # if defined (HAVE_SUNSPARSEMATRIX_REALLOCATE)
519 octave_f77_int_type nnz = to_f77_int (jac.nnz ());
520 if (nnz > SUNSparseMatrix_NNZ (Jac))
525 if (SUNSparseMatrix_Reallocate (Jac, nnz))
526 error (
"Unable to allocate sufficient memory for IDA sparse matrix");
530 SUNMatZero_Sparse (Jac);
533 sunindextype *colptrs = SUNSparseMatrix_IndexPointers (Jac);
534 sunindextype *rowvals = SUNSparseMatrix_IndexValues (Jac);
536 for (octave_f77_int_type i = 0; i < m_num + 1; i++)
537 colptrs[i] = to_f77_int (jac.cidx (i));
539 double *
d = SUNSparseMatrix_Data (Jac);
540 for (octave_f77_int_type i = 0; i < to_f77_int (jac.nnz ()); i++)
542 rowvals[i] = to_f77_int (jac.ridx (i));
549 IDA::NVecToCol (N_Vector& v, octave_f77_int_type
n)
552 realtype *punt = nv_data_s (v);
554 for (octave_f77_int_type i = 0; i <
n; i++)
561 IDA::ColToNVec (
const ColumnVector& data, octave_f77_int_type
n)
563 N_Vector v = N_VNew_Serial (
n OCTAVE_SUNCONTEXT);
565 realtype *punt = nv_data_s (v);
567 for (octave_f77_int_type i = 0; i <
n; i++)
574 IDA::set_userdata (
void)
576 void *userdata =
this;
578 if (IDASetUserData (m_mem, userdata) != 0)
579 error (
"User data not set");
585 m_num = to_f77_int (m_y0.numel ());
586 # if defined (HAVE_SUNDIALS_SUNCONTEXT)
587 if (SUNContext_Create (
nullptr, &m_sunContext) < 0)
588 error (
"__ode15__: unable to create context for SUNDIALS");
589 m_mem = IDACreate (m_sunContext);
591 m_mem = IDACreate ();
594 N_Vector yy = ColToNVec (m_y0, m_num);
596 N_Vector yyp = ColToNVec (m_yp0, m_num);
598 IDA::set_userdata ();
600 if (IDAInit (m_mem, IDA::resfun, m_t0, yy, yyp) != 0)
601 error (
"IDA not initialized");
605 IDA::set_tolerance (
ColumnVector& abstol, realtype reltol)
607 N_Vector abs_tol = ColToNVec (abstol, m_num);
609 if (IDASVtolerances (m_mem, reltol, abs_tol) != 0)
610 error (
"IDA: Tolerance not set");
612 N_VDestroy_Serial (abs_tol);
616 IDA::set_tolerance (realtype abstol, realtype reltol)
618 if (IDASStolerances (m_mem, reltol, abstol) != 0)
619 error (
"IDA: Tolerance not set");
625 const int refine,
bool haverefine,
bool haveoutputfcn,
637 std::string
string =
"";
640 realtype tsol = tspan(0);
641 realtype tend = tspan(numt-1);
643 N_Vector yyp = ColToNVec (yp, m_num);
645 N_Vector yy = ColToNVec (y, m_num);
649 status = IDA::outputfun (output_fcn, haveoutputsel, y,
650 tsol, tend, outputsel,
"init");
653 if (haveeventfunction)
654 status = IDA::event (event_fcn, te, ye, ie, tsol, y,
655 "init", yp, oldval, oldisterminal,
656 olddir, cont, temp, tsol, yold, num_event_args);
663 output.
resize (numt, m_num);
673 if (IDASolve (m_mem, tspan (j), &tsol, yy, yyp, IDA_NORMAL) != 0)
674 error (
"IDASolve failed");
676 yout = NVecToCol (yy, m_num);
677 ypout = NVecToCol (yyp, m_num);
681 output.
elem (j, i) = yout.elem (i);
684 status = IDA::outputfun (output_fcn, haveoutputsel, yout, tsol,
685 tend, outputsel,
string);
687 if (haveeventfunction)
688 status = IDA::event (event_fcn, te, ye, ie, tout(j), yout,
689 string, ypout, oldval, oldisterminal,
690 olddir, j, temp, tout(j-1), yold,
696 output.
resize (j + 1, m_num);
712 bool posdirection = (tend > tsol);
715 while (((posdirection == 1 && tsol < tend)
716 || (posdirection == 0 && tsol > tend))
719 if (IDASolve (m_mem, tend, &tsol, yy, yyp, IDA_ONE_STEP) != 0)
720 error (
"IDASolve failed");
723 status = IDA::interpolate (cont, output, tout, refine, tend,
724 haveoutputfcn, haveoutputsel,
725 output_fcn, outputsel,
726 haveeventfunction, event_fcn, te,
727 ye, ie, oldval, oldisterminal,
731 ypout = NVecToCol (yyp, m_num);
733 output.
resize (cont + 1, m_num);
736 yout = NVecToCol (yy, m_num);
739 output.
elem (cont, i) = yout.elem (i);
741 if (haveoutputfcn && ! haverefine && tout(cont) < tend)
742 status = IDA::outputfun (output_fcn, haveoutputsel, yout, tsol,
743 tend, outputsel,
string);
745 if (haveeventfunction && ! haverefine && tout(cont) < tend)
746 status = IDA::event (event_fcn, te, ye, ie, tout(cont), yout,
747 string, ypout, oldval, oldisterminal,
748 olddir, cont, temp, tout(cont-1), yold,
755 N_Vector dky = N_VNew_Serial (m_num OCTAVE_SUNCONTEXT);
757 if (IDAGetDky (m_mem, tend, 0, dky) != 0)
758 error (
"IDA failed to interpolate y");
761 yout = NVecToCol (dky, m_num);
764 output.
elem (cont, i) = yout.elem (i);
769 status = IDA::outputfun (output_fcn, haveoutputsel, yout,
770 tend, tend, outputsel,
string);
773 if (haveeventfunction)
774 status = IDA::event (event_fcn, te, ye, ie, tend, yout,
775 string, ypout, oldval, oldisterminal,
776 olddir, cont, temp, tout(cont-1),
777 yold, num_event_args);
780 N_VDestroy_Serial (dky);
784 status = IDA::outputfun (output_fcn, haveoutputsel, yout, tend, tend,
790 return ovl (tout, output, te, ye, ie + 1.0);
806 if (num_event_args == 2)
807 args =
ovl (tsol, y);
809 args =
ovl (tsol, y, yp);
817 oldval = output(0).vector_value ();
818 oldisterminal = output(1).vector_value ();
819 olddir = output(2).vector_value ();
835 && ((val(i) >= 0 && oldval(i) < 0)
836 || (val(i) > 0 && oldval(i) <= 0)))
838 && ((val(i) <= 0 && oldval(i) > 0)
839 || (val(i) < 0 && oldval(i) >= 0))))
841 index.
resize (index.numel () + 1);
842 index (index.numel () - 1) = i;
846 if (cont == 1 && index.numel () > 0)
855 te(0) = tsol - val (index(0)) * (tsol - told)
856 / (val (index(0)) - oldval (index(0)));
859 = y - ((tsol - te(0)) * (y - yold) / (tsol - told));
862 ye.
elem (0, i) = ytemp.elem (i);
865 else if (index.numel () > 0)
869 te.
resize (temp + index.numel ());
870 ye.
resize (temp + index.numel (), m_num);
871 ie.
resize (temp + index.numel ());
876 if (isterminal (index(i)) == 1)
880 ie(temp+i) = index(i);
881 te(temp+i) = tsol - val(index(i)) * (tsol - told)
882 / (val(index(i)) - oldval(index(i)));
885 = y - (tsol - te (temp + i)) * (y - yold) / (tsol - told);
888 ye.
elem (temp + i, j) = ytemp.elem (j);
892 temp += index.numel ();
900 oldisterminal = isterminal;
908 int refine, realtype tend,
bool haveoutputfcn,
917 realtype h = 0, tcur = 0;
920 N_Vector dky = N_VNew_Serial (m_num OCTAVE_SUNCONTEXT);
922 N_Vector dkyp = N_VNew_Serial (m_num OCTAVE_SUNCONTEXT);
926 std::string
string =
"";
928 if (IDAGetLastStep (m_mem, &h) != 0)
929 error (
"IDA failed to return last step");
931 if (IDAGetCurrentTime (m_mem, &tcur) != 0)
932 error (
"IDA failed to return the current time");
934 realtype tin = tcur - h;
936 realtype step = h / refine;
939 i < refine && tin + step * i < tend && status == 0;
942 if (IDAGetDky (m_mem, tin + step*i, 0, dky) != 0)
943 error (
"IDA failed to interpolate y");
945 if (IDAGetDky (m_mem, tin + step*i, 1, dkyp) != 0)
946 error (
"IDA failed to interpolate yp");
949 output.
resize (cont + 1, m_num);
952 tout(cont) = tin + step * i;
953 yout = NVecToCol (dky, m_num);
954 ypout = NVecToCol (dkyp, m_num);
957 output.
elem (cont, j) = yout.elem (j);
960 status = IDA::outputfun (output_fcn, haveoutputsel, yout,
961 tout(cont), tend, outputsel,
"");
963 if (haveeventfunction)
964 status = IDA::event (event_fcn, te, ye, ie, tout(cont),
965 yout,
string, ypout, oldval,
966 oldisterminal, olddir, cont, temp,
967 tout(cont-1), yold, num_event_args);
970 N_VDestroy_Serial (dky);
976 IDA::outputfun (
const octave_value& output_fcn,
bool haveoutputsel,
979 const std::string& flag)
990 ysel(i) = yout(outputsel(i));
1002 output(0) = toutput;
1004 feval (output_fcn, output, 0);
1006 else if (flag ==
"")
1010 status = val(0).bool_value ();
1016 feval (output_fcn, output, 0);
1023 IDA::set_maxstep (realtype maxstep)
1025 if (IDASetMaxStep (m_mem, maxstep) != 0)
1026 error (
"IDA: Max Step not set");
1030 IDA::set_initialstep (realtype initialstep)
1032 if (IDASetInitStep (m_mem, initialstep) != 0)
1033 error (
"IDA: Initial Step not set");
1037 IDA::set_maxorder (
int maxorder)
1039 if (IDASetMaxOrd (m_mem, maxorder) != 0)
1040 error (
"IDA: Max Order not set");
1044 IDA::print_stat (
void)
1046 long int nsteps = 0, netfails = 0, nrevals = 0;
1048 if (IDAGetNumSteps (m_mem, &nsteps) != 0)
1049 error (
"IDA failed to return the number of internal steps");
1051 if (IDAGetNumErrTestFails (m_mem, &netfails) != 0)
1052 error (
"IDA failed to return the number of internal errors");
1054 if (IDAGetNumResEvals (m_mem, &nrevals) != 0)
1055 error (
"IDA failed to return the number of residual evaluations");
1073 tmp =
feval (ida_fc,
ovl (t,
x, xdot), 1);
1080 return tmp(0).vector_value ();
1091 tmp =
feval (ida_jc,
ovl (t,
x, xdot), 2);
1098 return tmp(0).matrix_value () + cj * tmp(1).matrix_value ();
1109 tmp =
feval (ida_jc,
ovl (t,
x, xdot), 2);
1116 return tmp(0).sparse_matrix_value () + cj * tmp(1).sparse_matrix_value ();
1120 ida_dense_cell_jac (
Matrix *dfdy,
Matrix *dfdyp,
double cj)
1122 return (*dfdy) + cj * (*dfdyp);
1129 return (*spdfdy) + cj * (*spdfdyp);
1145 IDA dae (t0, y0, yp0, ida_fcn, ida_user_function);
1154 Matrix ida_dfdy, ida_dfdyp;
1164 dae.set_jacobian (ida_jac, ida_sparse_jac);
1166 dae.set_jacobian (ida_jac, ida_dense_jac);
1174 ida_spdfdy = jaccell(0).sparse_matrix_value ();
1175 ida_spdfdyp = jaccell(1).sparse_matrix_value ();
1177 dae.set_jacobian (&ida_spdfdy, &ida_spdfdyp,
1178 ida_sparse_cell_jac);
1182 ida_dfdy = jaccell(0).matrix_value ();
1183 ida_dfdyp = jaccell(1).matrix_value ();
1185 dae.set_jacobian (&ida_dfdy, &ida_dfdyp, ida_dense_cell_jac);
1202 dae.set_tolerance (abs_tol, rel_tol);
1208 dae.set_tolerance (abs_tol, rel_tol);
1214 dae.set_maxstep (maxstep);
1221 dae.set_initialstep (initialstep);
1227 dae.set_maxorder (maxorder);
1232 bool haverefine = (refine > 1);
1238 bool haveoutputfunction
1241 if (haveoutputfunction)
1242 output_fcn = options.
getfield (
"OutputFcn");
1253 bool haveeventfunction
1256 if (haveeventfunction)
1257 event_fcn = options.
getfield (
"Events");
1263 retval = dae.integrate (numt, tspan, y0, yp0, refine,
1264 haverefine, haveoutputfunction,
1265 output_fcn, haveoutputsel, outputsel,
1266 haveeventfunction, event_fcn, num_event_args);
1286 #if defined (HAVE_SUNDIALS)
1296 error (
"__ode15__: FCN must be a function handle");
1300 = args(1).xvector_value (
"__ode15__: TRANGE must be a vector of numbers");
1304 realtype t0 = tspan(0);
1307 error (
"__ode15__: TRANGE must contain at least 2 elements");
1309 error (
"__ode15__: TRANGE must be strictly monotonic");
1313 = args(2).xvector_value (
"__ode15__: initial state Y0 must be a vector");
1316 = args(3).xvector_value (
"__ode15__: initial state YP0 must be a vector");
1320 error (
"__ode15__: initial state Y0 and YP0 must have the same length");
1321 else if (y0.
numel () < 1)
1322 error (
"__ode15__: initial state YP0 must be a vector or a scalar");
1325 if (! args(4).isstruct ())
1326 error (
"__ode15__: ODE_OPT argument must be a structure");
1329 = args(4).xscalar_map_value (
"__ode15__: ODE_OPT argument must be a scalar structure");
1333 = args(5).xidx_type_value (
"__ode15__: NUM_EVENT_ARGS must be an integer");
1335 if (num_event_args != 2 && num_event_args != 3)
1336 error (
"__ode15__: number of input arguments in event callback must be 2 or 3");
1338 return do_ode15 (ida_fcn, tspan, numt, t0, y0, yp0, options, num_event_args);
1342 octave_unused_parameter (args);
OCTARRAY_OVERRIDABLE_FUNC_API octave_idx_type numel(void) const
Number of elements in the array.
OCTARRAY_API sortmode issorted(sortmode mode=UNSORTED) const
Ordering is auto-detected or can be specified.
OCTARRAY_OVERRIDABLE_FUNC_API T & elem(octave_idx_type n)
Size of the specified dimension.
void resize(octave_idx_type n, const double &rfv=0)
void resize(octave_idx_type nr, octave_idx_type nc, double rfv=0)
octave_value getfield(const std::string &key) const
void resize(octave_idx_type n, const octave_value &rfv=octave_value())
octave_idx_type length(void) const
bool bool_value(bool warn=false) const
int int_value(bool req_int=false, bool frc_str_conv=false) const
Cell cell_value(void) const
bool is_function_handle(void) const
OCTINTERP_API Array< double > vector_value(bool frc_str_conv=false, bool frc_vec_conv=false) const
double double_value(bool frc_str_conv=false) const
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
#define DEFUN_DLD(name, args_name, nargout_name, doc)
Macro to define an at run time dynamically loadable builtin function.
OCTINTERP_API void print_usage(void)
void error(const char *fmt,...)
void err_disabled_feature(const std::string &fcn, const std::string &feature, const std::string &pkg)
void err_user_supplied_eval(const char *name)
F77_RET_T const F77_INT F77_CMPLX * A
F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE * d
F77_RET_T const F77_DBLE * x
bool int_multiply_overflow(int a, int b, int *r)
class OCTAVE_API SparseMatrix
class OCTAVE_API ColumnVector
octave_value_list feval(const char *name, const octave_value_list &args, int nargout)
Evaluate an Octave function (built-in or interpreted) and return the list of result values.
static void initialize(void)
octave_value_list ovl(const OV_Args &... args)
Construct an octave_value_list with less typing.