MUQ  0.4.3
ConcatenateOperator.h
Go to the documentation of this file.
1 #ifndef CONCATENATEOPERATOR_H
2 #define CONCATENATEOPERATOR_H
3 
5 
6 #include <vector>
7 
8 namespace muq
9 {
10 namespace Modeling
11 {
12 
26  {
27  public:
28  ConcatenateOperator(std::vector<std::shared_ptr<LinearOperator>> const& opsIn,
29  const int rowColIn);
30 
31  virtual ~ConcatenateOperator(){};
32 
34  virtual Eigen::MatrixXd Apply(Eigen::Ref<const Eigen::MatrixXd> const& x) override;
35 
37  virtual Eigen::MatrixXd ApplyTranspose(Eigen::Ref<const Eigen::MatrixXd> const& x) override;
38 
39 
40  virtual Eigen::MatrixXd GetMatrix() override;
41 
42  static std::shared_ptr<ConcatenateOperator> VStack(std::shared_ptr<LinearOperator> Ain,
43  std::shared_ptr<LinearOperator> Bin);
44 
45  static std::shared_ptr<ConcatenateOperator> HStack(std::shared_ptr<LinearOperator> Ain,
46  std::shared_ptr<LinearOperator> Bin);
47 
48 
49 
50  private:
51  std::vector<std::shared_ptr<LinearOperator>> ops;
52 
53  const int rowCol; // zero if stacked vertically along rows, 1 if stacked horizontally
54 
55  static int GetRows(std::vector<std::shared_ptr<LinearOperator>> const& opsIn,
56  const int rowColIn);
57 
58  static int GetCols(std::vector<std::shared_ptr<LinearOperator>> const& opsIn,
59  const int rowColIn);
60 
61  void CheckSizes();
62 
63  }; // class ConcatenateOperator
64 
65 
66 
67 } // namespace Modeling
68 } // namespace muq
69 
70 
71 #endif // #ifndef CONCATENATEOPERATOR_H
Vertical or horizontal concatenation of other linear operators.
static std::shared_ptr< ConcatenateOperator > HStack(std::shared_ptr< LinearOperator > Ain, std::shared_ptr< LinearOperator > Bin)
static std::shared_ptr< ConcatenateOperator > VStack(std::shared_ptr< LinearOperator > Ain, std::shared_ptr< LinearOperator > Bin)
virtual Eigen::MatrixXd Apply(Eigen::Ref< const Eigen::MatrixXd > const &x) override
static int GetCols(std::vector< std::shared_ptr< LinearOperator >> const &opsIn, const int rowColIn)
std::vector< std::shared_ptr< LinearOperator > > ops
static int GetRows(std::vector< std::shared_ptr< LinearOperator >> const &opsIn, const int rowColIn)
virtual Eigen::MatrixXd GetMatrix() override
ConcatenateOperator(std::vector< std::shared_ptr< LinearOperator >> const &opsIn, const int rowColIn)
virtual Eigen::MatrixXd ApplyTranspose(Eigen::Ref< const Eigen::MatrixXd > const &x) override
Generic linear operator base class.