GNU Octave  4.4.1
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-2018 John W. Eaton
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
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11 
12 Octave is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with Octave; see the file COPYING. If not, see
19 <https://www.gnu.org/licenses/>.
20 
21 */
22 
23 #if ! defined (octave_CollocWt_h)
24 #define octave_CollocWt_h 1
25 
26 #include "octave-config.h"
27 
28 #include <iosfwd>
29 
30 #include "dMatrix.h"
31 #include "dColVector.h"
32 
33 class
34 OCTAVE_API
36 {
37 public:
38 
39  CollocWt (void)
40  : n (0), inc_left (0), inc_right (0), lb (0.0), rb (1.0),
41  Alpha (0.0), Beta (0.0), r (), q (), A (), B (), initialized (false) { }
42 
44  : n (nc), inc_left (il), inc_right (ir), lb (0.0), rb (1.0),
45  Alpha (0.0), Beta (0.0), r (), q (), A (), B (), initialized (false) { }
46 
48  double l, double rr)
49  : n (nc), inc_left (il), inc_right (ir), lb (l), rb (rr),
50  Alpha (0.0), Beta (0.0), r (), q (), A (), B (), initialized (false) { }
51 
52  CollocWt (octave_idx_type nc, double a, double b, octave_idx_type il,
53  octave_idx_type ir)
54  : n (nc), inc_left (il), inc_right (ir), lb (0.0), rb (1.0),
55  Alpha (a), Beta (b), r (), q (), A (), B (), initialized (false) { }
56 
57  CollocWt (octave_idx_type nc, double a, double b, octave_idx_type il,
58  octave_idx_type ir,
59  double ll, double rr)
60  : n (nc), inc_left (il), inc_right (ir), lb (ll), rb (rr),
61  Alpha (a), Beta (b), r (), q (), A (), B (), initialized (false) { }
62 
63  CollocWt (const CollocWt& a)
64  : n (a.n), inc_left (a.inc_left), inc_right (a.inc_right),
65  lb (a.lb), rb (a.rb), Alpha (a.Alpha), Beta (a.Beta),
66  r (a.r), q (a.q), A (a.A), B (a.B),
68 
69  CollocWt& operator = (const CollocWt& a)
70  {
71  if (this != &a)
72  {
73  n = a.n;
74  inc_left = a.inc_left;
75  inc_right = a.inc_right;
76  lb = a.lb;
77  rb = a.rb;
78  r = a.r;
79  q = a.q;
80  A = a.A;
81  B = a.B;
82  initialized = a.initialized;
83  }
84  return *this;
85  }
86 
87  ~CollocWt (void) = default;
88 
90  {
91  n = nc;
92  initialized = false;
93  return *this;
94  }
95 
97  {
98  inc_left = 1;
99  initialized = false;
100  return *this;
101  }
102 
104  {
105  inc_left = 0;
106  initialized = false;
107  return *this;
108  }
109 
110  CollocWt& set_left (double val);
111 
113  {
114  inc_right = 1;
115  initialized = false;
116  return *this;
117  }
118 
120  {
121  inc_right = 0;
122  initialized = false;
123  return *this;
124  }
125 
126  CollocWt& set_right (double val);
127 
129  {
130  Alpha = val;
131  initialized = false;
132  return *this;
133  }
134 
136  {
137  Beta = val;
138  initialized = false;
139  return *this;
140  }
141 
142  octave_idx_type ncol (void) const { return n; }
143 
144  octave_idx_type left_included (void) const { return inc_left; }
145  octave_idx_type right_included (void) const { return inc_right; }
146 
147  double left (void) const { return lb; }
148  double right (void) const { return rb; }
149 
150  double width (void) const { return rb - lb; }
151 
152  double alpha (void) const { return Alpha; }
153  double beta (void) const { return Beta; }
154 
155  ColumnVector roots (void) { if (! initialized) init (); return r; }
156  ColumnVector quad (void) { if (! initialized) init (); return q; }
157 
158  ColumnVector quad_weights (void) { return quad (); }
159 
160  Matrix first (void) { if (! initialized) init (); return A; }
161 
162  Matrix second (void) { if (! initialized) init (); return B; }
163 
164  friend std::ostream& operator << (std::ostream&, const CollocWt&);
165 
166 protected:
167 
169 
172 
173  double lb;
174  double rb;
175 
176  double Alpha;
177  double Beta;
178 
181 
184 
186 
187  void init (void);
188 
189  void error (const char *msg);
190 };
191 
192 #endif
double width(void) const
Definition: CollocWt.h:150
double Alpha
Definition: CollocWt.h:176
double Beta
Definition: CollocWt.h:177
F77_RET_T const F77_INT F77_CMPLX const F77_INT F77_CMPLX * B
CollocWt(octave_idx_type nc, double a, double b, octave_idx_type il, octave_idx_type ir, double ll, double rr)
Definition: CollocWt.h:57
identity matrix If supplied two scalar respectively For allows like xample val
Definition: data.cc:4986
double beta(void) const
Definition: CollocWt.h:153
octave_idx_type left_included(void) const
Definition: CollocWt.h:144
void error(const char *fmt,...)
Definition: error.cc:578
bool initialized
Definition: CollocWt.h:185
CollocWt & set_alpha(double val)
Definition: CollocWt.h:128
CollocWt(octave_idx_type nc, double a, double b, octave_idx_type il, octave_idx_type ir)
Definition: CollocWt.h:52
CollocWt & delete_right(void)
Definition: CollocWt.h:119
octave_idx_type ncol(void) const
Definition: CollocWt.h:142
CollocWt(const CollocWt &a)
Definition: CollocWt.h:63
CollocWt & add_right(void)
Definition: CollocWt.h:112
calling an anonymous function involves an overhead quite comparable to the overhead of an m file function Passing a handle to a built in function is because the interpreter is not involved in the internal loop For a
Definition: cellfun.cc:400
CollocWt & resize(octave_idx_type nc)
Definition: CollocWt.h:89
double right(void) const
Definition: CollocWt.h:148
double left(void) const
Definition: CollocWt.h:147
double rb
Definition: CollocWt.h:174
F77_RET_T const F77_INT F77_CMPLX * A
ColumnVector r
Definition: CollocWt.h:179
Matrix B
Definition: CollocWt.h:183
CollocWt & set_beta(double val)
Definition: CollocWt.h:135
ColumnVector roots(void)
Definition: CollocWt.h:155
CollocWt & delete_left(void)
Definition: CollocWt.h:103
CollocWt(octave_idx_type nc, octave_idx_type il, octave_idx_type ir, double l, double rr)
Definition: CollocWt.h:47
is false
Definition: cellfun.cc:400
double alpha(void) const
Definition: CollocWt.h:152
Definition: dMatrix.h:36
static bool initialized
Definition: defaults.cc:48
CollocWt & add_left(void)
Definition: CollocWt.h:96
Matrix first(void)
Definition: CollocWt.h:160
ColumnVector quad(void)
Definition: CollocWt.h:156
template OCTAVE_API std::ostream & operator<<(std::ostream &, const Array< bool > &)
ColumnVector q
Definition: CollocWt.h:180
double lb
Definition: CollocWt.h:173
octave_idx_type n
Definition: CollocWt.h:168
b
Definition: cellfun.cc:400
CollocWt(octave_idx_type nc, octave_idx_type il, octave_idx_type ir)
Definition: CollocWt.h:43
CollocWt(void)
Definition: CollocWt.h:39
ColumnVector quad_weights(void)
Definition: CollocWt.h:158
octave_idx_type right_included(void) const
Definition: CollocWt.h:145
Matrix A
Definition: CollocWt.h:182
octave_idx_type inc_right
Definition: CollocWt.h:171
octave_idx_type inc_left
Definition: CollocWt.h:170
Matrix second(void)
Definition: CollocWt.h:162