Mercurial > hg > octave-lyh
annotate liboctave/CollocWt.h @ 11516:53edbf95fbb6
avoid GCC warnings
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 13 Jan 2011 15:40:14 -0500 |
parents | 331fcc41ca23 |
children | fd0a3ac60b0e |
rev | line source |
---|---|
3 | 1 /* |
2 | |
7017 | 3 Copyright (C) 1993, 1994, 1995, 1996, 1997, 2000, 2002, 2003, 2004, |
9245 | 4 2005, 2006, 2007, 2009 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 | |
7016 | 10 Free Software Foundation; either version 3 of the License, or (at your |
11 option) any later version. | |
3 | 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 | |
7016 | 19 along with Octave; see the file COPYING. If not, see |
20 <http://www.gnu.org/licenses/>. | |
3 | 21 |
22 */ | |
23 | |
382 | 24 #if !defined (octave_CollocWt_h) |
25 #define octave_CollocWt_h 1 | |
26 | |
8950
d865363208d6
include <iosfwd> instead of <iostream> in header files
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
27 #include <iosfwd> |
465 | 28 |
29 #include "dMatrix.h" | |
30 #include "dColVector.h" | |
384 | 31 |
1869 | 32 class |
6108 | 33 OCTAVE_API |
1869 | 34 CollocWt |
3 | 35 { |
36 public: | |
37 | |
4055 | 38 CollocWt (void) |
1869 | 39 : n (0), inc_left (0), inc_right (0), lb (0.0), rb (1.0), |
10603
d909c4c14b63
convert villad functions to C++
John W. Eaton <jwe@octave.org>
parents:
10312
diff
changeset
|
40 Alpha (0.0), Beta (0.0), r (), q (), A (), B (), initialized (false) { } |
1528 | 41 |
5275 | 42 CollocWt (octave_idx_type nc, octave_idx_type il, octave_idx_type ir) |
1869 | 43 : n (nc), inc_left (il), inc_right (ir), lb (0.0), rb (1.0), |
10603
d909c4c14b63
convert villad functions to C++
John W. Eaton <jwe@octave.org>
parents:
10312
diff
changeset
|
44 Alpha (0.0), Beta (0.0), r (), q (), A (), B (), initialized (false) { } |
1528 | 45 |
10603
d909c4c14b63
convert villad functions to C++
John W. Eaton <jwe@octave.org>
parents:
10312
diff
changeset
|
46 CollocWt (octave_idx_type nc, octave_idx_type il, octave_idx_type ir, |
d909c4c14b63
convert villad functions to C++
John W. Eaton <jwe@octave.org>
parents:
10312
diff
changeset
|
47 double l, double rr) |
4587 | 48 : n (nc), inc_left (il), inc_right (ir), lb (l), rb (rr), |
10603
d909c4c14b63
convert villad functions to C++
John W. Eaton <jwe@octave.org>
parents:
10312
diff
changeset
|
49 Alpha (0.0), Beta (0.0), r (), q (), A (), B (), initialized (false) { } |
1528 | 50 |
10603
d909c4c14b63
convert villad functions to C++
John W. Eaton <jwe@octave.org>
parents:
10312
diff
changeset
|
51 CollocWt (octave_idx_type nc, double a, double b, octave_idx_type il, |
d909c4c14b63
convert villad functions to C++
John W. Eaton <jwe@octave.org>
parents:
10312
diff
changeset
|
52 octave_idx_type ir) |
1869 | 53 : n (nc), inc_left (il), inc_right (ir), lb (0.0), rb (1.0), |
11501
331fcc41ca23
data member initialization fixes
John W. Eaton <jwe@octave.org>
parents:
10603
diff
changeset
|
54 Alpha (a), Beta (b), r (), q (), A (), B (), initialized (false) { } |
1528 | 55 |
10603
d909c4c14b63
convert villad functions to C++
John W. Eaton <jwe@octave.org>
parents:
10312
diff
changeset
|
56 CollocWt (octave_idx_type nc, double a, double b, octave_idx_type il, |
d909c4c14b63
convert villad functions to C++
John W. Eaton <jwe@octave.org>
parents:
10312
diff
changeset
|
57 octave_idx_type ir, |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
58 double ll, double rr) |
4587 | 59 : n (nc), inc_left (il), inc_right (ir), lb (ll), rb (rr), |
10603
d909c4c14b63
convert villad functions to C++
John W. Eaton <jwe@octave.org>
parents:
10312
diff
changeset
|
60 Alpha (a), Beta (b), r (), q (), A (), B (), initialized (false) { } |
3 | 61 |
4055 | 62 CollocWt (const CollocWt& a) |
1869 | 63 : n (a.n), inc_left (a.inc_left), inc_right (a.inc_right), |
64 lb (a.lb), rb (a.rb), Alpha (a.Alpha), Beta (a.Beta), | |
65 r (a.r), q (a.q), A (a.A), B (a.B), | |
66 initialized (a.initialized) { } | |
3 | 67 |
4055 | 68 CollocWt& operator = (const CollocWt& a) |
1528 | 69 { |
1869 | 70 if (this != &a) |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
71 { |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
72 n = a.n; |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
73 inc_left = a.inc_left; |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
74 inc_right = a.inc_right; |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
75 lb = a.lb; |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
76 rb = a.rb; |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
77 r = a.r; |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
78 q = a.q; |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
79 A = a.A; |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
80 B = a.B; |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
81 initialized = a.initialized; |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
82 } |
1528 | 83 return *this; |
84 } | |
3 | 85 |
1869 | 86 ~CollocWt (void) { } |
87 | |
5275 | 88 CollocWt& resize (octave_idx_type nc) |
1528 | 89 { |
4587 | 90 n = nc; |
10603
d909c4c14b63
convert villad functions to C++
John W. Eaton <jwe@octave.org>
parents:
10312
diff
changeset
|
91 initialized = false; |
1528 | 92 return *this; |
93 } | |
94 | |
95 CollocWt& add_left (void) | |
96 { | |
97 inc_left = 1; | |
10603
d909c4c14b63
convert villad functions to C++
John W. Eaton <jwe@octave.org>
parents:
10312
diff
changeset
|
98 initialized = false; |
1528 | 99 return *this; |
100 } | |
101 | |
102 CollocWt& delete_left (void) | |
103 { | |
104 inc_left = 0; | |
10603
d909c4c14b63
convert villad functions to C++
John W. Eaton <jwe@octave.org>
parents:
10312
diff
changeset
|
105 initialized = false; |
1528 | 106 return *this; |
107 } | |
108 | |
3 | 109 CollocWt& set_left (double val); |
110 | |
1528 | 111 CollocWt& add_right (void) |
112 { | |
113 inc_right = 1; | |
10603
d909c4c14b63
convert villad functions to C++
John W. Eaton <jwe@octave.org>
parents:
10312
diff
changeset
|
114 initialized = false; |
1528 | 115 return *this; |
116 } | |
117 | |
118 CollocWt& delete_right (void) | |
119 { | |
120 inc_right = 0; | |
10603
d909c4c14b63
convert villad functions to C++
John W. Eaton <jwe@octave.org>
parents:
10312
diff
changeset
|
121 initialized = false; |
1528 | 122 return *this; |
123 } | |
124 | |
3 | 125 CollocWt& set_right (double val); |
126 | |
1528 | 127 CollocWt& set_alpha (double val) |
128 { | |
129 Alpha = val; | |
10603
d909c4c14b63
convert villad functions to C++
John W. Eaton <jwe@octave.org>
parents:
10312
diff
changeset
|
130 initialized = false; |
1528 | 131 return *this; |
132 } | |
3 | 133 |
1528 | 134 CollocWt& set_beta (double val) |
135 { | |
136 Beta = val; | |
10603
d909c4c14b63
convert villad functions to C++
John W. Eaton <jwe@octave.org>
parents:
10312
diff
changeset
|
137 initialized = false; |
1528 | 138 return *this; |
139 } | |
140 | |
5275 | 141 octave_idx_type ncol (void) const { return n; } |
3 | 142 |
5275 | 143 octave_idx_type left_included (void) const { return inc_left; } |
144 octave_idx_type 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 |
3504 | 163 friend std::ostream& operator << (std::ostream&, const CollocWt&); |
3 | 164 |
165 protected: | |
166 | |
5275 | 167 octave_idx_type n; |
3 | 168 |
5275 | 169 octave_idx_type inc_left; |
170 octave_idx_type inc_right; | |
3 | 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 | |
10603
d909c4c14b63
convert villad functions to C++
John W. Eaton <jwe@octave.org>
parents:
10312
diff
changeset
|
184 bool initialized; |
3 | 185 |
186 void init (void); | |
187 | |
188 void error (const char *msg); | |
189 }; | |
190 | |
191 #endif |