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