12#ifndef EIGEN_PERMUTATIONMATRIX_H
13#define EIGEN_PERMUTATIONMATRIX_H
16#include "./InternalHeaderCheck.h"
22enum PermPermProduct_t { PermPermProduct };
29template <
typename Scalar,
typename IndicesType,
bool Transposed>
30struct permutation_dense_op {
31 EIGEN_DEVICE_FUNC
explicit permutation_dense_op(
const IndicesType& indices) : m_indices(indices) {}
33 template <
typename IndexType>
34 EIGEN_DEVICE_FUNC Scalar operator()(IndexType row, IndexType col)
const {
35 const Index k = Transposed ? Index(row) : Index(col);
36 const Index image = Transposed ? Index(col) : Index(row);
37 return Index(m_indices.coeff(k)) == image ? Scalar(1) : Scalar(0);
40 EIGEN_DEVICE_FUNC
const remove_all_t<typename IndicesType::Nested>& indices()
const {
return m_indices; }
42 typename IndicesType::Nested m_indices;
45template <
typename Scalar,
typename IndicesType,
bool Transposed>
46struct functor_traits<permutation_dense_op<Scalar, IndicesType, Transposed>> {
47 static constexpr int Cost = int(NumTraits<typename IndicesType::Scalar>::ReadCost) + int(NumTraits<Scalar>::AddCost);
48 static constexpr bool PacketAccess =
false;
49 static constexpr bool IsRepeatable =
true;
52template <
typename Scalar,
bool Transposed,
typename PermutationType>
53struct permutation_dense_expression {
54 using IndicesType = remove_all_t<typename PermutationType::IndicesType>;
55 using PlainObject = Matrix<Scalar, PermutationType::RowsAtCompileTime, PermutationType::ColsAtCompileTime, 0,
56 PermutationType::MaxRowsAtCompileTime, PermutationType::MaxColsAtCompileTime>;
57 using type = CwiseNullaryOp<permutation_dense_op<Scalar, IndicesType, Transposed>, PlainObject>;
59 static EIGEN_DEVICE_FUNC type run(
const PermutationType& permutation) {
60 return type(permutation.rows(), permutation.cols(),
61 permutation_dense_op<Scalar, IndicesType, Transposed>(permutation.indices()));
91template <
typename Derived>
93 using Traits = internal::traits<Derived>;
97#ifndef EIGEN_PARSED_BY_DOXYGEN
98 using IndicesType =
typename Traits::IndicesType;
100 Flags = Traits::Flags,
101 RowsAtCompileTime = Traits::RowsAtCompileTime,
102 ColsAtCompileTime = Traits::ColsAtCompileTime,
103 MaxRowsAtCompileTime = Traits::MaxRowsAtCompileTime,
104 MaxColsAtCompileTime = Traits::MaxColsAtCompileTime
106 using StorageIndex =
typename Traits::StorageIndex;
107 using DenseMatrixType =
109 using PlainPermutationType =
111 using PlainObject = PlainPermutationType;
118 template <
typename OtherDerived>
125 template <
typename OtherDerived>
126 Derived&
operator=(
const TranspositionsBase<OtherDerived>& tr) {
141#ifndef EIGEN_PARSED_BY_DOXYGEN
142 template <
typename DenseDerived>
145 for (Index i = 0; i <
rows(); ++i) other.coeffRef(
indices().coeff(i), i) =
typename DenseDerived::Scalar(1);
159 EIGEN_DEVICE_FUNC
constexpr const IndicesType&
indices()
const {
return derived().indices(); }
161 EIGEN_DEVICE_FUNC
constexpr IndicesType&
indices() {
return derived().indices(); }
169 StorageIndex n = StorageIndex(
size());
170 for (StorageIndex i = 0; i < n; ++i)
indices().coeffRef(i) = i;
190 eigen_assert(i >= 0 && j >= 0 && i <
size() && j <
size());
192 EIGEN_IF_CONSTEXPR ((internal::evaluator<IndicesType>::Flags &
PacketAccessBit) &&
193 internal::packet_traits<StorageIndex>::HasCmp) {
195 if (
size() >= 2 * internal::packet_traits<StorageIndex>::size) {
196 const StorageIndex first = StorageIndex(i), second = StorageIndex(j);
198 indices().cwiseTypedEqual(first).select(second,
indices().cwiseTypedEqual(second).select(first,
indices()));
204 indices().coeffRef(k) = StorageIndex(j);
205 else if (
indices().coeff(k) == j)
206 indices().coeffRef(k) = StorageIndex(i);
220 eigen_assert(i >= 0 && j >= 0 && i <
size() && j <
size());
229 inline InverseReturnType
inverse()
const {
return InverseReturnType(
derived()); }
244#ifndef EIGEN_PARSED_BY_DOXYGEN
246 template <
typename OtherDerived>
248 for (Index i = 0; i <
rows(); ++i)
indices().coeffRef(other.
indices().coeff(i)) = StorageIndex(i);
250 template <
typename Lhs,
typename Rhs>
251 void assignProduct(
const Lhs& lhs,
const Rhs& rhs) {
252 eigen_assert(lhs.cols() == rhs.rows());
253 for (Index i = 0; i <
rows(); ++i)
indices().coeffRef(i) = lhs.indices().coeff(rhs.indices().coeff(i));
262 template <
typename Other>
264 return PlainPermutationType(internal::PermPermProduct,
derived(), other.
derived());
271 template <
typename Other>
272 inline PlainPermutationType
operator*(
const InverseImpl<Other, PermutationStorage>& other)
const {
273 const auto& rhs = other.derived().nestedExpression();
274 eigen_assert(
size() == rhs.size());
275 PlainPermutationType result(
size());
277 for (
Index i = 0; i <
size(); ++i) result.indices().coeffRef(rhs.indices().coeff(i)) =
indices().coeff(i);
285 template <
typename Other>
286 friend inline PlainPermutationType
operator*(
const InverseImpl<Other, PermutationStorage>& other,
288 return PlainPermutationType(internal::PermPermProduct, other.eval(), perm);
304 while (r < n && mask[r]) r++;
319template <
int SizeAtCompileTime,
int MaxSizeAtCompileTime,
typename StorageIndex_>
320struct traits<PermutationMatrix<SizeAtCompileTime, MaxSizeAtCompileTime, StorageIndex_> >
322 Matrix<StorageIndex_, SizeAtCompileTime, SizeAtCompileTime, 0, MaxSizeAtCompileTime, MaxSizeAtCompileTime> > {
323 using StorageKind = PermutationStorage;
324 using IndicesType = Matrix<StorageIndex_, SizeAtCompileTime, 1, 0, MaxSizeAtCompileTime, 1>;
325 using StorageIndex = StorageIndex_;
344template <
int SizeAtCompileTime,
int MaxSizeAtCompileTime,
typename StorageIndex_>
345class PermutationMatrix
346 :
public PermutationBase<PermutationMatrix<SizeAtCompileTime, MaxSizeAtCompileTime, StorageIndex_> > {
348 using Traits = internal::traits<PermutationMatrix>;
351 using Nested =
const PermutationMatrix&;
353#ifndef EIGEN_PARSED_BY_DOXYGEN
354 using IndicesType =
typename Traits::IndicesType;
355 using StorageIndex =
typename Traits::StorageIndex;
358 EIGEN_DEVICE_FUNC PermutationMatrix() =
default;
363 eigen_internal_assert(
size <= NumTraits<StorageIndex>::highest());
367 template <
typename OtherDerived>
377 template <
typename Other>
381 template <
typename Other>
387 template <
typename Other>
394 template <
typename Other>
395 PermutationMatrix&
operator=(
const TranspositionsBase<Other>& tr) {
400 EIGEN_DEVICE_FUNC
constexpr const IndicesType&
indices()
const {
return m_indices; }
402 EIGEN_DEVICE_FUNC
constexpr IndicesType&
indices() {
return m_indices; }
406#ifndef EIGEN_PARSED_BY_DOXYGEN
407 template <
typename Other>
409 : m_indices(other.
derived().nestedExpression().
size()) {
410 eigen_internal_assert(m_indices.size() <= NumTraits<StorageIndex>::highest());
411 Base::assignTranspose(other.derived().nestedExpression());
413 template <
typename Lhs,
typename Rhs>
414 PermutationMatrix(internal::PermPermProduct_t,
const Lhs& lhs,
const Rhs& rhs) : m_indices(lhs.
indices().
size()) {
415 Base::assignProduct(lhs, rhs);
420 IndicesType m_indices;
424template <
int SizeAtCompileTime,
int MaxSizeAtCompileTime,
typename StorageIndex_,
int PacketAccess_>
425struct traits<Map<PermutationMatrix<SizeAtCompileTime, MaxSizeAtCompileTime, StorageIndex_>, PacketAccess_> >
427 Matrix<StorageIndex_, SizeAtCompileTime, SizeAtCompileTime, 0, MaxSizeAtCompileTime, MaxSizeAtCompileTime> > {
428 using StorageKind = PermutationStorage;
429 using IndicesType = Map<const Matrix<StorageIndex_, SizeAtCompileTime, 1, 0, MaxSizeAtCompileTime, 1>, PacketAccess_>;
430 using StorageIndex = StorageIndex_;
435template <
int SizeAtCompileTime,
int MaxSizeAtCompileTime,
typename StorageIndex_,
int PacketAccess_>
436class Map<
PermutationMatrix<SizeAtCompileTime, MaxSizeAtCompileTime, StorageIndex_>, PacketAccess_>
438 Map<PermutationMatrix<SizeAtCompileTime, MaxSizeAtCompileTime, StorageIndex_>, PacketAccess_> > {
439 using Base = PermutationBase<Map>;
440 using Traits = internal::traits<Map>;
443#ifndef EIGEN_PARSED_BY_DOXYGEN
444 using IndicesType =
typename Traits::IndicesType;
445 using StorageIndex =
typename IndicesType::Scalar;
448 inline Map(
const StorageIndex* indicesPtr) : m_indices(indicesPtr) {}
450 inline Map(
const StorageIndex* indicesPtr, Index size) : m_indices(indicesPtr, size) {}
453 template <
typename Other>
454 Map& operator=(
const PermutationBase<Other>& other) {
455 return Base::operator=(other.derived());
459 template <
typename Other>
460 Map& operator=(
const TranspositionsBase<Other>& tr) {
461 return Base::operator=(tr.derived());
464#ifndef EIGEN_PARSED_BY_DOXYGEN
468 Map& operator=(
const Map& other) {
469 m_indices = other.m_indices;
475 const IndicesType& indices()
const {
return m_indices; }
477 IndicesType& indices() {
return m_indices; }
480 IndicesType m_indices;
484template <
typename IndicesType_>
485struct traits<PermutationWrapper<IndicesType_> > {
486 using StorageKind = PermutationStorage;
488 using StorageIndex =
typename IndicesType_::Scalar;
489 using IndicesType = IndicesType_;
491 RowsAtCompileTime = IndicesType_::SizeAtCompileTime,
492 ColsAtCompileTime = IndicesType_::SizeAtCompileTime,
493 MaxRowsAtCompileTime = IndicesType::MaxSizeAtCompileTime,
494 MaxColsAtCompileTime = IndicesType::MaxSizeAtCompileTime,
511template <
typename IndicesType_>
514 using Traits = internal::traits<PermutationWrapper>;
517#ifndef EIGEN_PARSED_BY_DOXYGEN
518 using IndicesType =
typename Traits::IndicesType;
521 inline PermutationWrapper(
const IndicesType&
indices) : m_indices(
indices) {}
524 const internal::remove_all_t<typename IndicesType::Nested>&
indices()
const {
return m_indices; }
527 typename IndicesType::Nested m_indices;
532template <
typename MatrixDerived,
typename PermutationDerived>
533EIGEN_DEVICE_FUNC
const Product<MatrixDerived, PermutationDerived, DefaultProduct> operator*(
534 const MatrixBase<MatrixDerived>& matrix,
const PermutationBase<PermutationDerived>& permutation) {
535 return Product<MatrixDerived, PermutationDerived, DefaultProduct>(matrix.derived(), permutation.derived());
540template <
typename PermutationDerived,
typename MatrixDerived>
550template <
typename MatrixDerived,
typename PermutationDerived>
553 return matrix.derived() +
554 internal::permutation_dense_expression<typename MatrixDerived::Scalar, false, PermutationDerived>::run(
555 permutation.derived());
559template <
typename PermutationDerived,
typename MatrixDerived>
562 return internal::permutation_dense_expression<typename MatrixDerived::Scalar, false, PermutationDerived>::run(
563 permutation.derived()) +
568template <
typename MatrixDerived,
typename PermutationDerived>
571 return matrix.derived() -
572 internal::permutation_dense_expression<typename MatrixDerived::Scalar, false, PermutationDerived>::run(
573 permutation.derived());
577template <
typename PermutationDerived,
typename MatrixDerived>
580 return internal::permutation_dense_expression<typename MatrixDerived::Scalar, false, PermutationDerived>::run(
581 permutation.derived()) -
586template <
typename DiagonalDerived,
typename PermutationDerived>
589 return diagonal.derived() +
590 internal::permutation_dense_expression<typename DiagonalDerived::Scalar, false, PermutationDerived>::run(
591 permutation.derived());
595template <
typename PermutationDerived,
typename DiagonalDerived>
598 return internal::permutation_dense_expression<typename DiagonalDerived::Scalar, false, PermutationDerived>::run(
599 permutation.derived()) +
604template <
typename DiagonalDerived,
typename PermutationDerived>
607 return diagonal.derived() -
608 internal::permutation_dense_expression<typename DiagonalDerived::Scalar, false, PermutationDerived>::run(
609 permutation.derived());
613template <
typename PermutationDerived,
typename DiagonalDerived>
616 return internal::permutation_dense_expression<typename DiagonalDerived::Scalar, false, PermutationDerived>::run(
617 permutation.derived()) -
621template <
typename PermutationType>
623 using PlainPermutationType =
typename PermutationType::PlainPermutationType;
624 using PermTraits = internal::traits<PermutationType>;
627 InverseImpl() =
default;
630 using InverseType = Inverse<PermutationType>;
631 using EigenBase<Inverse<PermutationType> >::derived;
633#ifndef EIGEN_PARSED_BY_DOXYGEN
634 using DenseMatrixType =
typename PermutationType::DenseMatrixType;
636 RowsAtCompileTime = PermTraits::RowsAtCompileTime,
637 ColsAtCompileTime = PermTraits::ColsAtCompileTime,
638 MaxRowsAtCompileTime = PermTraits::MaxRowsAtCompileTime,
639 MaxColsAtCompileTime = PermTraits::MaxColsAtCompileTime
643#ifndef EIGEN_PARSED_BY_DOXYGEN
644 template <
typename DenseDerived>
645 void evalTo(MatrixBase<DenseDerived>& other)
const {
647 for (Index i = 0; i < derived().rows(); ++i)
648 other.coeffRef(i, derived().nestedExpression().indices().coeff(i)) =
typename DenseDerived::Scalar(1);
653 PlainPermutationType eval()
const {
return derived(); }
655 DenseMatrixType toDenseMatrix()
const {
return derived(); }
659 template <
typename OtherDerived>
660 friend const Product<OtherDerived, InverseType, DefaultProduct> operator*(
const MatrixBase<OtherDerived>& matrix,
661 const InverseType& trPerm) {
662 return Product<OtherDerived, InverseType, DefaultProduct>(matrix.derived(), trPerm.derived());
667 template <
typename OtherDerived>
668 const Product<InverseType, OtherDerived, DefaultProduct> operator*(
const MatrixBase<OtherDerived>& matrix)
const {
669 return Product<InverseType, OtherDerived, DefaultProduct>(derived(), matrix.derived());
675 template <
typename OtherDerived>
676 EIGEN_DEVICE_FUNC
auto operator+(
const MatrixBase<OtherDerived>& matrix)
const {
677 return denseExpression<typename OtherDerived::Scalar>() + matrix.derived();
680 template <
typename OtherDerived>
681 EIGEN_DEVICE_FUNC
friend auto operator+(
const MatrixBase<OtherDerived>& matrix,
const InverseType& inverse) {
682 return matrix.derived() + inverse.template denseExpression<typename OtherDerived::Scalar>();
685 template <
typename OtherDerived>
686 EIGEN_DEVICE_FUNC
auto operator-(
const MatrixBase<OtherDerived>& matrix)
const {
687 return denseExpression<typename OtherDerived::Scalar>() - matrix.derived();
690 template <
typename OtherDerived>
691 EIGEN_DEVICE_FUNC
friend auto operator-(
const MatrixBase<OtherDerived>& matrix,
const InverseType& inverse) {
692 return matrix.derived() - inverse.template denseExpression<typename OtherDerived::Scalar>();
695 template <
typename OtherDerived>
696 EIGEN_DEVICE_FUNC
auto operator+(
const DiagonalBase<OtherDerived>& diagonal)
const {
697 return denseExpression<typename OtherDerived::Scalar>() + diagonal.derived();
700 template <
typename OtherDerived>
701 EIGEN_DEVICE_FUNC
friend auto operator+(
const DiagonalBase<OtherDerived>& diagonal,
const InverseType& inverse) {
702 return diagonal.derived() + inverse.template denseExpression<typename OtherDerived::Scalar>();
705 template <
typename OtherDerived>
706 EIGEN_DEVICE_FUNC
auto operator-(
const DiagonalBase<OtherDerived>& diagonal)
const {
707 return denseExpression<typename OtherDerived::Scalar>() - diagonal.derived();
710 template <
typename OtherDerived>
711 EIGEN_DEVICE_FUNC
friend auto operator-(
const DiagonalBase<OtherDerived>& diagonal,
const InverseType& inverse) {
712 return diagonal.derived() - inverse.template denseExpression<typename OtherDerived::Scalar>();
716 template <
typename Scalar>
717 EIGEN_DEVICE_FUNC
auto denseExpression()
const {
718 using Nested = internal::remove_all_t<typename InverseType::XprTypeNestedCleaned>;
719 return internal::permutation_dense_expression<Scalar, true, Nested>::run(derived().nestedExpression());
723template <
typename Derived>
731struct AssignmentKind<DenseShape, PermutationShape> {
732 using Kind = EigenBase2EigenBase;
739template <
typename Scalar,
typename IndicesType>
740struct permutation_column_nonzeros {
741 EIGEN_DEVICE_FUNC
explicit permutation_column_nonzeros(
const IndicesType& indices) : m_indices(indices) {}
742 EIGEN_DEVICE_FUNC Index row(Index k)
const {
return Index(m_indices.coeff(k)); }
743 EIGEN_DEVICE_FUNC Scalar value(Index)
const {
return Scalar(1); }
744 const IndicesType& m_indices;
747template <
typename Scalar,
typename IndicesType,
bool Transposed,
typename Plain>
748using permutation_dense_xpr = CwiseNullaryOp<permutation_dense_op<Scalar, IndicesType, Transposed>, Plain>;
750template <
typename Scalar,
typename IndicesType,
bool Transposed,
typename Plain>
751struct is_permutation_dense_xpr<permutation_dense_xpr<Scalar, IndicesType, Transposed, Plain>> : std::true_type {};
755template <
typename Dst,
typename OtherXpr,
bool Transposed,
typename Functor,
bool NegateOther>
756struct dense_permutation_sum_fast_path
757 : bool_constant<(is_dense_shape<OtherXpr>::value || is_diagonal_shape<OtherXpr>::value) &&
758 !is_permutation_dense_xpr<OtherXpr>::value && bool(Dst::IsRowMajor) == Transposed &&
759 additive_assign_sign<Functor>::value != 0 &&
760 std::is_same<typename Dst::Scalar, typename OtherXpr::Scalar>::value &&
761 (is_diagonal_shape<OtherXpr>::value ||
762 dense_block_pass_cannot_overflow<typename Dst::Scalar, Functor, NegateOther>::value)> {};
767template <
bool DiagonalOnLeft>
768struct diagonal_permutation_sum_assignment {
769 template <
typename Dst,
typename Diagonal,
typename Permutation,
typename BinaryOp,
typename Functor>
770 EIGEN_DEVICE_FUNC
static void run(Dst& dst,
const Diagonal& diagonal,
const Permutation& permutation,
771 const BinaryOp& op,
const Functor& func) {
772 using Scalar =
typename Dst::Scalar;
773 constexpr Index kBlockColumns = 32;
774 const Scalar offDiagonalOne = DiagonalOnLeft ? op(Scalar(0), Scalar(1)) : op(Scalar(1), Scalar(0));
775 Scalar atDiagonal[kBlockColumns];
776 for (Index j = 0; j < dst.cols(); j += kBlockColumns) {
777 const Index columns = numext::mini(Index(kBlockColumns), dst.cols() - j);
778 for (Index k = 0; k < columns; ++k) {
779 const Scalar d = diagonal.value(j + k);
780 const Scalar p = permutation.row(j + k) == j + k ? Scalar(1) : Scalar(0);
781 atDiagonal[k] = DiagonalOnLeft ? op(d, p) : op(p, d);
783 EIGEN_IF_CONSTEXPR (is_plain_assign<Functor>::value) {
784 dst.middleCols(j, columns).setZero();
786 for (Index k = 0; k < columns; ++k) {
787 const Index r = permutation.row(j + k);
788 func.assignCoeff(dst.coeffRef(j + k, j + k), atDiagonal[k]);
790 func.assignCoeff(dst.coeffRef(r, j + k), offDiagonalOne);
797template <
bool OtherIsDiagonal,
bool OtherOnLeft>
798struct permutation_sum_assignment {
799 template <
typename Dst,
typename SrcXprType,
typename OtherXpr,
typename Nonzeros,
typename Functor>
800 EIGEN_DEVICE_FUNC
static void run(Dst& dst,
const SrcXprType& src,
const OtherXpr& other,
const Nonzeros& ones,
801 const Functor& func) {
802 dense_structured_sum_assignment<OtherOnLeft>::assign(dst, src, other, ones, func);
806template <
bool OtherOnLeft>
807struct permutation_sum_assignment<true, OtherOnLeft> {
808 template <
typename Dst,
typename SrcXprType,
typename OtherXpr,
typename Nonzeros,
typename Functor>
809 EIGEN_DEVICE_FUNC
static void run(Dst& dst,
const SrcXprType& src,
const OtherXpr& other,
const Nonzeros& ones,
810 const Functor& func) {
811 const diagonal_column_nonzeros<OtherXpr> diagonal(other);
812 resize_if_allowed(dst, src, func);
813 auto&& dstView = column_major_view<bool(Dst::IsRowMajor)>::run(dst);
814 diagonal_permutation_sum_assignment<OtherOnLeft>::run(dstView, diagonal, ones, src.functor(), func);
819template <
typename DstXprType,
typename BinaryOp,
typename OtherXpr,
typename Scalar,
typename IndicesType,
820 bool Transposed,
typename Plain,
typename Functor>
823 CwiseBinaryOp<BinaryOp, const OtherXpr, const permutation_dense_xpr<Scalar, IndicesType, Transposed, Plain>>,
824 Functor, Dense2Dense,
825 std::enable_if_t<is_additive_binary_op<BinaryOp>::value &&
826 dense_permutation_sum_fast_path<DstXprType, OtherXpr, Transposed, Functor, false>::value>> {
828 CwiseBinaryOp<BinaryOp, const OtherXpr, const permutation_dense_xpr<Scalar, IndicesType, Transposed, Plain>>;
829 EIGEN_DEVICE_FUNC
static void run(DstXprType& dst,
const SrcXprType& src,
const Functor& func) {
830 const auto& indices = src.rhs().functor().indices();
831 permutation_sum_assignment<is_diagonal_shape<OtherXpr>::value,
true>::run(
832 dst, src, src.lhs(), permutation_column_nonzeros<Scalar, remove_all_t<
decltype(indices)>>(indices), func);
837template <
typename DstXprType,
typename BinaryOp,
typename OtherXpr,
typename Scalar,
typename IndicesType,
838 bool Transposed,
typename Plain,
typename Functor>
841 CwiseBinaryOp<BinaryOp, const permutation_dense_xpr<Scalar, IndicesType, Transposed, Plain>, const OtherXpr>,
842 Functor, Dense2Dense,
843 std::enable_if_t<is_additive_binary_op<BinaryOp>::value &&
844 dense_permutation_sum_fast_path<DstXprType, OtherXpr, Transposed, Functor,
845 is_difference_op<BinaryOp>::value>::value &&
846 !is_default_product<OtherXpr>::value>> {
848 CwiseBinaryOp<BinaryOp, const permutation_dense_xpr<Scalar, IndicesType, Transposed, Plain>,
const OtherXpr>;
849 EIGEN_DEVICE_FUNC
static void run(DstXprType& dst,
const SrcXprType& src,
const Functor& func) {
850 const auto& indices = src.lhs().functor().indices();
851 permutation_sum_assignment<is_diagonal_shape<OtherXpr>::value,
false>::run(
852 dst, src, src.rhs(), permutation_column_nonzeros<Scalar, remove_all_t<
decltype(indices)>>(indices), func);
Derived & setZero()
Definition CwiseNullaryOp.h:521
Base class for diagonal matrices and expressions.
Definition DiagonalMatrix.h:34
Expression of the inverse of another expression.
Definition Inverse.h:44
A matrix or vector expression mapping an existing array of data.
Definition Map.h:97
constexpr Map(PointerArgType dataPtr, const StrideType &stride=StrideType())
Definition Map.h:124
Base class for all dense matrices, vectors, and expressions.
Definition MatrixBase.h:53
The matrix class, also used for vectors and row-vectors.
Definition Matrix.h:188
constexpr Scalar & coeffRef(Index rowId, Index colId)
Definition PlainObjectBase.h:205
Base class for permutations.
Definition PermutationMatrix.h:92
InverseReturnType transpose() const
Definition PermutationMatrix.h:234
Derived & applyTranspositionOnTheLeft(Index i, Index j)
Definition PermutationMatrix.h:189
void resize(Index newSize)
Definition PermutationMatrix.h:165
Index determinant() const
Definition PermutationMatrix.h:296
Index size() const
Definition PermutationMatrix.h:139
Index cols() const
Definition PermutationMatrix.h:136
InverseReturnType adjoint() const
Definition PermutationMatrix.h:240
DenseMatrixType eval() const
Definition PermutationMatrix.h:156
Derived & applyTranspositionOnTheRight(Index i, Index j)
Definition PermutationMatrix.h:219
friend PlainPermutationType operator*(const InverseImpl< Other, PermutationStorage > &other, const PermutationBase &perm)
Definition PermutationMatrix.h:286
constexpr const IndicesType & indices() const
Definition PermutationMatrix.h:159
void setIdentity()
Definition PermutationMatrix.h:168
Derived & operator=(const PermutationBase< OtherDerived > &other)
Definition PermutationMatrix.h:119
void setIdentity(Index newSize)
Definition PermutationMatrix.h:175
PlainPermutationType operator*(const InverseImpl< Other, PermutationStorage > &other) const
Definition PermutationMatrix.h:272
constexpr IndicesType & indices()
Definition PermutationMatrix.h:161
Index rows() const
Definition PermutationMatrix.h:133
InverseReturnType inverse() const
Definition PermutationMatrix.h:229
DenseMatrixType toDenseMatrix() const
Definition PermutationMatrix.h:153
Derived & operator=(const TranspositionsBase< OtherDerived > &tr)
Definition PermutationMatrix.h:126
PlainPermutationType operator*(const PermutationBase< Other > &other) const
Definition PermutationMatrix.h:263
Permutation matrix.
Definition PermutationMatrix.h:346
PermutationMatrix(const PermutationBase< OtherDerived > &other)
Definition PermutationMatrix.h:368
PermutationMatrix(const TranspositionsBase< Other > &tr)
Definition PermutationMatrix.h:382
PermutationMatrix & operator=(const PermutationBase< Other > &other)
Definition PermutationMatrix.h:388
constexpr const IndicesType & indices() const
Definition PermutationMatrix.h:400
PermutationMatrix(const MatrixBase< Other > &indices)
Definition PermutationMatrix.h:378
PermutationMatrix(Index size)
Definition PermutationMatrix.h:362
constexpr IndicesType & indices()
Definition PermutationMatrix.h:402
PermutationMatrix & operator=(const TranspositionsBase< Other > &tr)
Definition PermutationMatrix.h:395
Class to view a vector of integers as a permutation matrix.
Definition PermutationMatrix.h:512
const internal::remove_all_t< typename IndicesType::Nested > & indices() const
Definition PermutationMatrix.h:524
Expression of the product of two arbitrary matrices or vectors.
Definition Product.h:203
constexpr unsigned int PacketAccessBit
Definition Constants.h:98
Definition EigenBase.h:34
constexpr Derived & derived()
Definition EigenBase.h:50
Eigen::Index Index
The interface type of indices.
Definition EigenBase.h:44
Definition Constants.h:551