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 |
1315
|
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
3
|
20 |
|
21 */ |
|
22 |
382
|
23 #if !defined (octave_NLEqn_h) |
|
24 #define octave_NLEqn_h 1 |
|
25 |
1531
|
26 #include <cfloat> |
|
27 #include <cmath> |
|
28 |
3998
|
29 #include "NLEqn-opts.h" |
289
|
30 |
1865
|
31 class |
|
32 NLEqn : public NLFunc, public NLEqn_options |
3
|
33 { |
1865
|
34 public: |
1531
|
35 |
1865
|
36 NLEqn (void) |
3971
|
37 : NLFunc (), NLEqn_options (), x (), solution_status (0) { } |
1531
|
38 |
1865
|
39 NLEqn (const ColumnVector& xx, const NLFunc f) |
3971
|
40 : NLFunc (f), NLEqn_options (), x (xx), solution_status (0) { } |
1531
|
41 |
1865
|
42 NLEqn (const NLEqn& a) |
3971
|
43 : NLFunc (a.fun, a.jac), NLEqn_options (), x (a.x), |
|
44 solution_status (a.solution_status) { } |
3
|
45 |
1531
|
46 NLEqn& operator = (const NLEqn& a) |
|
47 { |
1865
|
48 if (this != &a) |
|
49 { |
|
50 NLFunc::operator = (a); |
|
51 NLEqn_options::operator = (a); |
1531
|
52 |
1865
|
53 x = a.x; |
3971
|
54 solution_status = a.solution_status; |
1865
|
55 } |
1531
|
56 return *this; |
|
57 } |
3
|
58 |
1865
|
59 ~NLEqn (void) { } |
3
|
60 |
1865
|
61 void set_states (const ColumnVector& xx) { x = xx; } |
1531
|
62 |
|
63 ColumnVector states (void) const { return x; } |
|
64 |
5275
|
65 octave_idx_type size (void) const { return x.capacity (); } |
3
|
66 |
1531
|
67 ColumnVector solve (void) |
|
68 { |
5275
|
69 octave_idx_type info; |
1531
|
70 return solve (info); |
|
71 } |
3
|
72 |
1531
|
73 ColumnVector solve (const ColumnVector& xvec) |
|
74 { |
|
75 set_states (xvec); |
5275
|
76 octave_idx_type info; |
1531
|
77 return solve (info); |
|
78 } |
3
|
79 |
5275
|
80 ColumnVector solve (const ColumnVector& xvec, octave_idx_type& info) |
1531
|
81 { |
|
82 set_states (xvec); |
|
83 return solve (info); |
|
84 } |
|
85 |
5275
|
86 ColumnVector solve (octave_idx_type& info); |
3
|
87 |
5275
|
88 octave_idx_type solution_state (void) const { return solution_status; } |
3971
|
89 |
|
90 bool solution_ok (void) const { return solution_status == 1; } |
|
91 |
|
92 std::string error_message (void) const; |
|
93 |
|
94 private: |
3
|
95 |
1531
|
96 ColumnVector x; |
5275
|
97 octave_idx_type solution_status; |
3
|
98 |
|
99 void error (const char* msg); |
|
100 }; |
|
101 |
|
102 #endif |
|
103 |
|
104 /* |
|
105 ;;; Local Variables: *** |
|
106 ;;; mode: C++ *** |
|
107 ;;; End: *** |
|
108 */ |