30 typedef memory::shared_ptr<gsSumOp>
Ptr;
33 typedef memory::unique_ptr<gsSumOp>
uPtr;
43 const size_t sz = m_ops.size();
44 for (
size_t i=0; i<sz; ++i)
47 "Dimensions of the operators do not fit." );
56 GISMO_ASSERT ( op0->rows() == op1->rows() && op0->cols() == op1->cols(),
"Dimensions of the operators do not fit." );
57 m_ops[0] =
give(op0); m_ops[1] =
give(op1);
61 gsSumOp(BasePtr op0, BasePtr op1, BasePtr op2 )
64 GISMO_ASSERT ( op0->rows() == op1->rows() && op0->cols() == op1->cols()
65 && op0->rows() == op2->rows() && op0->cols() == op2->cols(),
"Dimensions of the operators do not fit." );
66 m_ops[0] =
give(op0); m_ops[1] =
give(op1); m_ops[2] =
give(op2);
82 static uPtr make(BasePtr op0, BasePtr op1, BasePtr op2)
88 GISMO_ASSERT ( m_ops.empty() || ( op->rows() == m_ops[0]->rows() && op->cols() == m_ops[0]->cols() ),
89 "Dimensions of the operators do not fit." );
90 m_ops.push_back(
give(op));
95 GISMO_ASSERT ( !m_ops.empty(),
"gsSumOp::apply does not work for 0 operators." );
99 const size_t sz = m_ops.size();
101 m_ops[0]->apply(input,x);
102 for (
size_t i=1; i<sz; ++i)
104 m_ops[i]->apply(input,tmp);
111 GISMO_ASSERT( !m_ops.empty(),
"gsSumOp::rows does not work for 0 operators." );
112 return m_ops[0]->rows();
117 GISMO_ASSERT( !m_ops.empty(),
"gsSumOp::cols does not work for 0 operators." );
118 return m_ops[0]->cols();
122 const std::vector<BasePtr>&
getOps()
const {
return m_ops; }
125 std::vector<BasePtr> m_ops;
static uPtr make()
Make command returning a smart pointer.
Definition: gsSumOp.h:70
void apply(const gsMatrix< T > &input, gsMatrix< T > &x) const
apply the operator on the input vector and store the result in x
Definition: gsSumOp.h:93
gsSumOp()
Empty constructor. To be filled with addOperator()
Definition: gsSumOp.h:36
index_t rows() const
Returns the number of rows of the operator.
Definition: gsSumOp.h:109
S give(S &x)
Definition: gsMemory.h:266
gsSumOp(std::vector< BasePtr > ops)
Constructor taking a vector of Linear Operators.
Definition: gsSumOp.h:39
#define index_t
Definition: gsConfig.h:32
#define GISMO_ASSERT(cond, message)
Definition: gsDebug.h:89
static uPtr make(std::vector< BasePtr > ops)
Make command returning a smart pointer.
Definition: gsSumOp.h:74
index_t cols() const
Returns the number of columns of the operator.
Definition: gsSumOp.h:115
const std::vector< BasePtr > & getOps() const
Return a vector of shared pointers to all operators.
Definition: gsSumOp.h:122
memory::shared_ptr< gsLinearOperator > Ptr
Shared pointer for gsLinearOperator.
Definition: gsLinearOperator.h:33
memory::unique_ptr< gsSumOp > uPtr
Unique pointer for gsSumOp.
Definition: gsSumOp.h:33
static uPtr make(BasePtr op0, BasePtr op1)
Make command returning a smart pointer.
Definition: gsSumOp.h:78
Class for representing the sum of objects of type gsLinearOperator as gsLinearOperator.
Definition: gsSumOp.h:24
memory::unique_ptr< gsLinearOperator > uPtr
Unique pointer for gsLinearOperator.
Definition: gsLinearOperator.h:36
void addOperator(BasePtr op)
Add another operator.
Definition: gsSumOp.h:86
static uPtr make(BasePtr op0, BasePtr op1, BasePtr op2)
Make command returning a smart pointer.
Definition: gsSumOp.h:82
memory::shared_ptr< gsSumOp > Ptr
Shared pointer for gsSumOp.
Definition: gsSumOp.h:30
Simple abstract class for discrete operators.
Definition: gsLinearOperator.h:28
gsSumOp(BasePtr op0, BasePtr op1)
Constructor taking two Linear Operators.
Definition: gsSumOp.h:53
gsSumOp(BasePtr op0, BasePtr op1, BasePtr op2)
Constructor taking three Linear Operators.
Definition: gsSumOp.h:61
Simple abstract class for (discrete) linear operators.