39 typedef memory::shared_ptr<gsProductOp>
Ptr;
42 typedef memory::unique_ptr<gsProductOp>
uPtr;
51 const index_t sz = m_ops.size();
55 "Dimensions of the operators do not fit." );
64 "Dimensions of the operators do not fit." );
65 m_ops[0]=
give(op0); m_ops[1]=
give(op1);
71 GISMO_ASSERT ( op0->rows() == op1->cols() && op1->rows() == op2->cols(),
72 "Dimensions of the operators do not fit." );
73 m_ops[0]=
give(op0); m_ops[1]=
give(op1); m_ops[2]=
give(op2);
89 static uPtr make(BasePtr op0, BasePtr op1, BasePtr op2)
95 GISMO_ASSERT ( m_ops.empty() || m_ops.back()->rows() == op->cols(),
96 "Dimensions of the operators do not fit." );
97 m_ops.push_back(
give(op));
103 if ( m_ops.empty() ) { x = input;
return; }
107 const size_t sz = m_ops.size();
109 m_ops[0]->apply(input,x);
110 for(
size_t i=1; i<sz;++i)
113 m_ops[i]->apply(temp,x);
118 GISMO_ASSERT( !m_ops.empty(),
"gsProductOp::rows does not work for 0 operators.");
119 return m_ops.back()->rows();
124 GISMO_ASSERT( !m_ops.empty(),
"gsProductOp::cols does not work for 0 operators.");
125 return m_ops.front()->cols();
129 const std::vector<BasePtr>&
getOps()
const {
return m_ops; }
132 std::vector<BasePtr> m_ops;
static uPtr make()
Make command returning a smart pointer.
Definition: gsProductOp.h:77
memory::shared_ptr< gsProductOp > Ptr
Shared pointer for gsProductOp.
Definition: gsProductOp.h:39
gsProductOp(BasePtr op0, BasePtr op1, BasePtr op2)
Constructor taking three Linear Operators.
Definition: gsProductOp.h:69
void apply(const gsMatrix< T > &input, gsMatrix< T > &x) const
apply the operator on the input vector and store the result in x
Definition: gsProductOp.h:100
static uPtr make(std::vector< BasePtr > ops)
Make command returning a smart pointer.
Definition: gsProductOp.h:81
gsProductOp()
Empty constructor. To be filled with addOperator()
Definition: gsProductOp.h:45
index_t cols() const
Returns the number of columns of the operator.
Definition: gsProductOp.h:123
static uPtr make(BasePtr op0, BasePtr op1, BasePtr op2)
Make command returning a smart pointer.
Definition: gsProductOp.h:89
S give(S &x)
Definition: gsMemory.h:266
#define index_t
Definition: gsConfig.h:32
const std::vector< BasePtr > & getOps() const
Return a vector of shared pointers to all operators.
Definition: gsProductOp.h:129
#define GISMO_ASSERT(cond, message)
Definition: gsDebug.h:89
memory::unique_ptr< gsProductOp > uPtr
Unique pointer for gsProductOp.
Definition: gsProductOp.h:42
memory::shared_ptr< gsLinearOperator > Ptr
Shared pointer for gsLinearOperator.
Definition: gsLinearOperator.h:33
memory::unique_ptr< gsLinearOperator > uPtr
Unique pointer for gsLinearOperator.
Definition: gsLinearOperator.h:36
Class for representing the product of objects of type gsLinearOperator as gsLinearOperator.
Definition: gsProductOp.h:33
Simple abstract class for discrete operators.
Definition: gsLinearOperator.h:28
index_t rows() const
Returns the number of rows of the operator.
Definition: gsProductOp.h:117
gsProductOp(std::vector< BasePtr > ops)
Constructor taking a vector of Linear Operators.
Definition: gsProductOp.h:48
void addOperator(BasePtr op)
Add another operator at the end.
Definition: gsProductOp.h:93
gsProductOp(BasePtr op0, BasePtr op1)
Constructor taking two Linear Operators.
Definition: gsProductOp.h:61
static uPtr make(BasePtr op0, BasePtr op1)
Make command returning a smart pointer.
Definition: gsProductOp.h:85
Simple abstract class for (discrete) linear operators.