10 #ifndef EIGEN_SPARSE_PERMUTATION_H
11 #define EIGEN_SPARSE_PERMUTATION_H
22 template <
typename ExpressionType,
typename PlainObjectType,
26 inline const PlainObjectType&
xpr()
const {
return m_xpr; }
30 template <
typename ExpressionType,
typename PlainObjectType>
31 struct XprHelper<ExpressionType, PlainObjectType, false> {
33 inline const PlainObjectType&
xpr()
const {
return m_xpr; }
38 template <
typename PermDerived,
bool NeedInverseEval>
48 template <
typename PermDerived>
57 template <
typename ExpressionType,
int S
ide,
bool Transposed>
72 template <
typename Dest,
typename PermutationType>
73 static inline void permute_outer(Dest& dst,
const PermutationType& perm,
const ExpressionType& xpr) {
83 Index jp = perm.indices().coeff(
j);
84 Index jsrc = NeedInversePermutation ? jp :
j;
85 Index jdst = NeedInversePermutation ?
j : jp;
86 Index begin =
tmp.outerIndexPtr()[jsrc];
87 Index end =
tmp.isCompressed() ?
tmp.outerIndexPtr()[jsrc + 1] : begin +
tmp.innerNonZeroPtr()[jsrc];
95 Index jp = perm.indices().coeff(
j);
96 Index jsrc = NeedInversePermutation ? jp :
j;
97 Index jdst = NeedInversePermutation ?
j : jp;
98 Index begin =
tmp.outerIndexPtr()[jsrc];
99 Index end =
tmp.isCompressed() ?
tmp.outerIndexPtr()[jsrc + 1] : begin +
tmp.innerNonZeroPtr()[jsrc];
104 dst = std::move(result);
107 template <
typename Dest,
typename PermutationType>
108 static inline void permute_inner(Dest& dst,
const PermutationType& perm,
const ExpressionType& xpr) {
120 const InnerPermHelper permHelper(perm);
121 const InnerPermType& innerPerm = permHelper.perm();
127 Index end =
tmp.isCompressed() ?
tmp.outerIndexPtr()[
j + 1] : begin +
tmp.innerNonZeroPtr()[
j];
136 Index end =
tmp.isCompressed() ?
tmp.outerIndexPtr()[
j + 1] : begin +
tmp.innerNonZeroPtr()[
j];
139 [&innerPerm](
StorageIndex i) { return innerPerm.indices().coeff(i); });
144 dst = std::move(result);
147 template <
typename Dest,
typename PermutationType,
bool DoOuter = NeedOuterPermutation,
148 std::enable_if_t<DoOuter, int> = 0>
149 static inline void run(Dest& dst,
const PermutationType& perm,
const ExpressionType& xpr) {
150 permute_outer(dst, perm, xpr);
153 template <
typename Dest,
typename PermutationType,
bool DoOuter = NeedOuterPermutation,
154 std::enable_if_t<!DoOuter, int> = 0>
155 static inline void run(Dest& dst,
const PermutationType& perm,
const ExpressionType& xpr) {
156 permute_inner(dst, perm, xpr);
164 template <
int ProductTag>
168 template <
int ProductTag>
177 template <
typename Lhs,
typename Rhs,
int ProductTag>
179 :
public evaluator<typename permutation_matrix_product<Rhs, OnTheLeft, false, SparseShape>::ReturnType> {
187 internal::construct_at<Base>(
this, m_result);
195 template <
typename Lhs,
typename Rhs,
int ProductTag>
197 :
public evaluator<typename permutation_matrix_product<Lhs, OnTheRight, false, SparseShape>::ReturnType> {
205 ::new (
static_cast<Base*
>(
this))
Base(m_result);
217 template <
typename SparseDerived,
typename PermDerived>
225 template <
typename SparseDerived,
typename PermDerived>
233 template <
typename SparseDerived,
typename PermutationType>
241 template <
typename SparseDerived,
typename PermutationType>
int i
Definition: BiCGSTAB_step_by_step.cpp:9
int rows
Definition: Tutorial_commainit_02.cpp:1
int cols
Definition: Tutorial_commainit_02.cpp:1
SCALAR Scalar
Definition: bench_gemm.cpp:45
Definition: PermutationMatrix.h:485
Base class for permutations.
Definition: PermutationMatrix.h:49
constexpr EIGEN_DEVICE_FUNC Derived & derived()
Definition: EigenBase.h:49
Permutation matrix.
Definition: PermutationMatrix.h:280
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT
Definition: PlainObjectBase.h:192
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT
Definition: PlainObjectBase.h:191
Expression of the product of two arbitrary matrices or vectors.
Definition: Product.h:202
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const LhsNestedCleaned & lhs() const
Definition: Product.h:230
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const RhsNestedCleaned & rhs() const
Definition: Product.h:231
void sortInnerIndices(Index begin, Index end)
Definition: SparseCompressedBase.h:144
Base class of any sparse matrices or sparse expressions.
Definition: SparseMatrixBase.h:30
A versatible sparse matrix representation.
Definition: SparseMatrix.h:121
Index nonZeros() const
Definition: SparseCompressedBase.h:64
Index outerSize() const
Definition: SparseMatrix.h:166
const Scalar * valuePtr() const
Definition: SparseMatrix.h:171
void resizeNonZeros(Index size)
Definition: SparseMatrix.h:754
const StorageIndex * outerIndexPtr() const
Definition: SparseMatrix.h:189
const StorageIndex * innerIndexPtr() const
Definition: SparseMatrix.h:180
Eigen::Map< Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic, Eigen::ColMajor >, 0, Eigen::OuterStride<> > matrix(T *data, int rows, int cols, int stride)
Definition: common.h:85
EIGEN_DONT_INLINE void transform(const Transformation &t, Data &data)
Definition: geometry.cpp:25
static constexpr lastp1_t end
Definition: IndexedViewHelper.h:79
@ AliasFreeProduct
Definition: Constants.h:505
@ OnTheLeft
Definition: Constants.h:331
@ OnTheRight
Definition: Constants.h:333
const unsigned int EvalBeforeNestingBit
Definition: Constants.h:74
void inverse(const MatrixType &m)
Definition: inverse.cpp:64
Eigen::Matrix< Scalar, Dynamic, Dynamic, ColMajor > tmp
Definition: level3_impl.h:365
@ Lhs
Definition: TensorContractionMapper.h:20
@ Rhs
Definition: TensorContractionMapper.h:20
typename remove_all< T >::type remove_all_t
Definition: Meta.h:142
EIGEN_DEVICE_FUNC void smart_copy(const T *start, const T *end, T *target)
Definition: Memory.h:569
Namespace containing all symbols from the Eigen library.
Definition: bench_norm.cpp:70
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:83
EIGEN_DEVICE_FUNC const Product< MatrixDerived, PermutationDerived, AliasFreeProduct > operator*(const MatrixBase< MatrixDerived > &matrix, const PermutationBase< PermutationDerived > &permutation)
Definition: PermutationMatrix.h:471
Extend namespace for flags.
Definition: fsi_chan_precond_driver.cc:56
type
Definition: compute_granudrum_aor.py:141
Definition: Eigen_Colamd.h:49
constexpr EIGEN_DEVICE_FUNC Derived & derived()
Definition: EigenBase.h:49
Definition: Constants.h:564
Definition: Constants.h:528
Definition: Constants.h:570
Definition: Constants.h:522
PermHelper(const PermDerived &perm)
Definition: SparsePermutation.h:51
const type & m_perm
Definition: SparsePermutation.h:54
const type & perm() const
Definition: SparsePermutation.h:52
PermDerived type
Definition: SparsePermutation.h:50
Definition: SparsePermutation.h:39
PermHelper(const PermDerived &perm)
Definition: SparsePermutation.h:43
const type & perm() const
Definition: SparsePermutation.h:44
typename PermDerived::IndicesType IndicesType
Definition: SparsePermutation.h:40
typename IndicesType::Scalar PermutationIndex
Definition: SparsePermutation.h:41
const type m_perm
Definition: SparsePermutation.h:46
XprHelper(const ExpressionType &xpr)
Definition: SparsePermutation.h:32
const PlainObjectType & m_xpr
Definition: SparsePermutation.h:35
const PlainObjectType & xpr() const
Definition: SparsePermutation.h:33
Definition: SparsePermutation.h:24
const PlainObjectType & xpr() const
Definition: SparsePermutation.h:26
const PlainObjectType m_xpr
Definition: SparsePermutation.h:28
XprHelper(const ExpressionType &xpr)
Definition: SparsePermutation.h:25
Definition: CoreEvaluators.h:104
Definition: ProductEvaluators.h:78
@ value
Definition: Meta.h:206
std::conditional_t< Evaluate, PlainObject, typename ref_selector< T >::type > type
Definition: XprHelper.h:549
static void permute_inner(Dest &dst, const PermutationType &perm, const ExpressionType &xpr)
Definition: SparsePermutation.h:108
typename MatrixTypeCleaned::Scalar Scalar
Definition: SparsePermutation.h:62
remove_all_t< MatrixType > MatrixTypeCleaned
Definition: SparsePermutation.h:60
typename MatrixTypeCleaned::StorageIndex StorageIndex
Definition: SparsePermutation.h:63
static void run(Dest &dst, const PermutationType &perm, const ExpressionType &xpr)
Definition: SparsePermutation.h:149
static void permute_outer(Dest &dst, const PermutationType &perm, const ExpressionType &xpr)
Definition: SparsePermutation.h:73
typename nested_eval< ExpressionType, 1 >::type MatrixType
Definition: SparsePermutation.h:59
Definition: ProductEvaluators.h:965
Product< Lhs, Rhs, AliasFreeProduct > XprType
Definition: SparsePermutation.h:198
product_evaluator(const XprType &xpr)
Definition: SparsePermutation.h:204
evaluator< PlainObject > Base
Definition: SparsePermutation.h:200
permutation_matrix_product< Lhs, OnTheRight, false, SparseShape >::ReturnType PlainObject
Definition: SparsePermutation.h:199
PlainObject m_result
Definition: SparsePermutation.h:210
permutation_matrix_product< Rhs, OnTheLeft, false, SparseShape >::ReturnType PlainObject
Definition: SparsePermutation.h:181
evaluator< PlainObject > Base
Definition: SparsePermutation.h:182
Product< Lhs, Rhs, AliasFreeProduct > XprType
Definition: SparsePermutation.h:180
product_evaluator(const XprType &xpr)
Definition: SparsePermutation.h:186
PlainObject m_result
Definition: SparsePermutation.h:192
Definition: ForwardDeclarations.h:221
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2