10 #ifndef EIGEN_SPARSE_PERMUTATION_H 11 #define EIGEN_SPARSE_PERMUTATION_H 19 template<
typename PermutationType,
typename MatrixType,
int S
ide,
bool Transposed>
23 typedef typename MatrixTypeNestedCleaned::Scalar
Scalar;
24 typedef typename MatrixTypeNestedCleaned::Index
Index;
35 template<
typename PermutationType,
typename MatrixType,
int S
ide,
bool Transposed>
37 :
public ReturnByValue<permut_sparsematrix_product_retval<PermutationType, MatrixType, Side, Transposed> >
40 typedef typename MatrixTypeNestedCleaned::Scalar
Scalar;
41 typedef typename MatrixTypeNestedCleaned::Index
Index;
49 : m_permutation(perm), m_matrix(matrix)
52 inline int rows()
const {
return m_matrix.rows(); }
53 inline int cols()
const {
return m_matrix.cols(); }
55 template<
typename Dest>
inline void evalTo(Dest& dst)
const 60 VectorXi sizes(m_matrix.outerSize());
61 for(Index j=0; j<m_matrix.outerSize(); ++j)
63 Index jp = m_permutation.indices().
coeff(j);
64 sizes[((Side==
OnTheLeft) ^ Transposed) ? jp : j] = m_matrix.innerVector(((Side==
OnTheRight) ^ Transposed) ? jp : j).size();
67 for(Index j=0; j<m_matrix.outerSize(); ++j)
69 Index jp = m_permutation.indices().coeff(j);
70 Index jsrc = ((Side==
OnTheRight) ^ Transposed) ? jp : j;
71 Index jdst = ((Side==
OnTheLeft) ^ Transposed) ? jp : j;
72 for(
typename MatrixTypeNestedCleaned::InnerIterator it(m_matrix,jsrc); it; ++it)
73 tmp.insertByOuterInner(jdst,it.index()) = it.value();
80 VectorXi sizes(tmp.outerSize());
88 for(Index j=0; j<m_matrix.outerSize(); ++j)
89 for(
typename MatrixTypeNestedCleaned::InnerIterator it(m_matrix,j); it; ++it)
90 sizes[perm.
indices().coeff(it.index())]++;
92 for(Index j=0; j<m_matrix.outerSize(); ++j)
93 for(
typename MatrixTypeNestedCleaned::InnerIterator it(m_matrix,j); it; ++it)
94 tmp.insertByOuterInner(perm.
indices().coeff(it.index()),j) = it.value();
110 template<
typename SparseDerived,
typename PermDerived>
119 template<
typename SparseDerived,
typename PermDerived>
123 return internal::permut_sparsematrix_product_retval<PermutationBase<PermDerived>, SparseDerived,
OnTheLeft,
false>(perm, matrix.
derived());
130 template<
typename SparseDerived,
typename PermDerived>
131 inline const internal::permut_sparsematrix_product_retval<PermutationBase<PermDerived>, SparseDerived,
OnTheRight,
true>
134 return internal::permut_sparsematrix_product_retval<PermutationBase<PermDerived>, SparseDerived,
OnTheRight,
true>(tperm.nestedPermutation(), matrix.
derived());
139 template<
typename SparseDerived,
typename PermDerived>
140 inline const internal::permut_sparsematrix_product_retval<PermutationBase<PermDerived>, SparseDerived,
OnTheLeft,
true>
143 return internal::permut_sparsematrix_product_retval<PermutationBase<PermDerived>, SparseDerived,
OnTheLeft,
true>(tperm.nestedPermutation(), matrix.
derived());
148 #endif // EIGEN_SPARSE_SELFADJOINTVIEW_H
permut_sparsematrix_product_retval(const PermutationType &perm, const MatrixType &matrix)
Transpose< PermutationBase > transpose() const
A versatible sparse matrix representation.
Expression of the transpose of a matrix.
MatrixTypeNestedCleaned::Scalar Scalar
MatrixTypeNestedCleaned::Index Index
iterative scaling algorithm to equilibrate rows and column norms in matrices
const internal::permut_matrix_product_retval< PermutationDerived, Derived, OnTheRight > operator*(const MatrixBase< Derived > &matrix, const PermutationBase< PermutationDerived > &permutation)
MatrixTypeNestedCleaned::Scalar Scalar
const unsigned int RowMajorBit
Base class for permutations.
Base class of any sparse matrices or sparse expressions.
void evalTo(Dest &dst) const
Scalar coeff(Index row, Index col) const
MatrixType::Nested m_matrix
remove_all< typename MatrixType::Nested >::type MatrixTypeNestedCleaned
const Derived & derived() const
MatrixTypeNestedCleaned::Index Index
const IndicesType & indices() const
const PermutationType & m_permutation
remove_all< typename MatrixType::Nested >::type MatrixTypeNestedCleaned
internal::conditional< MoveOuter, SparseMatrix< Scalar, SrcStorageOrder, Index >, SparseMatrix< Scalar, int(SrcStorageOrder)==RowMajor?ColMajor:RowMajor, Index > >::type ReturnType