GNU Octave  6.2.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
CollocWt.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 1993-2021 The Octave Project Developers
4 //
5 // See the file COPYRIGHT.md in the top-level directory of this
6 // distribution or <https://octave.org/copyright/>.
7 //
8 // This file is part of Octave.
9 //
10 // Octave is free software: you can redistribute it and/or modify it
11 // under the terms of the GNU General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // Octave is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU General Public License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with Octave; see the file COPYING. If not, see
22 // <https://www.gnu.org/licenses/>.
23 //
24 ////////////////////////////////////////////////////////////////////////
25 
26 #if ! defined (octave_CollocWt_h)
27 #define octave_CollocWt_h 1
28 
29 #include "octave-config.h"
30 
31 #include <iosfwd>
32 
33 #include "dMatrix.h"
34 #include "dColVector.h"
35 
36 class
37 OCTAVE_API
39 {
40 public:
41 
42  CollocWt (void)
43  : n (0), inc_left (0), inc_right (0), lb (0.0), rb (1.0),
44  Alpha (0.0), Beta (0.0), r (), q (), A (), B (), initialized (false) { }
45 
47  : n (nc), inc_left (il), inc_right (ir), lb (0.0), rb (1.0),
48  Alpha (0.0), Beta (0.0), r (), q (), A (), B (), initialized (false) { }
49 
51  double l, double rr)
52  : n (nc), inc_left (il), inc_right (ir), lb (l), rb (rr),
53  Alpha (0.0), Beta (0.0), r (), q (), A (), B (), initialized (false) { }
54 
55  CollocWt (octave_idx_type nc, double a, double b, octave_idx_type il,
56  octave_idx_type ir)
57  : n (nc), inc_left (il), inc_right (ir), lb (0.0), rb (1.0),
58  Alpha (a), Beta (b), r (), q (), A (), B (), initialized (false) { }
59 
60  CollocWt (octave_idx_type nc, double a, double b, octave_idx_type il,
61  octave_idx_type ir,
62  double ll, double rr)
63  : n (nc), inc_left (il), inc_right (ir), lb (ll), rb (rr),
64  Alpha (a), Beta (b), r (), q (), A (), B (), initialized (false) { }
65 
66  CollocWt (const CollocWt& a)
67  : n (a.n), inc_left (a.inc_left), inc_right (a.inc_right),
68  lb (a.lb), rb (a.rb), Alpha (a.Alpha), Beta (a.Beta),
69  r (a.r), q (a.q), A (a.A), B (a.B),
70  initialized (a.initialized) { }
71 
72  CollocWt& operator = (const CollocWt& a)
73  {
74  if (this != &a)
75  {
76  n = a.n;
77  inc_left = a.inc_left;
78  inc_right = a.inc_right;
79  lb = a.lb;
80  rb = a.rb;
81  r = a.r;
82  q = a.q;
83  A = a.A;
84  B = a.B;
85  initialized = a.initialized;
86  }
87  return *this;
88  }
89 
90  ~CollocWt (void) = default;
91 
93  {
94  n = nc;
95  initialized = false;
96  return *this;
97  }
98 
100  {
101  inc_left = 1;
102  initialized = false;
103  return *this;
104  }
105 
107  {
108  inc_left = 0;
109  initialized = false;
110  return *this;
111  }
112 
113  CollocWt& set_left (double val);
114 
116  {
117  inc_right = 1;
118  initialized = false;
119  return *this;
120  }
121 
123  {
124  inc_right = 0;
125  initialized = false;
126  return *this;
127  }
128 
129  CollocWt& set_right (double val);
130 
131  CollocWt& set_alpha (double val)
132  {
133  Alpha = val;
134  initialized = false;
135  return *this;
136  }
137 
138  CollocWt& set_beta (double val)
139  {
140  Beta = val;
141  initialized = false;
142  return *this;
143  }
144 
145  octave_idx_type ncol (void) const { return n; }
146 
147  octave_idx_type left_included (void) const { return inc_left; }
148  octave_idx_type right_included (void) const { return inc_right; }
149 
150  double left (void) const { return lb; }
151  double right (void) const { return rb; }
152 
153  double width (void) const { return rb - lb; }
154 
155  double alpha (void) const { return Alpha; }
156  double beta (void) const { return Beta; }
157 
158  ColumnVector roots (void) { if (! initialized) init (); return r; }
159  ColumnVector quad (void) { if (! initialized) init (); return q; }
160 
161  ColumnVector quad_weights (void) { return quad (); }
162 
163  Matrix first (void) { if (! initialized) init (); return A; }
164 
165  Matrix second (void) { if (! initialized) init (); return B; }
166 
167  friend std::ostream& operator << (std::ostream&, const CollocWt&);
168 
169 protected:
170 
172 
175 
176  double lb;
177  double rb;
178 
179  double Alpha;
180  double Beta;
181 
184 
187 
189 
190  void init (void);
191 
192  void error (const char *msg);
193 };
194 
195 #endif
template OCTAVE_API std::ostream & operator<<(std::ostream &, const Array< bool > &)
CollocWt(octave_idx_type nc, octave_idx_type il, octave_idx_type ir, double l, double rr)
Definition: CollocWt.h:50
CollocWt(octave_idx_type nc, octave_idx_type il, octave_idx_type ir)
Definition: CollocWt.h:46
double Alpha
Definition: CollocWt.h:179
~CollocWt(void)=default
ColumnVector quad_weights(void)
Definition: CollocWt.h:161
double beta(void) const
Definition: CollocWt.h:156
CollocWt & resize(octave_idx_type nc)
Definition: CollocWt.h:92
CollocWt & delete_left(void)
Definition: CollocWt.h:106
Matrix A
Definition: CollocWt.h:185
CollocWt(octave_idx_type nc, double a, double b, octave_idx_type il, octave_idx_type ir, double ll, double rr)
Definition: CollocWt.h:60
octave_idx_type inc_left
Definition: CollocWt.h:173
octave_idx_type ncol(void) const
Definition: CollocWt.h:145
ColumnVector quad(void)
Definition: CollocWt.h:159
double width(void) const
Definition: CollocWt.h:153
double left(void) const
Definition: CollocWt.h:150
Matrix B
Definition: CollocWt.h:186
CollocWt & set_beta(double val)
Definition: CollocWt.h:138
Matrix first(void)
Definition: CollocWt.h:163
octave_idx_type right_included(void) const
Definition: CollocWt.h:148
CollocWt & add_left(void)
Definition: CollocWt.h:99
double lb
Definition: CollocWt.h:176
Matrix second(void)
Definition: CollocWt.h:165
double rb
Definition: CollocWt.h:177
CollocWt & delete_right(void)
Definition: CollocWt.h:122
octave_idx_type n
Definition: CollocWt.h:171
bool initialized
Definition: CollocWt.h:188
octave_idx_type left_included(void) const
Definition: CollocWt.h:147
double alpha(void) const
Definition: CollocWt.h:155
CollocWt(void)
Definition: CollocWt.h:42
CollocWt & add_right(void)
Definition: CollocWt.h:115
ColumnVector r
Definition: CollocWt.h:182
double Beta
Definition: CollocWt.h:180
ColumnVector q
Definition: CollocWt.h:183
ColumnVector roots(void)
Definition: CollocWt.h:158
CollocWt(const CollocWt &a)
Definition: CollocWt.h:66
CollocWt & set_alpha(double val)
Definition: CollocWt.h:131
octave_idx_type inc_right
Definition: CollocWt.h:174
double right(void) const
Definition: CollocWt.h:151
CollocWt(octave_idx_type nc, double a, double b, octave_idx_type il, octave_idx_type ir)
Definition: CollocWt.h:55
Definition: dMatrix.h:42
void error(const char *fmt,...)
Definition: error.cc:968
F77_RET_T const F77_INT F77_CMPLX const F77_INT F77_CMPLX * B
F77_RET_T const F77_INT F77_CMPLX * A
octave_idx_type n
Definition: mx-inlines.cc:753
T * r
Definition: mx-inlines.cc:773