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_CollocWt_h)
00024 #define octave_CollocWt_h 1
00025
00026 #include <iosfwd>
00027
00028 #include "dMatrix.h"
00029 #include "dColVector.h"
00030
00031 class
00032 OCTAVE_API
00033 CollocWt
00034 {
00035 public:
00036
00037 CollocWt (void)
00038 : n (0), inc_left (0), inc_right (0), lb (0.0), rb (1.0),
00039 Alpha (0.0), Beta (0.0), r (), q (), A (), B (), initialized (false) { }
00040
00041 CollocWt (octave_idx_type nc, octave_idx_type il, octave_idx_type ir)
00042 : n (nc), inc_left (il), inc_right (ir), lb (0.0), rb (1.0),
00043 Alpha (0.0), Beta (0.0), r (), q (), A (), B (), initialized (false) { }
00044
00045 CollocWt (octave_idx_type nc, octave_idx_type il, octave_idx_type ir,
00046 double l, double rr)
00047 : n (nc), inc_left (il), inc_right (ir), lb (l), rb (rr),
00048 Alpha (0.0), Beta (0.0), r (), q (), A (), B (), initialized (false) { }
00049
00050 CollocWt (octave_idx_type nc, double a, double b, octave_idx_type il,
00051 octave_idx_type ir)
00052 : n (nc), inc_left (il), inc_right (ir), lb (0.0), rb (1.0),
00053 Alpha (a), Beta (b), r (), q (), A (), B (), initialized (false) { }
00054
00055 CollocWt (octave_idx_type nc, double a, double b, octave_idx_type il,
00056 octave_idx_type ir,
00057 double ll, double rr)
00058 : n (nc), inc_left (il), inc_right (ir), lb (ll), rb (rr),
00059 Alpha (a), Beta (b), r (), q (), A (), B (), initialized (false) { }
00060
00061 CollocWt (const CollocWt& a)
00062 : n (a.n), inc_left (a.inc_left), inc_right (a.inc_right),
00063 lb (a.lb), rb (a.rb), Alpha (a.Alpha), Beta (a.Beta),
00064 r (a.r), q (a.q), A (a.A), B (a.B),
00065 initialized (a.initialized) { }
00066
00067 CollocWt& operator = (const CollocWt& a)
00068 {
00069 if (this != &a)
00070 {
00071 n = a.n;
00072 inc_left = a.inc_left;
00073 inc_right = a.inc_right;
00074 lb = a.lb;
00075 rb = a.rb;
00076 r = a.r;
00077 q = a.q;
00078 A = a.A;
00079 B = a.B;
00080 initialized = a.initialized;
00081 }
00082 return *this;
00083 }
00084
00085 ~CollocWt (void) { }
00086
00087 CollocWt& resize (octave_idx_type nc)
00088 {
00089 n = nc;
00090 initialized = false;
00091 return *this;
00092 }
00093
00094 CollocWt& add_left (void)
00095 {
00096 inc_left = 1;
00097 initialized = false;
00098 return *this;
00099 }
00100
00101 CollocWt& delete_left (void)
00102 {
00103 inc_left = 0;
00104 initialized = false;
00105 return *this;
00106 }
00107
00108 CollocWt& set_left (double val);
00109
00110 CollocWt& add_right (void)
00111 {
00112 inc_right = 1;
00113 initialized = false;
00114 return *this;
00115 }
00116
00117 CollocWt& delete_right (void)
00118 {
00119 inc_right = 0;
00120 initialized = false;
00121 return *this;
00122 }
00123
00124 CollocWt& set_right (double val);
00125
00126 CollocWt& set_alpha (double val)
00127 {
00128 Alpha = val;
00129 initialized = false;
00130 return *this;
00131 }
00132
00133 CollocWt& set_beta (double val)
00134 {
00135 Beta = val;
00136 initialized = false;
00137 return *this;
00138 }
00139
00140 octave_idx_type ncol (void) const { return n; }
00141
00142 octave_idx_type left_included (void) const { return inc_left; }
00143 octave_idx_type right_included (void) const { return inc_right; }
00144
00145 double left (void) const { return lb; }
00146 double right (void) const { return rb; }
00147
00148 double width (void) const { return rb - lb; }
00149
00150 double alpha (void) const { return Alpha; }
00151 double beta (void) const { return Beta; }
00152
00153 ColumnVector roots (void) { if (!initialized) init (); return r; }
00154 ColumnVector quad (void) { if (!initialized) init (); return q; }
00155
00156 ColumnVector quad_weights (void) { return quad (); }
00157
00158 Matrix first (void) { if (!initialized) init (); return A; }
00159
00160 Matrix second (void) { if (!initialized) init (); return B; }
00161
00162 friend std::ostream& operator << (std::ostream&, const CollocWt&);
00163
00164 protected:
00165
00166 octave_idx_type n;
00167
00168 octave_idx_type inc_left;
00169 octave_idx_type inc_right;
00170
00171 double lb;
00172 double rb;
00173
00174 double Alpha;
00175 double Beta;
00176
00177 ColumnVector r;
00178 ColumnVector q;
00179
00180 Matrix A;
00181 Matrix B;
00182
00183 bool initialized;
00184
00185 void init (void);
00186
00187 void error (const char *msg);
00188 };
00189
00190 #endif