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