3
|
1 // CollocWt.h -*- C++ -*- |
|
2 /* |
|
3 |
1869
|
4 Copyright (C) 1996 John W. Eaton |
3
|
5 |
|
6 This file is part of Octave. |
|
7 |
|
8 Octave is free software; you can redistribute it and/or modify it |
|
9 under the terms of the GNU General Public License as published by the |
|
10 Free Software Foundation; either version 2, or (at your option) any |
|
11 later version. |
|
12 |
|
13 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
16 for more details. |
|
17 |
|
18 You should have received a copy of the GNU General Public License |
|
19 along with Octave; see the file COPYING. If not, write to the Free |
1315
|
20 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
3
|
21 |
|
22 */ |
|
23 |
382
|
24 #if !defined (octave_CollocWt_h) |
|
25 #define octave_CollocWt_h 1 |
|
26 |
1296
|
27 #if defined (__GNUG__) |
|
28 #pragma interface |
|
29 #endif |
|
30 |
465
|
31 class ostream; |
|
32 |
|
33 #include "dMatrix.h" |
|
34 #include "dColVector.h" |
384
|
35 |
1869
|
36 class |
|
37 CollocWt |
3
|
38 { |
|
39 public: |
|
40 |
1528
|
41 CollocWt::CollocWt (void) |
1869
|
42 : n (0), inc_left (0), inc_right (0), lb (0.0), rb (1.0), |
|
43 Alpha (0.0), Beta (0.0), r (), q (), A (), B (), initialized (0) { } |
1528
|
44 |
|
45 CollocWt::CollocWt (int nc, int il, int ir) |
1869
|
46 : n (nc), inc_left (il), inc_right (ir), lb (0.0), rb (1.0), |
|
47 Alpha (0.0), Beta (0.0), r (), q (), A (), B (), initialized (0) { } |
1528
|
48 |
|
49 CollocWt::CollocWt (int nc, int il, int ir, double l, double r) |
1869
|
50 : n (nc), inc_left (il), inc_right (ir), lb (l), rb (r), |
|
51 Alpha (0.0), Beta (0.0), r (), q (), A (), B (), initialized (0) { } |
1528
|
52 |
|
53 CollocWt::CollocWt (int nc, double a, double b, int il, int ir) |
1869
|
54 : n (nc), inc_left (il), inc_right (ir), lb (0.0), rb (1.0), |
|
55 Alpha (a), Beta (b), initialized (0) { } |
1528
|
56 |
|
57 CollocWt::CollocWt (int nc, double a, double b, int il, int ir, |
|
58 double l, double r) |
1869
|
59 : n (nc), inc_left (il), inc_right (ir), lb (l), rb (r), |
|
60 Alpha (a), Beta (b), r (), q (), A (), B (), initialized (0) { } |
3
|
61 |
1528
|
62 CollocWt::CollocWt (const CollocWt& a) |
1869
|
63 : n (a.n), inc_left (a.inc_left), inc_right (a.inc_right), |
|
64 lb (a.lb), rb (a.rb), Alpha (a.Alpha), Beta (a.Beta), |
|
65 r (a.r), q (a.q), A (a.A), B (a.B), |
|
66 initialized (a.initialized) { } |
3
|
67 |
1528
|
68 CollocWt& |
|
69 CollocWt::operator = (const CollocWt& a) |
|
70 { |
1869
|
71 if (this != &a) |
|
72 { |
|
73 n = a.n; |
|
74 inc_left = a.inc_left; |
|
75 inc_right = a.inc_right; |
|
76 lb = a.lb; |
|
77 rb = a.rb; |
|
78 r = a.r; |
|
79 q = a.q; |
|
80 A = a.A; |
|
81 B = a.B; |
|
82 initialized = a.initialized; |
|
83 } |
1528
|
84 return *this; |
|
85 } |
3
|
86 |
1869
|
87 ~CollocWt (void) { } |
|
88 |
1528
|
89 CollocWt& resize (int ncol) |
|
90 { |
|
91 n = ncol; |
|
92 initialized = 0; |
|
93 return *this; |
|
94 } |
|
95 |
|
96 CollocWt& add_left (void) |
|
97 { |
|
98 inc_left = 1; |
|
99 initialized = 0; |
|
100 return *this; |
|
101 } |
|
102 |
|
103 CollocWt& delete_left (void) |
|
104 { |
|
105 inc_left = 0; |
|
106 initialized = 0; |
|
107 return *this; |
|
108 } |
|
109 |
3
|
110 CollocWt& set_left (double val); |
|
111 |
1528
|
112 CollocWt& add_right (void) |
|
113 { |
|
114 inc_right = 1; |
|
115 initialized = 0; |
|
116 return *this; |
|
117 } |
|
118 |
|
119 CollocWt& delete_right (void) |
|
120 { |
|
121 inc_right = 0; |
|
122 initialized = 0; |
|
123 return *this; |
|
124 } |
|
125 |
3
|
126 CollocWt& set_right (double val); |
|
127 |
1528
|
128 CollocWt& set_alpha (double val) |
|
129 { |
|
130 Alpha = val; |
|
131 initialized = 0; |
|
132 return *this; |
|
133 } |
3
|
134 |
1528
|
135 CollocWt& set_beta (double val) |
|
136 { |
|
137 Beta = val; |
|
138 initialized = 0; |
|
139 return *this; |
|
140 } |
|
141 |
|
142 int ncol (void) const { return n; } |
3
|
143 |
1528
|
144 int left_included (void) const { return inc_left; } |
|
145 int right_included (void) const { return inc_right; } |
3
|
146 |
1528
|
147 double left (void) const { return lb; } |
|
148 double right (void) const { return rb; } |
|
149 |
|
150 double width (void) const { return rb - lb; } |
3
|
151 |
1528
|
152 double alpha (void) const { return Alpha; } |
|
153 double beta (void) const { return Beta; } |
|
154 |
|
155 ColumnVector roots (void) { if (!initialized) init (); return r; } |
|
156 ColumnVector quad (void) { if (!initialized) init (); return q; } |
3
|
157 |
1528
|
158 ColumnVector quad_weights (void) { return quad (); } |
|
159 |
|
160 Matrix first (void) { if (!initialized) init (); return A; } |
|
161 |
|
162 Matrix second (void) { if (!initialized) init (); return B; } |
3
|
163 |
|
164 friend ostream& operator << (ostream&, const CollocWt&); |
|
165 |
|
166 protected: |
|
167 |
|
168 int n; |
|
169 |
|
170 int inc_left; |
|
171 int inc_right; |
|
172 |
|
173 double lb; |
|
174 double rb; |
|
175 |
|
176 double Alpha; |
|
177 double Beta; |
|
178 |
1528
|
179 ColumnVector r; |
|
180 ColumnVector q; |
3
|
181 |
|
182 Matrix A; |
|
183 Matrix B; |
|
184 |
|
185 int initialized; |
|
186 |
|
187 void init (void); |
|
188 |
|
189 void error (const char *msg); |
|
190 }; |
|
191 |
|
192 #endif |
|
193 |
|
194 /* |
|
195 ;;; Local Variables: *** |
|
196 ;;; mode: C++ *** |
|
197 ;;; page-delimiter: "^/\\*" *** |
|
198 ;;; End: *** |
|
199 */ |