8 const int rowColIn) :
LinearOperator(GetRows(opsIn, rowColIn), GetCols(opsIn, rowColIn)), ops(opsIn), rowCol(rowColIn)
17 Eigen::MatrixXd output = Eigen::MatrixXd::Zero(nrows, x.cols());
21 for(
int i=0; i<
ops.size(); ++i){
22 output.block(currRow,0,
ops.at(i)->rows(), x.cols()) =
ops.at(i)->Apply(x);
23 currRow +=
ops.at(i)->rows();
27 for(
int i=0; i<
ops.size(); ++i){
28 output +=
ops.at(i)->Apply( x.block(currRow, 0,
ops.at(i)->cols(), x.cols()) );
29 currRow +=
ops.at(i)->cols();
40 Eigen::MatrixXd output = Eigen::MatrixXd::Zero(ncols, x.cols());
44 for(
int i=0; i<
ops.size(); ++i){
45 output +=
ops.at(i)->ApplyTranspose( x.block(currRow, 0,
ops.at(i)->rows(), x.cols()) );
46 currRow +=
ops.at(i)->rows();
50 for(
int i=0; i<
ops.size(); ++i){
51 output.block(currRow,0,
ops.at(i)->cols(), x.cols()) =
ops.at(i)->ApplyTranspose(x);
52 currRow +=
ops.at(i)->cols();
62 std::shared_ptr<LinearOperator> Bin)
64 std::vector<std::shared_ptr<LinearOperator>> temp{Ain, Bin};
65 return std::make_shared<ConcatenateOperator>(temp, 0);
69 std::shared_ptr<LinearOperator> Bin)
71 std::vector<std::shared_ptr<LinearOperator>> temp{Ain, Bin};
72 return std::make_shared<ConcatenateOperator>(temp,1);
79 Eigen::MatrixXd output(nrows, ncols);
82 for(
int i=0; i<
ops.size(); ++i){
83 output.block(currRow, 0,
ops.at(i)->rows(), ncols) =
ops.at(i)->GetMatrix();
84 currRow +=
ops.at(i)->rows();
88 for(
int i=0; i<
ops.size(); ++i){
89 output.block(0,currCol, nrows,
ops.at(i)->cols()) =
ops.at(i)->GetMatrix();
90 currCol +=
ops.at(i)->cols();
99 assert(opsIn.size()>0);
103 for(
auto& op : opsIn)
107 return opsIn.at(0)->rows();
115 assert(opsIn.size()>0);
118 return opsIn.at(0)->cols();
121 for(
auto& op : opsIn)
131 const int fixedCols =
ops.at(0)->cols();
132 for(
int i=1; i<
ops.size(); ++i){
133 if(fixedCols !=
ops.at(i)->cols())
138 const int fixedRows =
ops.at(0)->rows();
139 for(
int i=1; i<
ops.size(); ++i){
140 if(fixedRows !=
ops.at(i)->rows())
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.
Exception to throw when matrices, vectors, or arrays are the wrong size.
NLOHMANN_BASIC_JSON_TPL_DECLARATION std::string to_string(const NLOHMANN_BASIC_JSON_TPL &j)
user-defined to_string function for JSON values