3
|
1 // CollocWt.h -*- C++ -*- |
|
2 /* |
|
3 |
|
4 Copyright (C) 1992, 1993 John W. Eaton |
|
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 |
|
20 Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. |
|
21 |
|
22 */ |
|
23 |
|
24 #if !defined (_CollocWt_h) |
|
25 #define _CollocWt_h 1 |
|
26 |
238
|
27 class ostream; |
3
|
28 |
|
29 #include "Matrix.h" |
|
30 |
|
31 #ifndef Vector |
|
32 #define Vector ColumnVector |
|
33 #endif |
|
34 |
|
35 class CollocWt |
|
36 { |
|
37 public: |
|
38 |
|
39 CollocWt (void); |
|
40 CollocWt (int ncol, int include_left, int include_right); |
|
41 CollocWt (int ncol, int include_left, int include_right, double left, |
|
42 double right); |
|
43 CollocWt (int ncol, double alpha, double beta, int include_left, |
|
44 int include_right); |
|
45 CollocWt (int ncol, double alpha, double beta, int include_left, |
|
46 int include_right, double left, double right); |
|
47 |
|
48 CollocWt (const CollocWt&); |
|
49 |
|
50 CollocWt& operator = (const CollocWt&); |
|
51 |
|
52 CollocWt& resize (int ncol); |
|
53 |
|
54 CollocWt& add_left (void); |
|
55 CollocWt& delete_left (void); |
|
56 CollocWt& set_left (double val); |
|
57 |
|
58 CollocWt& add_right (void); |
|
59 CollocWt& delete_right (void); |
|
60 CollocWt& set_right (double val); |
|
61 |
|
62 CollocWt& set_alpha (double val); |
|
63 CollocWt& set_beta (double val); |
|
64 |
|
65 int ncol (void) const; |
|
66 int left_included (void) const; |
|
67 int right_included (void) const; |
|
68 |
|
69 double left (void) const; |
|
70 double right (void) const; |
|
71 double width (void) const; |
|
72 |
|
73 double alpha (void) const; |
|
74 double beta (void) const; |
|
75 |
|
76 Vector roots (void); |
|
77 Vector quad (void); |
|
78 Vector quad_weights (void); |
|
79 |
|
80 Matrix first (void); |
|
81 Matrix second (void); |
|
82 |
|
83 friend ostream& operator << (ostream&, const CollocWt&); |
|
84 |
|
85 protected: |
|
86 |
|
87 int n; |
|
88 int nt; |
|
89 |
|
90 int inc_left; |
|
91 int inc_right; |
|
92 |
|
93 double lb; |
|
94 double rb; |
|
95 |
|
96 double Alpha; |
|
97 double Beta; |
|
98 |
|
99 Vector r; |
|
100 Vector q; |
|
101 |
|
102 Matrix A; |
|
103 Matrix B; |
|
104 |
|
105 int initialized; |
|
106 |
|
107 void init (void); |
|
108 |
|
109 void error (const char *msg); |
|
110 }; |
|
111 |
|
112 inline int |
|
113 CollocWt::ncol (void) const |
|
114 { |
|
115 return n; |
|
116 } |
|
117 |
|
118 inline int CollocWt::left_included (void) const { return inc_left; } |
|
119 inline int CollocWt::right_included (void) const { return inc_right; } |
|
120 inline double CollocWt::left (void) const { return lb; } |
|
121 inline double CollocWt::right (void) const { return rb; } |
|
122 inline double CollocWt::width (void) const { return rb - lb; } |
|
123 inline double CollocWt::alpha (void) const { return Alpha; } |
|
124 inline double CollocWt::beta (void) const { return Beta; } |
|
125 |
|
126 inline Vector CollocWt::roots (void) |
|
127 { if (!initialized) init (); return r; } |
|
128 |
|
129 inline Vector CollocWt::quad (void) |
|
130 { if (!initialized) init (); return q; } |
|
131 |
|
132 inline Vector CollocWt::quad_weights (void) |
|
133 { return quad (); } |
|
134 |
|
135 inline Matrix CollocWt::first (void) |
|
136 { if (!initialized) init (); return A; } |
|
137 |
|
138 inline Matrix CollocWt::second (void) |
|
139 { if (!initialized) init (); return B; } |
|
140 |
|
141 #endif |
|
142 |
|
143 /* |
|
144 ;;; Local Variables: *** |
|
145 ;;; mode: C++ *** |
|
146 ;;; page-delimiter: "^/\\*" *** |
|
147 ;;; End: *** |
|
148 */ |