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