vrcore  0.45
visuReal Messkern
 All Classes Files Functions Variables
lin_op.hpp
1 // Copyright Gunter Winkler 2004 - 2007.
2 // Distributed under the Boost Software License, Version 1.0.
3 // (See accompanying file LICENSE_1_0.txt or copy at
4 // http://www.boost.org/LICENSE_1_0.txt)
5 
6 // authors: Gunter Winkler <guwi17 at gmx dot de>
7 // Konstantin Kutzkow
8 
9 
10 #ifndef __INCLUDE_LIN_OP_HPP__
11 #define __INCLUDE_LIN_OP_HPP__
12 
13 
17 template < class MATRIX >
18 class LinOp
19 {
20 public:
22  template < class VEC >
23  VEC operator()(const VEC & x) const {
24  VEC y( image_size() );
25  mult(x,y);
26  return y;
27  }
28 
30  template < class VEC1, class VEC2 >
31  void mult(const VEC1 & x, VEC2 & y) const {
32  y = prod(A, x);
33  }
34 
36  template < class VEC1, class VEC2, class VEC3 >
37  void residuum(const VEC1 & x, const VEC2 & b, VEC3 & y) const {
38  //orig: y = b - prod(A, x);
39  y = b;
40  axpy_prod(A,-x,y,false);
41  }
42 
43  std::size_t image_size() const {
44  return A.size1();
45  }
46 
47  std::size_t preimage_size() const {
48  return A.size2();
49  }
50 
52  LinOp(MATRIX const & matrix) : A(matrix) { }
53 
54 private:
55  MATRIX const & A;
56 };
57 
58 
59 #endif
60 
61 
62 
void residuum(const VEC1 &x, const VEC2 &b, VEC3 &y) const
compute y <- b - Ax
Definition: lin_op.hpp:37
LinOp(MATRIX const &matrix)
constructor from a matrix
Definition: lin_op.hpp:52
VEC operator()(const VEC &x) const
general operator interface
Definition: lin_op.hpp:23
a matrix based linear operator mapping a vector x (preimage) to a vector y (image).
Definition: lin_op.hpp:18
void mult(const VEC1 &x, VEC2 &y) const
compute y <- Ax
Definition: lin_op.hpp:31