MUQ  0.4.3
BlockDiagonalOperator.h
Go to the documentation of this file.
1 #ifndef BLOCKDIAGONALOPERATOR_H
2 #define BLOCKDIAGONALOPERATOR_H
3 
5 
6 #include <vector>
7 
8 namespace muq{
9 namespace Modeling{
10 
21  {
22 
23  public:
24 
25  BlockDiagonalOperator(std::vector<std::shared_ptr<LinearOperator>> const& blocksIn);
26 
27  virtual Eigen::MatrixXd Apply(Eigen::Ref<const Eigen::MatrixXd> const& x) override;
28 
29  virtual Eigen::MatrixXd ApplyTranspose(Eigen::Ref<const Eigen::MatrixXd> const& x) override;
30 
31  virtual Eigen::MatrixXd GetMatrix() override;
32 
33  std::shared_ptr<LinearOperator> GetBlock(int i) const{return blocks.at(i);};
34  std::vector<std::shared_ptr<LinearOperator>> const& GetBlocks() const{return blocks;};
35 
36  private:
37  std::vector<std::shared_ptr<LinearOperator>> blocks;
38 
39  static int SumRows(std::vector<std::shared_ptr<LinearOperator>> const& blocksIn);
40 
41  static int SumCols(std::vector<std::shared_ptr<LinearOperator>> const& blocksIn);
42 
43  };
44 }
45 }
46 
47 
48 
49 
50 
51 
52 
53 #endif // BLOCKDIAGONALOPERATOR_H
Defines a block diagonal linear operator in terms of other linear operators.
std::vector< std::shared_ptr< LinearOperator > > const & GetBlocks() const
virtual Eigen::MatrixXd GetMatrix() override
static int SumRows(std::vector< std::shared_ptr< LinearOperator >> const &blocksIn)
BlockDiagonalOperator(std::vector< std::shared_ptr< LinearOperator >> const &blocksIn)
std::vector< std::shared_ptr< LinearOperator > > blocks
std::shared_ptr< LinearOperator > GetBlock(int i) const
virtual Eigen::MatrixXd Apply(Eigen::Ref< const Eigen::MatrixXd > const &x) override
static int SumCols(std::vector< std::shared_ptr< LinearOperator >> const &blocksIn)
virtual Eigen::MatrixXd ApplyTranspose(Eigen::Ref< const Eigen::MatrixXd > const &x) override
Generic linear operator base class.