GNU Octave  4.2.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ODEFunc.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 1993-2017 John W. Eaton
4 
5 This file is part of Octave.
6 
7 Octave is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the
9 Free Software Foundation; either version 3 of the License, or (at your
10 option) any later version.
11 
12 Octave is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with Octave; see the file COPYING. If not, see
19 <http://www.gnu.org/licenses/>.
20 
21 */
22 
23 #if ! defined (octave_ODEFunc_h)
24 #define octave_ODEFunc_h 1
25 
26 #include "octave-config.h"
27 
28 class Matrix;
29 class ColumnVector;
30 
31 class
32 ODEFunc
33 {
34 public:
35 
36  typedef ColumnVector (*ODERHSFunc) (const ColumnVector&, double);
37  typedef Matrix (*ODEJacFunc) (const ColumnVector&, double);
38 
39  ODEFunc (void)
40  : fun (0), jac (0), reset (true) { }
41 
42  ODEFunc (ODERHSFunc f)
43  : fun (f), jac (0), reset (true) { }
44 
45  ODEFunc (ODERHSFunc f, ODEJacFunc j)
46  : fun (f), jac (j), reset (true) { }
47 
48  ODEFunc (const ODEFunc& a)
49  : fun (a.fun), jac (a.jac), reset (true) { }
50 
52  {
53  if (this != &a)
54  {
55  fun = a.fun;
56  jac = a.jac;
57  reset = a.reset;
58  }
59  return *this;
60  }
61 
62  virtual ~ODEFunc (void) { }
63 
64  ODERHSFunc function (void) const { return fun; }
65 
66  ODEFunc& set_function (ODERHSFunc f)
67  {
68  fun = f;
69  reset = true;
70  return *this;
71  }
72 
73  ODEJacFunc jacobian_function (void) const { return jac; }
74 
76  {
77  jac = j;
78  reset = true;
79  return *this;
80  }
81 
82 protected:
83 
84  ODERHSFunc fun;
85  ODEJacFunc jac;
86 
87  // This variable is TRUE when this object is constructed, and also
88  // after any internal data has changed. Derived classes may use
89  // this information (and change it) to know when to (re)initialize
90  // their own internal data related to this object.
91 
92  bool reset;
93 };
94 
95 #endif
ODEFunc(const ODEFunc &a)
Definition: ODEFunc.h:48
virtual ~ODEFunc(void)
Definition: ODEFunc.h:62
F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T const F77_REAL const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T F77_REAL F77_REAL &F77_RET_T F77_DBLE F77_DBLE &F77_RET_T const F77_DBLE const F77_DBLE * f
ODEFunc(void)
Definition: ODEFunc.h:39
calling an anonymous function involves an overhead quite comparable to the overhead of an m file function Passing a handle to a built in function is because the interpreter is not involved in the internal loop For a
Definition: cellfun.cc:398
ODEFunc & set_jacobian_function(ODEJacFunc j)
Definition: ODEFunc.h:75
ODERHSFunc fun
Definition: ODEFunc.h:84
ColumnVector & operator=(const ColumnVector &a)
Definition: dColVector.h:55
ODEFunc(ODERHSFunc f, ODEJacFunc j)
Definition: ODEFunc.h:45
Definition: dMatrix.h:37
ODEJacFunc jac
Definition: ODEFunc.h:85
ColumnVector(void)
Definition: dColVector.h:39
issues an error eealso double
Definition: ov-bool-mat.cc:594
bool reset
Definition: ODEFunc.h:92
ODEFunc & set_function(ODERHSFunc f)
Definition: ODEFunc.h:66
ODEFunc(ODERHSFunc f)
Definition: ODEFunc.h:42
ODEJacFunc jacobian_function(void) const
Definition: ODEFunc.h:73