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