G+Smo  25.01.0
Geometry + Simulation Modules
 
Loading...
Searching...
No Matches
gsKroneckerOp.h
Go to the documentation of this file.
1
13#pragma once
14
16
17namespace gismo
18{
19
27template <class T>
28class gsKroneckerOp GISMO_FINAL : public gsLinearOperator<T>
29{
30 typedef typename gsLinearOperator<T>::Ptr BasePtr;
31public:
32
34 typedef memory::shared_ptr<gsKroneckerOp> Ptr;
35
37 typedef memory::unique_ptr<gsKroneckerOp> uPtr;
38
40 gsKroneckerOp(std::vector< BasePtr > ops)
41 : m_ops(give(ops))
42 { }
43
45 gsKroneckerOp(BasePtr op0, BasePtr op1)
46 : m_ops(2)
47 { m_ops[0] = give(op0); m_ops[1] = give(op1); }
48
50 gsKroneckerOp(BasePtr op0, BasePtr op1, BasePtr op2)
51 : m_ops(3)
52 { m_ops[0] = give(op0); m_ops[1] = give(op1); m_ops[2] = give(op2); }
53
55 static uPtr make(std::vector< BasePtr > ops)
56 { return uPtr( new gsKroneckerOp(give(ops)) ); }
57
60 static uPtr make(BasePtr op0, BasePtr op1)
61 { return uPtr( new gsKroneckerOp(give(op0),give(op1)) ); }
62
65 static uPtr make(BasePtr op0, BasePtr op1, BasePtr op2)
66 { return uPtr( new gsKroneckerOp(give(op0),give(op1),give(op2)) ); }
67
71 void addOperator( BasePtr op )
72 { m_ops.push_back(give(op)); }
73
74 virtual void apply(const gsMatrix<T> & input, gsMatrix<T> & x) const;
75 virtual index_t rows() const;
76 virtual index_t cols() const;
77
79 const std::vector<BasePtr>& getOps() const { return m_ops; }
80
82 static void apply(const std::vector<BasePtr> & ops, const gsMatrix<T> & input, gsMatrix<T> & x);
83
84private:
85 std::vector<BasePtr> m_ops;
86};
87
88}
89
90#ifndef GISMO_BUILD_LIB
91#include GISMO_HPP_HEADER(gsKroneckerOp.hpp)
92#endif
Class for representing a Kronecker product of operators of type gsLinearOperator.
Definition gsKroneckerOp.h:29
virtual index_t rows() const
Returns the number of rows of the operator.
Definition gsKroneckerOp.hpp:92
gsKroneckerOp(BasePtr op0, BasePtr op1, BasePtr op2)
Convenience constructor for Kronecker product of three linear operators.
Definition gsKroneckerOp.h:50
gsKroneckerOp(std::vector< BasePtr > ops)
Kronecker product of a given list of operators.
Definition gsKroneckerOp.h:40
static uPtr make(BasePtr op0, BasePtr op1, BasePtr op2)
Definition gsKroneckerOp.h:65
void addOperator(BasePtr op)
Definition gsKroneckerOp.h:71
const std::vector< BasePtr > & getOps() const
Return a vector of shared pointers to all operators.
Definition gsKroneckerOp.h:79
static void apply(const std::vector< BasePtr > &ops, const gsMatrix< T > &input, gsMatrix< T > &x)
Apply provided linear operators without the need of creating an object.
static uPtr make(std::vector< BasePtr > ops)
Make command returning a smart pointer.
Definition gsKroneckerOp.h:55
memory::unique_ptr< gsKroneckerOp > uPtr
Unique pointer for gsKroneckerOp.
Definition gsKroneckerOp.h:37
gsKroneckerOp(BasePtr op0, BasePtr op1)
Convenience constructor for Kronecker product of two linear operators.
Definition gsKroneckerOp.h:45
virtual void apply(const gsMatrix< T > &input, gsMatrix< T > &x) const
apply the operator on the input vector and store the result in x
Definition gsKroneckerOp.hpp:86
static uPtr make(BasePtr op0, BasePtr op1)
Definition gsKroneckerOp.h:60
virtual index_t cols() const
Returns the number of columns of the operator.
Definition gsKroneckerOp.hpp:101
memory::shared_ptr< gsKroneckerOp > Ptr
Shared pointer for gsKroneckerOp.
Definition gsKroneckerOp.h:34
Simple abstract class for discrete operators.
Definition gsLinearOperator.h:29
memory::shared_ptr< gsLinearOperator > Ptr
Shared pointer for gsLinearOperator.
Definition gsLinearOperator.h:33
A matrix with arbitrary coefficient type and fixed or dynamic size.
Definition gsMatrix.h:41
#define index_t
Definition gsConfig.h:32
Simple abstract class for (discrete) linear operators.
The G+Smo namespace, containing all definitions for the library.
S give(S &x)
Definition gsMemory.h:266