10#ifndef EIGEN_SPARSE_PERMUTATION_H
11#define EIGEN_SPARSE_PERMUTATION_H
19template<
typename ExpressionType,
int S
ide,
bool Transposed>
23 typedef typename remove_all<MatrixType>::type MatrixTypeCleaned;
25 typedef typename MatrixTypeCleaned::Scalar Scalar;
26 typedef typename MatrixTypeCleaned::StorageIndex StorageIndex;
37 template<
typename Dest,
typename PermutationType>
38 static inline void run(
Dest&
dst,
const PermutationType& perm,
const ExpressionType&
xpr)
47 Index jp = perm.indices().coeff(j);
53 Index jp = perm.indices().coeff(j);
56 for(
typename MatrixTypeCleaned::InnerIterator it(
mat,
jsrc); it; ++it)
57 tmp.insertByOuterInner(
jdst,it.index()) = it.value();
73 for(
typename MatrixTypeCleaned::InnerIterator it(
mat,j); it; ++it)
74 sizes[
perm_cpy.indices().coeff(it.index())]++;
77 for(
typename MatrixTypeCleaned::InnerIterator it(
mat,j); it; ++it)
78 tmp.insertByOuterInner(
perm_cpy.indices().coeff(it.index()),j) = it.value();
95template<
typename Lhs,
typename Rhs,
int ProductTag>
97 :
public evaluator<typename permutation_matrix_product<Rhs,OnTheLeft,false,SparseShape>::ReturnType>
108 : m_result(
xpr.rows(),
xpr.cols())
110 ::new (
static_cast<Base*
>(
this))
Base(m_result);
118template<
typename Lhs,
typename Rhs,
int ProductTag>
120 :
public evaluator<typename permutation_matrix_product<Lhs,OnTheRight,false,SparseShape>::ReturnType>
131 : m_result(
xpr.rows(),
xpr.cols())
133 ::new (
static_cast<Base*
>(
this))
Base(m_result);
145template<
typename SparseDerived,
typename PermDerived>
152template<
typename SparseDerived,
typename PermDerived>
153inline const Product<PermDerived, SparseDerived, AliasFreeProduct>
160template<
typename SparseDerived,
typename PermutationType>
161inline const Product<SparseDerived, Inverse<PermutationType>, AliasFreeProduct>
169template<
typename SparseDerived,
typename PermutationType>
170inline const Product<Inverse<PermutationType>, SparseDerived, AliasFreeProduct>
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index outerSize() const
Definition DenseBase.h:223
EIGEN_DEVICE_FUNC Derived & setZero()
Sets all coefficients in this expression to zero.
Definition CwiseNullaryOp.h:546
EIGEN_DEVICE_FUNC TransposeReturnType transpose()
Definition Transpose.h:182
Base class for all dense matrices, vectors, and expressions.
Definition MatrixBase.h:50
Expression of the product of two arbitrary matrices or vectors.
Definition Product.h:75
A versatible sparse matrix representation.
Definition SparseMatrix.h:98
@ ColMajor
Storage order is column major (see TopicStorageOrders).
Definition Constants.h:319
@ RowMajor
Storage order is row major (see TopicStorageOrders).
Definition Constants.h:321
@ OnTheLeft
Apply transformation on the left.
Definition Constants.h:332
@ OnTheRight
Apply transformation on the right.
Definition Constants.h:334
const unsigned int EvalBeforeNestingBit
means the expression should be evaluated by the calling expression
Definition Constants.h:70
const unsigned int RowMajorBit
for a matrix, this means that the storage order is row-major.
Definition Constants.h:66
Namespace containing all symbols from the Eigen library.
Definition LDLT.h:16
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition Meta.h:74
Definition Constants.h:535
The type used to identify a permutation storage.
Definition Constants.h:516
Definition Constants.h:537
The type used to identify a general sparse storage.
Definition Constants.h:510
Definition CoreEvaluators.h:91
Definition ProductEvaluators.h:86
Definition ProductEvaluators.h:998
Definition ForwardDeclarations.h:164