operator.hh

Go to the documentation of this file.
1 
6 #ifndef aglowavOperator_hh
7 #define aglowavOperator_hh
8 
9 #ifdef __GUNG__
10  #pragma interface
11 #endif
12 
13 #include <vector>
14 
15 #include "basics/exceptions.hh"
16 #include "basics/memory.hh"
17 #include "operator/compositions.hh"
18 #include "aglowav/space.hh"
19 
20 namespace aglowav {
21 
22  // ******************************************************************* C2W **
23 
28  template<class F = concepts::Real>
29  class C2W : public concepts::Operator<F> {
30  public:
34  C2W(const concepts::Space<F>& cnst, const Haar3d<F>& wav);
35 
40  concepts::Function<F>& fncW);
42  void operator()(const concepts::Vector<F>& fncC,
43  concepts::Vector<F>& fncW);
45  const Haar3d<F>& spaceX() const {return wav_;}
46  const concepts::Space<F>& spaceY() const {return cnst_;}
47 
48  protected:
50  std::ostream& info(std::ostream& os) const;
51 
52  private:
54  const Haar3d<F>& wav_;
56  };
57 
58  template<class F>
59  C2W<F>::C2W(const concepts::Space<F>& cnst, const Haar3d<F>& wav)
60  : concepts::Operator<F>(wav.dim(), cnst.dim()), wav_(wav), cnst_(cnst)
61  {
62  conceptsAssert(wav_.dim() == cnst_.dim(), concepts::Assertion());
63  }
64 
65  // ******************************************************************* W2C **
66 
71  template<class F = concepts::Real>
72  class W2C : public concepts::Operator<F> {
73  public:
77  W2C(const Haar3d<F>& wav, const concepts::Space<F>& cnst);
78 
79  /* Transformation from fncW to fncC
80  @throw MissingFeature
81  */
83  concepts::Function<F>& fncC);
85  void operator()(const concepts::Vector<F>& fncW,
86  concepts::Vector<F>& fncC);
88  const concepts::Space<F>& spaceX() const {return cnst_;}
89  //const AdaptConst3d<IK>& spaceX() const;
90  const Haar3d<F>& spaceY() const {return wav_;}
91 
92  protected:
94  std::ostream& info(std::ostream& os) const;
95 
96  private:
99  const Haar3d<F>& wav_;
100  };
101 
102  template<class F>
103  W2C<F>::W2C(const Haar3d<F>& wav, const concepts::Space<F>& cnst)
104  : concepts::Operator<F>(wav.dim(), cnst.dim()), cnst_(cnst), wav_(wav)
105  {
106  conceptsAssert(wav_.dim() == cnst_.dim(), concepts::Assertion());
107  }
108 
109  // **************************************************************** C2_tl2 **
110 
117  template<class F = concepts::Real>
118  class C2_tl2 : public concepts::Operator<F> {
119  public:
125  ~C2_tl2() {delete[] val_; delete[] idx_;}
126 
131  concepts::Function<F>& fncX);
132  void operator()(const concepts::Vector<F>& fncY,
133  concepts::Vector<F>& fncX);
135  const BiHaar3d<F>& spaceX() const {return spc_;}
136  const BiHaar3d<F>& spaceY() const {return spc_;}
137 
138  protected:
140  std::ostream& info(std::ostream& os) const;
141 
142  private:
150  };
151 
152  // ***************************************************************** C2tl2 **
153 
161  template<class F = concepts::Real>
162  class C2tl2 : public concepts::Operator<F> {
163  public:
169  ~C2tl2() {delete[] val_; delete[] idx_;}
170 
175  concepts::Function<F>& fncX);
176  void operator()(const concepts::Vector<F>& fncY,
177  concepts::Vector<F>& fncX);
179  const BiHaar3d<F>& spaceX() const {return spc_;}
180  const BiHaar3d<F>& spaceY() const {return spc_;}
181 
182  protected:
184  std::ostream& info(std::ostream& os) const;
185 
186  private:
194  };
195 
196  // ****************************************************************** CGt2 **
197 
206  template<class F = concepts::Real>
207  class CGt2 : public concepts::Operator<F> {
208  public:
210  CGt2(const Haar3d<F>& spc, concepts::Real t);
211 
216  concepts::Function<F>& fncX);
217  void operator()(const concepts::Vector<F>& fncY,
218  concepts::Vector<F>& fncX);
220  const Haar3d<F>& spaceX() const {return spc_;}
221  const Haar3d<F>& spaceY() const {return spc_;}
222 
223  protected:
225  std::ostream& info(std::ostream& os) const;
226 
227  private:
229  const Haar3d<F>& spc_;
232  std::vector<concepts::Real> val_;
233  };
234 
235  // ************************************************************** ComposeN **
236 
241  template<class F = concepts::Real>
242  class ComposeN : public concepts::Operator<F> {
244  uint n_;
249 
250  public:
255  ComposeN(concepts::Operator<F>** ops, uint n);
256  ~ComposeN();
257 
259  void operator()(const concepts::Function<F>& fncY,
260  concepts::Function<F>& fncX);
261  protected:
262  std::ostream& info(std::ostream& os) const;
263  };
264 
265  template<class F>
267  : concepts::Operator<F>(ops[0]->dimX(), ops[n-1]->dimY()), n_(n)
268  {
270  ops_ = concepts::newField<concepts::Operator<F>*>(n_);
271  for(uint i = 0; i < n_; i++) ops_[i] = ops[i];
272  f_ = concepts::newField<concepts::Vector<F>*>(n_-1);
273  for(uint j = 0; j < n_-1; j++)
274  f_[j] = new concepts::Vector<F>(ops_[j]->dimY());
275  }
276 
277  template<class F>
279  for(uint i = 0; i < n_-1; i++) delete f_[i];
280  delete[] f_;
281  delete[] ops_;
282  }
283 
284  template<class F>
286  concepts::Function<F>& fncX) {
287 
288  conceptsAssert((fncY.dim() == this->dimY()) &&
289  (fncX.dim() == this->dimX()), concepts::Assertion());
290 
291  ops_[n_-1]->operator()(fncY, *f_[n_-2]);
292  for(uint i = n_-1; --i;) ops_[i]->operator()(*f_[i], *f_[i-1]);
293  ops_[0]->operator()(*f_[0], fncX);
294  }
295 
296  template<class F>
297  std::ostream& ComposeN<F>::info(std::ostream& os) const {
298  return os << "aglowav::ComposeN -- (op1 * ... * op" << n_ << ")";
299  }
300 
301 } // namespace aglowav
302 
303 #endif // aglowavOperator_hh
uint n_
Number of operators to compose.
Definition: operator.hh:244
const BiHaar3d< F > & spaceX() const
Spaces of the transformation.
Definition: operator.hh:135
void operator()(const concepts::Function< F > &fncY, concepts::Function< F > &fncX)
Matrix vector multiplication.
const concepts::Space< F > & cnst_
Definition: operator.hh:55
const BiHaar3d< F > & spaceY() const
Definition: operator.hh:180
Transformation operator from the adaptive constant space to the agglomerated wavelet space without sc...
Definition: operator.hh:29
std::ostream & info(std::ostream &os) const
Information about the operator.
Abstract class for a space.
concepts::Real ** idx_
n entries, each entry points to the appropriate entry in val_
Definition: operator.hh:193
const Haar3d< F > & spaceX() const
Spaces of the transformation.
Definition: operator.hh:220
const Haar3d< F > & spaceY() const
Definition: operator.hh:90
const Haar3d< F > & spc_
Spaces of the transformation.
Definition: operator.hh:229
void operator()(const concepts::Vector< F > &fncY, concepts::Vector< F > &fncX)
Abstract class for a function.
Definition: basis.hh:21
Weighted diagonal preconditioner for the binary Wavelets.
Definition: operator.hh:207
Inverse weighted diagonal preconditioner for the binary Wavelets (inverse of C2_tl2).
Definition: operator.hh:162
std::ostream & info(std::ostream &os) const
Information about the operator.
std::ostream & info(std::ostream &os) const
Definition: operator.hh:297
concepts::Real * val_
Values of the diagonal entries (only one entry per level)
Definition: operator.hh:191
Agglomerated binary wavelet space.
Definition: space.hh:152
#define conceptsAssert(cond, exc)
Assert that a certain condition is fulfilled.
Definition: exceptions.hh:394
concepts::Real t_
Definition: operator.hh:145
virtual void operator()()
Application operator without argument.
const concepts::Space< F > & spaceX() const
Spaces of the transformation.
Definition: operator.hh:88
concepts::Real t_
Definition: operator.hh:189
const concepts::Space< F > & cnst_
Spaces of the transformation.
Definition: operator.hh:98
concepts::Real * val_
Values of the diagonal entries (only one entry per level)
Definition: operator.hh:147
void operator()(const concepts::Function< F > &fncC, concepts::Function< F > &fncW)
Transformation from fncC to fncW.
Exception class for assertions.
Definition: exceptions.hh:258
void operator()(const concepts::Vector< F > &fncW, concepts::Vector< F > &fncC)
Transformation operator from the agglomerated wavelet space to the adaptive constant space without sc...
Definition: operator.hh:72
const BiHaar3d< F > & spaceY() const
Definition: operator.hh:136
const BiHaar3d< F > & spaceX() const
Spaces of the transformation.
Definition: operator.hh:179
const Haar3d< F > & wav_
Definition: operator.hh:99
Abstract class for an operator.
Definition: ARPACK.hh:16
void operator()(const concepts::Function< F > &fncW, concepts::Function< F > &fncC)
const Haar3d< F > & wav_
Spaces of the transformation.
Definition: operator.hh:54
void operator()(const concepts::Vector< F > &fncY, concepts::Vector< F > &fncX)
std::ostream & info(std::ostream &os) const
Information about the operator.
Agglomerated wavelet space.
Definition: space.hh:56
const concepts::Space< F > & spaceY() const
Definition: operator.hh:46
void operator()(const concepts::Vector< F > &fncC, concepts::Vector< F > &fncW)
void operator()(const concepts::Function< F > &fncY, concepts::Function< F > &fncX)
Matrix vector multiplication.
Weighted diagonal preconditioner for the binary Wavelets.
Definition: operator.hh:118
concepts::Real t_
Definition: operator.hh:230
~C2_tl2()
Destructor.
Definition: operator.hh:125
ComposeN(concepts::Operator< F > **ops, uint n)
Constructor.
Definition: operator.hh:266
std::ostream & info(std::ostream &os) const
Information about the operator.
uint dim() const
Returns the dimension of the function.
Definition: basis.hh:53
C2W(const concepts::Space< F > &cnst, const Haar3d< F > &wav)
Constructor.
Definition: operator.hh:59
Composes more than 2 operators.
Definition: operator.hh:242
W2C(const Haar3d< F > &wav, const concepts::Space< F > &cnst)
Constructor.
Definition: operator.hh:103
const BiHaar3d< F > & spc_
Spaces of the transformation.
Definition: operator.hh:144
~C2tl2()
Destructor.
Definition: operator.hh:169
const Haar3d< F > & spaceX() const
Spaces of the transformation.
Definition: operator.hh:45
C2tl2(const BiHaar3d< F > &spc, concepts::Real t)
Constructor.
std::ostream & info(std::ostream &os) const
Information about the operator.
C2_tl2(const BiHaar3d< F > &spc, concepts::Real t)
Constructor.
const Haar3d< F > & spaceY() const
Definition: operator.hh:221
CGt2(const Haar3d< F > &spc, concepts::Real t)
Constructor.
virtual const uint dimY() const
Returns the size of the source space of the operator (number of columns of the corresponding matrix)
Definition: compositions.hh:98
Used for the aglowav classes for the boundary element method.
Definition: element.hh:21
void operator()(const concepts::Function< F > &fncY, concepts::Function< F > &fncX)
Matrix vector multiplication.
std::vector< concepts::Real > val_
Values of the diagonal entries.
Definition: operator.hh:232
void operator()(const concepts::Vector< F > &fncY, concepts::Vector< F > &fncX)
concepts::Vector< F > ** f_
Auxiliary vectors.
Definition: operator.hh:248
double Real
Type normally used for a floating point number.
Definition: typedefs.hh:36
concepts::Real ** idx_
n entries, each entry points to the appropriate entry in val_
Definition: operator.hh:149
concepts::Operator< F > ** ops_
Operators to compose.
Definition: operator.hh:246
Basic namespace for Concepts-2.
Definition: pml_formula.h:16
const BiHaar3d< F > & spc_
Spaces of the transformation.
Definition: operator.hh:188
Page URL: http://wiki.math.ethz.ch/bin/view/Concepts/WebHome
21 August 2020
© 2020 Eidgenössische Technische Hochschule Zürich