3
|
1 /* |
|
2 |
2847
|
3 Copyright (C) 1996, 1997 John W. Eaton |
3
|
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 2, or (at your option) any |
|
10 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, write to the Free |
5307
|
19 Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|
20 02110-1301, USA. |
3
|
21 |
|
22 */ |
|
23 |
382
|
24 #if !defined (octave_NLFunc_h) |
|
25 #define octave_NLFunc_h 1 |
|
26 |
461
|
27 class ColumnVector; |
|
28 class Matrix; |
3
|
29 |
1864
|
30 class |
|
31 NLFunc |
3
|
32 { |
|
33 public: |
|
34 |
1536
|
35 typedef ColumnVector (*nonlinear_fcn) (const ColumnVector&); |
|
36 typedef Matrix (*jacobian_fcn) (const ColumnVector&); |
|
37 |
1533
|
38 NLFunc (void) |
1864
|
39 : fun (0), jac (0) { } |
1533
|
40 |
|
41 NLFunc (const nonlinear_fcn f) |
1864
|
42 : fun (f), jac (0) { } |
3
|
43 |
1533
|
44 NLFunc (const nonlinear_fcn f, const jacobian_fcn j) |
1864
|
45 : fun (f), jac (j) { } |
3
|
46 |
1533
|
47 NLFunc (const NLFunc& a) |
1864
|
48 : fun (a.fun), jac (a.jac) { } |
3
|
49 |
1533
|
50 NLFunc& operator = (const NLFunc& a) |
|
51 { |
1864
|
52 if (this != &a) |
|
53 { |
|
54 fun = a.fun; |
|
55 jac = a.jac; |
|
56 } |
1533
|
57 return *this; |
|
58 } |
|
59 |
1864
|
60 ~NLFunc (void) { } |
|
61 |
1533
|
62 nonlinear_fcn function (void) const { return fun; } |
3
|
63 |
1533
|
64 NLFunc& set_function (const nonlinear_fcn f) |
|
65 { |
|
66 fun = f; |
|
67 return *this; |
|
68 } |
3
|
69 |
1533
|
70 jacobian_fcn jacobian_function (void) const { return jac; } |
|
71 |
|
72 NLFunc& set_jacobian_function (const jacobian_fcn j) |
|
73 { |
|
74 jac = j; |
|
75 return *this; |
|
76 } |
3
|
77 |
|
78 protected: |
|
79 |
|
80 nonlinear_fcn fun; |
|
81 jacobian_fcn jac; |
|
82 }; |
|
83 |
|
84 #endif |
|
85 |
|
86 /* |
|
87 ;;; Local Variables: *** |
|
88 ;;; mode: C++ *** |
|
89 ;;; End: *** |
|
90 */ |