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