10 #ifndef EIGEN_SPARSE_PERMUTATION_H 11 #define EIGEN_SPARSE_PERMUTATION_H 19 template<
typename ExpressionType,
int S
ide,
bool Transposed>
25 typedef typename MatrixTypeCleaned::Scalar
Scalar;
37 template<
typename Dest,
typename PermutationType>
38 static inline void run(Dest& dst,
const PermutationType& perm,
const ExpressionType& xpr)
43 SparseMatrix<Scalar,SrcStorageOrder,StorageIndex> tmp(mat.rows(), mat.cols());
45 for(
Index j=0; j<mat.outerSize(); ++j)
48 sizes[((Side==
OnTheLeft) ^ Transposed) ? jp : j] = StorageIndex(mat.innerVector(((Side==
OnTheRight) ^ Transposed) ? jp : j).nonZeros());
51 for(
Index j=0; j<mat.outerSize(); ++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();
72 for(
Index j=0; j<mat.outerSize(); ++j)
73 for(
typename MatrixTypeCleaned::InnerIterator it(mat,j); it; ++it)
74 sizes[perm_cpy.
indices().coeff(it.index())]++;
76 for(
Index j=0; j<mat.outerSize(); ++j)
77 for(
typename MatrixTypeCleaned::InnerIterator it(mat,j); it; ++it)
78 tmp.insertByOuterInner(perm_cpy.
indices().coeff(it.index()),j) = it.value();
95 template<
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);
118 template<
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);
145 template<
typename SparseDerived,
typename PermDerived>
152 template<
typename SparseDerived,
typename PermDerived>
160 template<
typename SparseDerived,
typename PermutationType>
169 template<
typename SparseDerived,
typename PermutationType>
178 #endif // EIGEN_SPARSE_SELFADJOINTVIEW_H static void run(Dest &dst, const PermutationType &perm, const ExpressionType &xpr)
EIGEN_DEVICE_FUNC Derived & setZero(Index size)
Expression of the product of two arbitrary matrices or vectors.
A versatible sparse matrix representation.
evaluator< PlainObject > Base
internal::conditional< MoveOuter, SparseMatrix< Scalar, SrcStorageOrder, StorageIndex >, SparseMatrix< Scalar, int(SrcStorageOrder)==RowMajor?ColMajor:RowMajor, StorageIndex > >::type ReturnType
nested_eval< ExpressionType, 1 >::type MatrixType
const unsigned int RowMajorBit
Base class for permutations.
permutation_matrix_product< Lhs, OnTheRight, false, SparseShape >::ReturnType PlainObject
remove_all< MatrixType >::type MatrixTypeCleaned
EIGEN_DEVICE_FUNC const LhsNestedCleaned & lhs() const
product_evaluator(const XprType &xpr)
Base class of any sparse matrices or sparse expressions.
MatrixTypeCleaned::Scalar Scalar
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
InverseReturnType transpose() const
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorUInt128< uint64_t, uint64_t > operator*(const TensorUInt128< HL, LL > &lhs, const TensorUInt128< HR, LR > &rhs)
evaluator< PlainObject > Base
const Derived & derived() const
const IndicesType & indices() const
Product< Lhs, Rhs, AliasFreeProduct > XprType
const unsigned int EvalBeforeNestingBit
MatrixTypeCleaned::StorageIndex StorageIndex
EIGEN_DEVICE_FUNC const RhsNestedCleaned & rhs() const
product_evaluator(const XprType &xpr)
EIGEN_DEVICE_FUNC Derived & derived()
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar & coeff(Index rowId, Index colId) const
Product< Lhs, Rhs, AliasFreeProduct > XprType
permutation_matrix_product< Rhs, OnTheLeft, false, SparseShape >::ReturnType PlainObject