GNU Octave  9.1.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-2024 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 
37 
39 {
40 public:
41 
43  : m_n (0), m_inc_left (0), m_inc_right (0), m_lb (0.0), m_rb (1.0),
44  m_alpha (0.0), m_beta (0.0), m_r (), m_q (), m_A (), m_B (),
45  m_initialized (false)
46  { }
47 
49  : m_n (nc), m_inc_left (il), m_inc_right (ir), m_lb (0.0), m_rb (1.0),
50  m_alpha (0.0), m_beta (0.0), m_r (), m_q (), m_A (), m_B (),
51  m_initialized (false)
52  { }
53 
55  double l, double rr)
56  : m_n (nc), m_inc_left (il), m_inc_right (ir), m_lb (l), m_rb (rr),
57  m_alpha (0.0), m_beta (0.0), m_r (), m_q (), m_A (), m_B (),
58  m_initialized (false)
59  { }
60 
61  CollocWt (octave_idx_type nc, double a, double b, octave_idx_type il,
62  octave_idx_type ir)
63  : m_n (nc), m_inc_left (il), m_inc_right (ir), m_lb (0.0), m_rb (1.0),
64  m_alpha (a), m_beta (b), m_r (), m_q (), m_A (), m_B (),
65  m_initialized (false)
66  { }
67 
68  CollocWt (octave_idx_type nc, double a, double b, octave_idx_type il,
69  octave_idx_type ir,
70  double ll, double rr)
71  : m_n (nc), m_inc_left (il), m_inc_right (ir), m_lb (ll), m_rb (rr),
72  m_alpha (a), m_beta (b), m_r (), m_q (), m_A (), m_B (),
73  m_initialized (false)
74  { }
75 
76  CollocWt (const CollocWt& a) = default;
77 
78  CollocWt& operator = (const CollocWt& a) = default;
79 
80  ~CollocWt () = default;
81 
83  {
84  m_n = nc;
85  m_initialized = false;
86  return *this;
87  }
88 
90  {
91  m_inc_left = 1;
92  m_initialized = false;
93  return *this;
94  }
95 
97  {
98  m_inc_left = 0;
99  m_initialized = false;
100  return *this;
101  }
102 
103  CollocWt& set_left (double val);
104 
106  {
107  m_inc_right = 1;
108  m_initialized = false;
109  return *this;
110  }
111 
113  {
114  m_inc_right = 0;
115  m_initialized = false;
116  return *this;
117  }
118 
119  CollocWt& set_right (double val);
120 
121  CollocWt& set_alpha (double val)
122  {
123  m_alpha = val;
124  m_initialized = false;
125  return *this;
126  }
127 
128  CollocWt& set_beta (double val)
129  {
130  m_beta = val;
131  m_initialized = false;
132  return *this;
133  }
134 
135  octave_idx_type ncol () const { return m_n; }
136 
137  octave_idx_type left_included () const { return m_inc_left; }
138  octave_idx_type right_included () const { return m_inc_right; }
139 
140  double left () const { return m_lb; }
141  double right () const { return m_rb; }
142 
143  double width () const { return m_rb - m_lb; }
144 
145  double alpha () const { return m_alpha; }
146  double beta () const { return m_beta; }
147 
149  {
150  if (! m_initialized)
151  init ();
152 
153  return m_r;
154  }
155 
157  {
158  if (! m_initialized)
159  init ();
160 
161  return m_q;
162  }
163 
164  ColumnVector quad_weights () { return quad (); }
165 
167  {
168  if (! m_initialized)
169  init ();
170 
171  return m_A;
172  }
173 
175  {
176  if (! m_initialized)
177  init ();
178 
179  return m_B;
180  }
181 
182  friend std::ostream& operator << (std::ostream&, const CollocWt&);
183 
184 protected:
185 
187 
190 
191  double m_lb;
192  double m_rb;
193 
194  double m_alpha;
195  double m_beta;
196 
199 
202 
204 
205  void init ();
206 
207  void error (const char *msg);
208 };
209 
210 OCTAVE_END_NAMESPACE(octave)
211 
212 #endif
template std::ostream & operator<<(std::ostream &, const Array< bool > &)
ColumnVector m_q
Definition: CollocWt.h:198
CollocWt(octave_idx_type nc, octave_idx_type il, octave_idx_type ir, double l, double rr)
Definition: CollocWt.h:54
CollocWt(octave_idx_type nc, octave_idx_type il, octave_idx_type ir)
Definition: CollocWt.h:48
~CollocWt()=default
CollocWt()
Definition: CollocWt.h:42
ColumnVector quad()
Definition: CollocWt.h:156
CollocWt & resize(octave_idx_type nc)
Definition: CollocWt.h:82
Matrix m_A
Definition: CollocWt.h:200
CollocWt(octave_idx_type nc, double a, double b, octave_idx_type il, octave_idx_type ir, double ll, double rr)
Definition: CollocWt.h:68
octave_idx_type left_included() const
Definition: CollocWt.h:137
CollocWt(const CollocWt &a)=default
double width() const
Definition: CollocWt.h:143
ColumnVector m_r
Definition: CollocWt.h:197
Matrix m_B
Definition: CollocWt.h:201
CollocWt & set_beta(double val)
Definition: CollocWt.h:128
ColumnVector roots()
Definition: CollocWt.h:148
CollocWt & add_left()
Definition: CollocWt.h:89
CollocWt & delete_left()
Definition: CollocWt.h:96
double alpha() const
Definition: CollocWt.h:145
Matrix first()
Definition: CollocWt.h:166
CollocWt & delete_right()
Definition: CollocWt.h:112
octave_idx_type ncol() const
Definition: CollocWt.h:135
double m_rb
Definition: CollocWt.h:192
octave_idx_type m_inc_left
Definition: CollocWt.h:188
CollocWt & add_right()
Definition: CollocWt.h:105
double m_alpha
Definition: CollocWt.h:194
octave_idx_type m_inc_right
Definition: CollocWt.h:189
bool m_initialized
Definition: CollocWt.h:203
double m_lb
Definition: CollocWt.h:191
double m_beta
Definition: CollocWt.h:195
double left() const
Definition: CollocWt.h:140
double right() const
Definition: CollocWt.h:141
octave_idx_type right_included() const
Definition: CollocWt.h:138
ColumnVector quad_weights()
Definition: CollocWt.h:164
Matrix second()
Definition: CollocWt.h:174
CollocWt & set_alpha(double val)
Definition: CollocWt.h:121
octave_idx_type m_n
Definition: CollocWt.h:186
double beta() const
Definition: CollocWt.h:146
CollocWt(octave_idx_type nc, double a, double b, octave_idx_type il, octave_idx_type ir)
Definition: CollocWt.h:61
Definition: dMatrix.h:42
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
void() error(const char *fmt,...)
Definition: error.cc:988
#define OCTAVE_API
Definition: main.cc:55