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_CollocWt_h) |
|
24 #define octave_CollocWt_h 1 |
|
25 |
1296
|
26 #if defined (__GNUG__) |
|
27 #pragma interface |
|
28 #endif |
|
29 |
465
|
30 class ostream; |
|
31 |
|
32 #include "dMatrix.h" |
|
33 #include "dColVector.h" |
384
|
34 |
1869
|
35 class |
|
36 CollocWt |
3
|
37 { |
|
38 public: |
|
39 |
1528
|
40 CollocWt::CollocWt (void) |
1869
|
41 : n (0), inc_left (0), inc_right (0), lb (0.0), rb (1.0), |
|
42 Alpha (0.0), Beta (0.0), r (), q (), A (), B (), initialized (0) { } |
1528
|
43 |
|
44 CollocWt::CollocWt (int nc, int il, int ir) |
1869
|
45 : n (nc), inc_left (il), inc_right (ir), lb (0.0), rb (1.0), |
|
46 Alpha (0.0), Beta (0.0), r (), q (), A (), B (), initialized (0) { } |
1528
|
47 |
|
48 CollocWt::CollocWt (int nc, int il, int ir, double l, double r) |
1869
|
49 : n (nc), inc_left (il), inc_right (ir), lb (l), rb (r), |
|
50 Alpha (0.0), Beta (0.0), r (), q (), A (), B (), initialized (0) { } |
1528
|
51 |
|
52 CollocWt::CollocWt (int nc, double a, double b, int il, int ir) |
1869
|
53 : n (nc), inc_left (il), inc_right (ir), lb (0.0), rb (1.0), |
|
54 Alpha (a), Beta (b), initialized (0) { } |
1528
|
55 |
|
56 CollocWt::CollocWt (int nc, double a, double b, int il, int ir, |
|
57 double l, double r) |
1869
|
58 : n (nc), inc_left (il), inc_right (ir), lb (l), rb (r), |
|
59 Alpha (a), Beta (b), r (), q (), A (), B (), initialized (0) { } |
3
|
60 |
1528
|
61 CollocWt::CollocWt (const CollocWt& a) |
1869
|
62 : n (a.n), inc_left (a.inc_left), inc_right (a.inc_right), |
|
63 lb (a.lb), rb (a.rb), Alpha (a.Alpha), Beta (a.Beta), |
|
64 r (a.r), q (a.q), A (a.A), B (a.B), |
|
65 initialized (a.initialized) { } |
3
|
66 |
1528
|
67 CollocWt& |
|
68 CollocWt::operator = (const CollocWt& a) |
|
69 { |
1869
|
70 if (this != &a) |
|
71 { |
|
72 n = a.n; |
|
73 inc_left = a.inc_left; |
|
74 inc_right = a.inc_right; |
|
75 lb = a.lb; |
|
76 rb = a.rb; |
|
77 r = a.r; |
|
78 q = a.q; |
|
79 A = a.A; |
|
80 B = a.B; |
|
81 initialized = a.initialized; |
|
82 } |
1528
|
83 return *this; |
|
84 } |
3
|
85 |
1869
|
86 ~CollocWt (void) { } |
|
87 |
1528
|
88 CollocWt& resize (int ncol) |
|
89 { |
|
90 n = ncol; |
|
91 initialized = 0; |
|
92 return *this; |
|
93 } |
|
94 |
|
95 CollocWt& add_left (void) |
|
96 { |
|
97 inc_left = 1; |
|
98 initialized = 0; |
|
99 return *this; |
|
100 } |
|
101 |
|
102 CollocWt& delete_left (void) |
|
103 { |
|
104 inc_left = 0; |
|
105 initialized = 0; |
|
106 return *this; |
|
107 } |
|
108 |
3
|
109 CollocWt& set_left (double val); |
|
110 |
1528
|
111 CollocWt& add_right (void) |
|
112 { |
|
113 inc_right = 1; |
|
114 initialized = 0; |
|
115 return *this; |
|
116 } |
|
117 |
|
118 CollocWt& delete_right (void) |
|
119 { |
|
120 inc_right = 0; |
|
121 initialized = 0; |
|
122 return *this; |
|
123 } |
|
124 |
3
|
125 CollocWt& set_right (double val); |
|
126 |
1528
|
127 CollocWt& set_alpha (double val) |
|
128 { |
|
129 Alpha = val; |
|
130 initialized = 0; |
|
131 return *this; |
|
132 } |
3
|
133 |
1528
|
134 CollocWt& set_beta (double val) |
|
135 { |
|
136 Beta = val; |
|
137 initialized = 0; |
|
138 return *this; |
|
139 } |
|
140 |
|
141 int ncol (void) const { return n; } |
3
|
142 |
1528
|
143 int left_included (void) const { return inc_left; } |
|
144 int right_included (void) const { return inc_right; } |
3
|
145 |
1528
|
146 double left (void) const { return lb; } |
|
147 double right (void) const { return rb; } |
|
148 |
|
149 double width (void) const { return rb - lb; } |
3
|
150 |
1528
|
151 double alpha (void) const { return Alpha; } |
|
152 double beta (void) const { return Beta; } |
|
153 |
|
154 ColumnVector roots (void) { if (!initialized) init (); return r; } |
|
155 ColumnVector quad (void) { if (!initialized) init (); return q; } |
3
|
156 |
1528
|
157 ColumnVector quad_weights (void) { return quad (); } |
|
158 |
|
159 Matrix first (void) { if (!initialized) init (); return A; } |
|
160 |
|
161 Matrix second (void) { if (!initialized) init (); return B; } |
3
|
162 |
|
163 friend ostream& operator << (ostream&, const CollocWt&); |
|
164 |
|
165 protected: |
|
166 |
|
167 int n; |
|
168 |
|
169 int inc_left; |
|
170 int inc_right; |
|
171 |
|
172 double lb; |
|
173 double rb; |
|
174 |
|
175 double Alpha; |
|
176 double Beta; |
|
177 |
1528
|
178 ColumnVector r; |
|
179 ColumnVector q; |
3
|
180 |
|
181 Matrix A; |
|
182 Matrix B; |
|
183 |
|
184 int initialized; |
|
185 |
|
186 void init (void); |
|
187 |
|
188 void error (const char *msg); |
|
189 }; |
|
190 |
|
191 #endif |
|
192 |
|
193 /* |
|
194 ;;; Local Variables: *** |
|
195 ;;; mode: C++ *** |
|
196 ;;; End: *** |
|
197 */ |