Mercurial > hg > octave-nkf
annotate liboctave/numeric/CollocWt.h @ 20440:e914b5399c67
Use in-place operators in C++ code where possible.
* libgui/src/dialog.cc, libgui/src/m-editor/file-editor-tab.cc,
libgui/src/main-window.cc, libinterp/corefcn/bsxfun.cc,
libinterp/corefcn/filter.cc, libinterp/corefcn/mgorth.cc,
libinterp/corefcn/oct-stream.cc, libinterp/corefcn/pr-output.cc,
liboctave/array/Array-util.cc, liboctave/array/dim-vector.h,
liboctave/numeric/CollocWt.cc, liboctave/numeric/eigs-base.cc,
liboctave/numeric/lo-specfun.cc:
Use in-place operators in C++ code where possible.
author | Rik <rik@octave.org> |
---|---|
date | Mon, 25 May 2015 22:02:15 -0700 |
parents | 4197fc428c7d |
children |
rev | line source |
---|---|
3 | 1 /* |
2 | |
19898
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
17769
diff
changeset
|
3 Copyright (C) 1993-2015 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 | |
7016 | 9 Free Software Foundation; either version 3 of the License, or (at your |
10 option) any later version. | |
3 | 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 | |
7016 | 18 along with Octave; see the file COPYING. If not, see |
19 <http://www.gnu.org/licenses/>. | |
3 | 20 |
21 */ | |
22 | |
382 | 23 #if !defined (octave_CollocWt_h) |
24 #define octave_CollocWt_h 1 | |
25 | |
8950
d865363208d6
include <iosfwd> instead of <iostream> in header files
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
26 #include <iosfwd> |
465 | 27 |
28 #include "dMatrix.h" | |
29 #include "dColVector.h" | |
384 | 30 |
1869 | 31 class |
6108 | 32 OCTAVE_API |
1869 | 33 CollocWt |
3 | 34 { |
35 public: | |
36 | |
4055 | 37 CollocWt (void) |
1869 | 38 : 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
|
39 Alpha (0.0), Beta (0.0), r (), q (), A (), B (), initialized (false) { } |
1528 | 40 |
5275 | 41 CollocWt (octave_idx_type nc, octave_idx_type il, octave_idx_type ir) |
1869 | 42 : 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
|
43 Alpha (0.0), Beta (0.0), r (), q (), A (), B (), initialized (false) { } |
1528 | 44 |
10603
d909c4c14b63
convert villad functions to C++
John W. Eaton <jwe@octave.org>
parents:
10312
diff
changeset
|
45 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
|
46 double l, double rr) |
4587 | 47 : 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
|
48 Alpha (0.0), Beta (0.0), r (), q (), A (), B (), initialized (false) { } |
1528 | 49 |
10603
d909c4c14b63
convert villad functions to C++
John W. Eaton <jwe@octave.org>
parents:
10312
diff
changeset
|
50 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
|
51 octave_idx_type ir) |
1869 | 52 : 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
|
53 Alpha (a), Beta (b), r (), q (), A (), B (), initialized (false) { } |
1528 | 54 |
10603
d909c4c14b63
convert villad functions to C++
John W. Eaton <jwe@octave.org>
parents:
10312
diff
changeset
|
55 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
|
56 octave_idx_type ir, |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
57 double ll, double rr) |
4587 | 58 : 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
|
59 Alpha (a), Beta (b), r (), q (), A (), B (), initialized (false) { } |
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), | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
65 initialized (a.initialized) { } |
3 | 66 |
4055 | 67 CollocWt& operator = (const CollocWt& a) |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
68 { |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
69 if (this != &a) |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
70 { |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
71 n = a.n; |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
72 inc_left = a.inc_left; |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
73 inc_right = a.inc_right; |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
74 lb = a.lb; |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
75 rb = a.rb; |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
76 r = a.r; |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
77 q = a.q; |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
78 A = a.A; |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
79 B = a.B; |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
80 initialized = a.initialized; |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
81 } |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
82 return *this; |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
83 } |
3 | 84 |
1869 | 85 ~CollocWt (void) { } |
86 | |
5275 | 87 CollocWt& resize (octave_idx_type nc) |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
88 { |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
89 n = nc; |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
90 initialized = false; |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
91 return *this; |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
92 } |
1528 | 93 |
94 CollocWt& add_left (void) | |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
95 { |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
96 inc_left = 1; |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
97 initialized = false; |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
98 return *this; |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
99 } |
1528 | 100 |
101 CollocWt& delete_left (void) | |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
102 { |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
103 inc_left = 0; |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
104 initialized = false; |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
105 return *this; |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
106 } |
1528 | 107 |
3 | 108 CollocWt& set_left (double val); |
109 | |
1528 | 110 CollocWt& add_right (void) |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
111 { |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
112 inc_right = 1; |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
113 initialized = false; |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
114 return *this; |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
115 } |
1528 | 116 |
117 CollocWt& delete_right (void) | |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
118 { |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
119 inc_right = 0; |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
120 initialized = false; |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
121 return *this; |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
122 } |
1528 | 123 |
3 | 124 CollocWt& set_right (double val); |
125 | |
1528 | 126 CollocWt& set_alpha (double val) |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
127 { |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
128 Alpha = val; |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
129 initialized = false; |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
130 return *this; |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
131 } |
3 | 132 |
1528 | 133 CollocWt& set_beta (double val) |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
134 { |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
135 Beta = val; |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
136 initialized = false; |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
137 return *this; |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
138 } |
1528 | 139 |
5275 | 140 octave_idx_type ncol (void) const { return n; } |
3 | 141 |
5275 | 142 octave_idx_type left_included (void) const { return inc_left; } |
143 octave_idx_type 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 | |
5275 | 166 octave_idx_type n; |
3 | 167 |
5275 | 168 octave_idx_type inc_left; |
169 octave_idx_type inc_right; | |
3 | 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 | |
10603
d909c4c14b63
convert villad functions to C++
John W. Eaton <jwe@octave.org>
parents:
10312
diff
changeset
|
183 bool initialized; |
3 | 184 |
185 void init (void); | |
186 | |
187 void error (const char *msg); | |
188 }; | |
189 | |
190 #endif |