00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #if !defined (octave_NLEqn_h)
00024 #define octave_NLEqn_h 1
00025
00026 #if defined (__GNUG__) && defined (USE_PRAGMA_INTERFACE_IMPLEMENTATION)
00027 #pragma interface
00028 #endif
00029
00030 #include <cfloat>
00031 #include <cmath>
00032
00033 #include "NLEqn-opts.h"
00034
00035 class
00036 NLEqn : public NLFunc, public NLEqn_options
00037 {
00038 public:
00039
00040 NLEqn (void)
00041 : NLFunc (), NLEqn_options (), x (), solution_status (0) { }
00042
00043 NLEqn (const ColumnVector& xx, const NLFunc f)
00044 : NLFunc (f), NLEqn_options (), x (xx), solution_status (0) { }
00045
00046 NLEqn (const NLEqn& a)
00047 : NLFunc (a.fun, a.jac), NLEqn_options (), x (a.x),
00048 solution_status (a.solution_status) { }
00049
00050 NLEqn& operator = (const NLEqn& a)
00051 {
00052 if (this != &a)
00053 {
00054 NLFunc::operator = (a);
00055 NLEqn_options::operator = (a);
00056
00057 x = a.x;
00058 solution_status = a.solution_status;
00059 }
00060 return *this;
00061 }
00062
00063 ~NLEqn (void) { }
00064
00065 void set_states (const ColumnVector& xx) { x = xx; }
00066
00067 ColumnVector states (void) const { return x; }
00068
00069 int size (void) const { return x.capacity (); }
00070
00071 ColumnVector solve (void)
00072 {
00073 int info;
00074 return solve (info);
00075 }
00076
00077 ColumnVector solve (const ColumnVector& xvec)
00078 {
00079 set_states (xvec);
00080 int info;
00081 return solve (info);
00082 }
00083
00084 ColumnVector solve (const ColumnVector& xvec, int& info)
00085 {
00086 set_states (xvec);
00087 return solve (info);
00088 }
00089
00090 ColumnVector solve (int& info);
00091
00092 int solution_state (void) const { return solution_status; }
00093
00094 bool solution_ok (void) const { return solution_status == 1; }
00095
00096 std::string error_message (void) const;
00097
00098 private:
00099
00100 ColumnVector x;
00101 int solution_status;
00102
00103 void error (const char* msg);
00104 };
00105
00106 #endif
00107
00108
00109
00110
00111
00112