MyraMath
ConcatenateAction.h
Go to the documentation of this file.
1 // ========================================================================= //
2 // This file is part of MyraMath, copyright (c) 2014-2019 by Ryan A Chilton //
3 // and distributed by MyraCore, LLC. See LICENSE.txt for license terms. //
4 // ========================================================================= //
5 
6 #ifndef MYRAMATH_ITERATIVE_CONCATENATEACTION_H
7 #define MYRAMATH_ITERATIVE_CONCATENATEACTION_H
8 
14 #include <myramath/MYRAMATH_EXPORT.h>
18 
20 
23 
24 namespace myra {
25 namespace detail {
26 
27 // Forward declarations.
28 template<class Number> class ConcatenateAction;
29 
31 template<class Number> class ConcatenateAction : public detail::ActionBase<Number>
32  {
33  public:
34 
35  // Useful typedefs.
36  typedef CMatrixRange<Number> X;
37  typedef MatrixRange<Number> B;
38 
40  ConcatenateAction(const intCRange& in_iblocks, const intCRange& in_jblocks);
41 
43  void insert(int i, int j, const Action<Number>& A);
44 
46  const Action<Number>& at(int i, int j) const;
47 
48  protected:
49 
50  // Size inspector, returns size(op(A))
51  virtual std::pair<int,int> size() const;
52 
53  // Assigns B = alpha*A*X + beta*B.
54  virtual void multiply(const X& x, const B& b, Number alpha, Number beta) const;
55 
56  // Assigns B = A*X.
57  virtual void multiply(const X& x, const B& b) const;
58 
59  // Virtual copy constructor.
60  virtual ActionBase<Number>* clone() const;
61 
62  private:
63 
64  // Block/stride vectors along I and J axes.
65  std::vector<int> iblocks;
66  std::vector<int> jblocks;
67  std::vector<int> istrides;
68  std::vector<int> jstrides;
69 
70  // Internal contents, a 2D arrangement of Action's
72  Actions actions;
73 
74  };
75 
76 } // namespace detail
77 
78 // Note, there's no make_ConcatenateAction() helper function, which would be
79 // of little use because the container API would be erasured-away by Action.
80 // Instead, refer to horzcat(), vertcat() and bothcat() to make these Action's.
81 
82 } // namespace myra
83 
84 #endif
Container of values, allows random (i,j) access.
Definition: Array2.h:30
const Action< Number > & at(int i, int j) const
Container API, looks up the Action at the (i,j)&#39;th block.
Definition: ConcatenateAction.cpp:54
Definition: Action.h:28
Container of values, allows random (i) access.
Applies the "Action" of a linear operator, b := A*x, used in iterative solution algorithms.
Container of values, allows random (i,j) access.
Wraps an Array2<Action>, for concatenating other Action&#39;s together.
Definition: ConcatenateAction.h:28
Definition: syntax.dox:1
Represents a const MatrixRange.
Definition: bothcat.h:22
Definition: random.cpp:45
ConcatenateAction(const intCRange &in_iblocks, const intCRange &in_jblocks)
Constructor, requires blocking vectors along I and J axes.
Definition: ConcatenateAction.cpp:21
Various utility functions/classes related to scalar Number types.
Represents a mutable MatrixRange.
Definition: conjugate.h:26
void insert(int i, int j, const Action< Number > &A)
Container API, assigns an Action for the (i,j)&#39;th block.
Definition: ConcatenateAction.cpp:38
Applies the "Action" of a linear operator, b := A*x.
Definition: Action.h:29
Implementation detail, polymorphic base type contained/erased by Action.
Represents a const intRange.
Definition: intRange.h:142
Interface class for representing subranges of contiguous int&#39;s.