19 void gsKroneckerOp<T>::apply(
const std::vector<
typename gsLinearOperator<T>::Ptr> & ops,
const gsMatrix<T> & input, gsMatrix<T> & x)
21 GISMO_ASSERT( !ops.empty(),
"Zero-term Kronecker product" );
22 const index_t nrOps = ops.size();
26 ops[0]->apply(input, x);
33 for (
index_t i = 0; i < nrOps; ++i)
39 GISMO_ASSERT (sz == input.rows(),
"The input matrix has wrong size.");
43 gsMatrix<T, Dynamic, Dynamic, ColMajor> q0, q1;
49 for (
index_t i = nrOps - 1; i >= 0; --i)
52 const index_t cols_i = ops[i]->cols();
53 const index_t rows_i = ops[i]->rows();
54 const index_t r_i = sz / cols_i;
57 q0.resize(cols_i, n * r_i);
60 ops[i]->apply(q0, temp);
61 GISMO_ASSERT (temp.rows() == rows_i && temp.cols() == n * r_i,
"The linear operator returned a matrix with unexpected size.");
65 q1 = temp.transpose();
68 q1.resize(r_i, n * rows_i);
69 for (
index_t k = 0; k != n; ++k)
70 q1.middleCols(k*rows_i, rows_i) = temp.middleCols(k*r_i, r_i).transpose();
74 sz = ( sz / cols_i) * rows_i;
88 apply(m_ops, input, x);
95 for (
size_t i = 0; i < m_ops.size(); ++i)
96 rows *= m_ops[i]->rows();
100 template <
typename T>
104 for (
size_t i = 0; i < m_ops.size(); ++i)
105 cols *= m_ops[i]->cols();
virtual index_t rows() const
Returns the number of rows of the operator.
Definition: gsKroneckerOp.hpp:92
#define index_t
Definition: gsConfig.h:32
#define GISMO_ASSERT(cond, message)
Definition: gsDebug.h:89
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
virtual index_t cols() const
Returns the number of columns of the operator.
Definition: gsKroneckerOp.hpp:101