10#ifndef EIGEN_SCALEDPERMUTATIONMATRIX_H
11#define EIGEN_SCALEDPERMUTATIONMATRIX_H
14#include "./InternalHeaderCheck.h"
20template <
typename Scalar_,
int SizeAtCompileTime,
int MaxSizeAtCompileTime,
typename StorageIndex_>
21struct traits<ScaledPermutationMatrix<Scalar_, SizeAtCompileTime, MaxSizeAtCompileTime, StorageIndex_>> {
22 using Scalar = Scalar_;
23 using StorageIndex = StorageIndex_;
26 using StorageKind = Dense;
27 using XprKind = MatrixXpr;
28 using PermutationType = PermutationMatrix<SizeAtCompileTime, MaxSizeAtCompileTime, StorageIndex_>;
29 using ScalesType = Matrix<Scalar_, SizeAtCompileTime, 1, 0, MaxSizeAtCompileTime, 1>;
30 static constexpr int RowsAtCompileTime = SizeAtCompileTime;
31 static constexpr int ColsAtCompileTime = SizeAtCompileTime;
32 static constexpr int MaxRowsAtCompileTime = MaxSizeAtCompileTime;
33 static constexpr int MaxColsAtCompileTime = MaxSizeAtCompileTime;
34 static constexpr unsigned int Flags = NestByRefBit;
38template <
typename Scalar,
typename Lhs,
typename Rhs,
typename StorageIndex>
39struct scaled_permutation_result {
40 static constexpr int Size = size_prefer_fixed(traits<Lhs>::RowsAtCompileTime, traits<Rhs>::RowsAtCompileTime);
41 static constexpr int MaxSize =
42 min_size_prefer_fixed(traits<Lhs>::MaxRowsAtCompileTime, traits<Rhs>::MaxRowsAtCompileTime);
43 using type = ScaledPermutationMatrix<Scalar, Size, MaxSize, StorageIndex>;
46template <
typename Lhs,
typename Rhs,
typename StorageIndex>
47struct scaled_permutation_product_result {
48 using LhsScalar =
typename traits<Lhs>::Scalar;
49 using RhsScalar =
typename traits<Rhs>::Scalar;
51 typename ScalarBinaryOpTraits<LhsScalar, RhsScalar, scalar_product_op<LhsScalar, RhsScalar>>::ReturnType;
52 using type =
typename scaled_permutation_result<Scalar, Lhs, Rhs, StorageIndex>::type;
56template <
typename IndicesType,
typename Result>
57EIGEN_DEVICE_FUNC
void invert_permutation_indices(
const IndicesType& indices, Result& result) {
58 using StorageIndex =
typename Result::Scalar;
59 for (Index k = 0; k < indices.size(); ++k) result.coeffRef(indices.coeff(k)) = StorageIndex(k);
81template <
typename Derived>
83 using Traits = internal::traits<Derived>;
87#ifndef EIGEN_PARSED_BY_DOXYGEN
88 using Scalar =
typename Traits::Scalar;
89 using RealScalar =
typename NumTraits<Scalar>::Real;
90 using StorageIndex =
typename Traits::StorageIndex;
91 using StorageKind =
typename Traits::StorageKind;
92 using PermutationType =
typename Traits::PermutationType;
93 using ScalesType =
typename Traits::ScalesType;
94 using IndicesType =
typename PermutationType::IndicesType;
95 static constexpr int RowsAtCompileTime = Traits::RowsAtCompileTime;
96 static constexpr int ColsAtCompileTime = Traits::ColsAtCompileTime;
97 static constexpr int MaxRowsAtCompileTime = Traits::MaxRowsAtCompileTime;
98 static constexpr int MaxColsAtCompileTime = Traits::MaxColsAtCompileTime;
99 static constexpr int SizeAtCompileTime = internal::size_at_compile_time(RowsAtCompileTime, ColsAtCompileTime);
100 static constexpr int MaxSizeAtCompileTime =
101 internal::size_at_compile_time(MaxRowsAtCompileTime, MaxColsAtCompileTime);
102 static constexpr bool IsVectorAtCompileTime =
false;
103 static constexpr unsigned int Flags = Traits::Flags;
104 using DenseMatrixType =
107 using Nested =
const Derived&;
119 EIGEN_DEVICE_FUNC
constexpr const IndicesType&
indices()
const {
return derived().indices(); }
121 EIGEN_DEVICE_FUNC
const ScalesType&
scales()
const {
return derived().scales(); }
125 eigen_assert(row >= 0 && col >= 0 && row <
rows() && col <
cols());
132#ifndef EIGEN_PARSED_BY_DOXYGEN
133 template <
typename DenseDerived>
143 PlainObject result(
rows());
146 result.indices().coeffRef(image) = StorageIndex(k);
147 result.scales().coeffRef(image) = Scalar(1) /
scales().coeff(k);
154 PlainObject result(
rows());
157 result.indices().coeffRef(image) = StorageIndex(k);
158 result.scales().coeffRef(image) =
scales().coeff(k);
166 result.scales() = result.scales().conjugate();
172 internal::scaled_product<Scalar> det = internal::scaled_prod(
scales());
179 template <
typename OtherDerived>
187 template <
typename OtherDerived>
194 template <
typename OtherDerived>
201 template <
typename OtherDerived>
213 template <
typename OtherDerived>
214 typename internal::scaled_permutation_product_result<Derived, OtherDerived, StorageIndex>::type
operator*(
216 using Result =
typename internal::scaled_permutation_product_result<Derived, OtherDerived, StorageIndex>::type;
217 EIGEN_INTERNAL_ASSERT_SAME_ROWS(*
this, other);
222 template <
typename OtherDerived>
223 friend typename internal::scaled_permutation_product_result<OtherDerived, Derived, StorageIndex>::type
operator*(
225 using Result =
typename internal::scaled_permutation_product_result<OtherDerived, Derived, StorageIndex>::type;
226 EIGEN_INTERNAL_ASSERT_SAME_ROWS(other, scaled);
227 Result result(scaled.
rows());
228 result.indices() = scaled.
indices();
229 for (
Index k = 0; k < scaled.
rows(); ++k)
230 result.scales().coeffRef(k) = other.
diagonal().coeff(scaled.
indices().coeff(k)) * scaled.
scales().coeff(k);
235 template <
typename OtherDerived>
237 EIGEN_INTERNAL_ASSERT_SAME_ROWS(*
this, other);
238 PlainObject result(
rows());
241 result.indices().coeffRef(k) =
indices().coeff(source);
242 result.scales().coeffRef(k) =
scales().coeff(source);
248 template <
typename OtherDerived>
250 EIGEN_INTERNAL_ASSERT_SAME_ROWS(other, scaled);
251 PlainObject result(scaled.
rows());
252 for (
Index k = 0; k < scaled.
rows(); ++k)
253 result.indices().coeffRef(k) = StorageIndex(other.
indices().coeff(scaled.
indices().coeff(k)));
254 result.scales() = scaled.
scales();
259 template <
typename OtherDerived>
260 PlainObject
operator*(
const InverseImpl<OtherDerived, PermutationStorage>& other)
const {
261 EIGEN_INTERNAL_ASSERT_SAME_ROWS(*
this, other);
263 internal::invert_permutation_indices(other.derived().nestedExpression().indices(),
inverse);
264 PlainObject result(
rows());
267 result.indices().coeffRef(k) =
indices().coeff(source);
268 result.scales().coeffRef(k) =
scales().coeff(source);
274 template <
typename OtherDerived>
275 friend PlainObject
operator*(
const InverseImpl<OtherDerived, PermutationStorage>& other,
277 EIGEN_INTERNAL_ASSERT_SAME_ROWS(other, scaled);
279 internal::invert_permutation_indices(other.derived().nestedExpression().indices(),
inverse);
280 PlainObject result(scaled.
rows());
281 for (
Index k = 0; k < scaled.
rows(); ++k) result.indices().coeffRef(k) =
inverse.coeff(scaled.
indices().coeff(k));
282 result.scales() = scaled.
scales();
287 template <
typename OtherDerived>
288 typename internal::scaled_permutation_product_result<Derived, OtherDerived, StorageIndex>::type
operator*(
290 using Result =
typename internal::scaled_permutation_product_result<Derived, OtherDerived, StorageIndex>::type;
291 EIGEN_INTERNAL_ASSERT_SAME_ROWS(*
this, other);
292 Result result(
rows());
295 result.indices().coeffRef(k) =
indices().coeff(source);
296 result.scales().coeffRef(k) =
scales().coeff(source) * other.
scales().coeff(k);
306 return PlainObject(scaled.
indices(), alpha * scaled.
scales());
315 template <
typename OtherDerived>
316 EIGEN_DEVICE_FUNC
friend const EIGEN_CWISE_BINARY_RETURN_TYPE(OtherDerived, Derived, internal::scalar_sum_op)
318 return EIGEN_CWISE_BINARY_RETURN_TYPE(OtherDerived, Derived, internal::scalar_sum_op)(lhs.derived(), rhs.derived());
322 template <
typename OtherDerived>
323 EIGEN_DEVICE_FUNC
friend const EIGEN_CWISE_BINARY_RETURN_TYPE(Derived, OtherDerived, internal::scalar_sum_op)
325 return EIGEN_CWISE_BINARY_RETURN_TYPE(Derived, OtherDerived, internal::scalar_sum_op)(lhs.derived(), rhs.derived());
329 template <
typename OtherDerived>
330 EIGEN_DEVICE_FUNC
friend const EIGEN_CWISE_BINARY_RETURN_TYPE(OtherDerived, Derived, internal::scalar_difference_op)
332 return EIGEN_CWISE_BINARY_RETURN_TYPE(OtherDerived, Derived, internal::scalar_difference_op)(lhs.derived(),
337 template <
typename OtherDerived>
338 EIGEN_DEVICE_FUNC
friend const EIGEN_CWISE_BINARY_RETURN_TYPE(Derived, OtherDerived, internal::scalar_difference_op)
340 return EIGEN_CWISE_BINARY_RETURN_TYPE(Derived, OtherDerived, internal::scalar_difference_op)(lhs.derived(),
360template <
typename Scalar_,
int SizeAtCompileTime,
int MaxSizeAtCompileTime,
typename StorageIndex_>
363 ScaledPermutationMatrix<Scalar_, SizeAtCompileTime, MaxSizeAtCompileTime, StorageIndex_>> {
365 using Traits = internal::traits<ScaledPermutationMatrix>;
368#ifndef EIGEN_PARSED_BY_DOXYGEN
369 using Scalar = Scalar_;
370 using StorageIndex = StorageIndex_;
371 using PermutationType =
typename Traits::PermutationType;
372 using ScalesType =
typename Traits::ScalesType;
373 using IndicesType =
typename PermutationType::IndicesType;
383 template <
typename PermutationDerived,
typename DiagonalDerived>
386 : m_permutation(
permutation), m_scales(diagonal.diagonal()) {
387 EIGEN_INTERNAL_ASSERT_SAME_ROWS(
permutation, diagonal);
391 template <
typename IndicesDerived,
typename ScalesDerived>
399 template <
typename OtherDerived>
404 template <
typename OtherDerived>
406 : m_permutation(diagonal.
rows()), m_scales(diagonal.diagonal()) {
407 m_permutation.setIdentity();
411 template <
typename OtherDerived>
416 template <
typename OtherDerived>
419 m_scales = other.
scales();
424 EIGEN_DEVICE_FUNC
const PermutationType&
permutation()
const {
return m_permutation; }
426 EIGEN_DEVICE_FUNC PermutationType&
permutation() {
return m_permutation; }
428 EIGEN_DEVICE_FUNC
constexpr const IndicesType&
indices()
const {
return m_permutation.indices(); }
430 EIGEN_DEVICE_FUNC
constexpr IndicesType&
indices() {
return m_permutation.indices(); }
432 EIGEN_DEVICE_FUNC
const ScalesType&
scales()
const {
return m_scales; }
434 EIGEN_DEVICE_FUNC ScalesType&
scales() {
return m_scales; }
438 m_permutation.resize(
size);
439 m_scales.resize(
size);
444 m_permutation.setIdentity();
455 PermutationType m_permutation;
465template <
typename PermutationDerived,
typename DiagonalDerived>
466typename internal::scaled_permutation_result<
typename DiagonalDerived::Scalar, PermutationDerived, DiagonalDerived,
467 typename PermutationDerived::StorageIndex>::type
470 typename internal::scaled_permutation_result<
typename DiagonalDerived::Scalar, PermutationDerived,
471 DiagonalDerived,
typename PermutationDerived::StorageIndex>::type;
472 EIGEN_INTERNAL_ASSERT_SAME_ROWS(
permutation, diagonal);
478template <
typename DiagonalDerived,
typename PermutationDerived>
479typename internal::scaled_permutation_result<
typename DiagonalDerived::Scalar, PermutationDerived, DiagonalDerived,
480 typename PermutationDerived::StorageIndex>::type
483 typename internal::scaled_permutation_result<
typename DiagonalDerived::Scalar, PermutationDerived,
484 DiagonalDerived,
typename PermutationDerived::StorageIndex>::type;
485 EIGEN_INTERNAL_ASSERT_SAME_ROWS(
permutation, diagonal);
495template <
typename PermutationType,
typename DiagonalDerived>
496typename internal::scaled_permutation_result<
typename DiagonalDerived::Scalar, PermutationType, DiagonalDerived,
497 typename PermutationType::StorageIndex>::type
501 typename internal::scaled_permutation_result<
typename DiagonalDerived::Scalar, PermutationType, DiagonalDerived,
502 typename PermutationType::StorageIndex>::type;
503 EIGEN_INTERNAL_ASSERT_SAME_ROWS(
inverse, diagonal);
505 internal::invert_permutation_indices(
inverse.derived().nestedExpression().indices(), result.indices());
506 result.scales() = diagonal.
diagonal();
512template <
typename DiagonalDerived,
typename PermutationType>
513typename internal::scaled_permutation_result<
typename DiagonalDerived::Scalar, PermutationType, DiagonalDerived,
514 typename PermutationType::StorageIndex>::type
516 const InverseImpl<PermutationType, PermutationStorage>&
inverse) {
518 typename internal::scaled_permutation_result<
typename DiagonalDerived::Scalar, PermutationType, DiagonalDerived,
519 typename PermutationType::StorageIndex>::type;
520 EIGEN_INTERNAL_ASSERT_SAME_ROWS(
inverse, diagonal);
522 internal::invert_permutation_indices(
inverse.derived().nestedExpression().indices(), result.indices());
524 result.scales().coeffRef(k) = diagonal.
diagonal().coeff(result.indices().coeff(k));
530template <
typename Scalar_,
int SizeAtCompileTime,
int MaxSizeAtCompileTime,
typename StorageIndex_>
531struct evaluator_traits<
ScaledPermutationMatrix<Scalar_, SizeAtCompileTime, MaxSizeAtCompileTime, StorageIndex_>> {
532 using Kind = IndexBased;
533 using Shape = ScaledPermutationShape;
538template <
typename Scalar_,
int SizeAtCompileTime,
int MaxSizeAtCompileTime,
typename StorageIndex_>
539struct evaluator<ScaledPermutationMatrix<Scalar_, SizeAtCompileTime, MaxSizeAtCompileTime, StorageIndex_>>
540 : evaluator_base<ScaledPermutationMatrix<Scalar_, SizeAtCompileTime, MaxSizeAtCompileTime, StorageIndex_>> {
541 using XprType = ScaledPermutationMatrix<Scalar_, SizeAtCompileTime, MaxSizeAtCompileTime, StorageIndex_>;
542 using Scalar = Scalar_;
543 using CoeffReturnType = Scalar;
545 static constexpr int CoeffReadCost =
546 int(NumTraits<StorageIndex_>::ReadCost) + int(NumTraits<Scalar>::ReadCost) + int(NumTraits<Scalar>::AddCost);
547 static constexpr unsigned int Flags = 0;
548 static constexpr int Alignment = 0;
550 EIGEN_DEVICE_FUNC
explicit evaluator(
const XprType& xpr) : m_indices(xpr.indices()), m_scales(xpr.scales()) {}
552 EIGEN_DEVICE_FUNC Scalar coeff(Index row, Index col)
const {
553 return Index(m_indices.coeff(col)) == row ? m_scales.coeff(col) : Scalar(0);
557 EIGEN_DEVICE_FUNC Scalar coeff(Index index)
const {
558 eigen_assert(index == 0);
559 return m_scales.coeff(index);
563 evaluator<typename XprType::IndicesType> m_indices;
564 evaluator<typename XprType::ScalesType> m_scales;
567struct ScaledPermutation2Dense {};
570struct AssignmentKind<DenseShape, ScaledPermutationShape> {
571 using Kind = ScaledPermutation2Dense;
575template <
typename DstXprType,
typename SrcXprType,
typename Functor>
576struct Assignment<DstXprType, SrcXprType, Functor, ScaledPermutation2Dense> {
577 static EIGEN_DEVICE_FUNC
void run(
578 DstXprType& dst,
const SrcXprType& src,
579 const internal::assign_op<typename DstXprType::Scalar, typename SrcXprType::Scalar>&) {
580 if (dst.rows() != src.rows() || dst.cols() != src.cols()) dst.resize(src.rows(), src.cols());
582 for (Index k = 0; k < src.rows(); ++k) dst.coeffRef(src.indices().coeff(k), k) = src.scales().coeff(k);
585 static EIGEN_DEVICE_FUNC
void run(
586 DstXprType& dst,
const SrcXprType& src,
587 const internal::add_assign_op<typename DstXprType::Scalar, typename SrcXprType::Scalar>&) {
588 EIGEN_INTERNAL_ASSERT_SAME_SHAPE(dst, src);
589 for (Index k = 0; k < src.rows(); ++k) dst.coeffRef(src.indices().coeff(k), k) += src.scales().coeff(k);
592 static EIGEN_DEVICE_FUNC
void run(
593 DstXprType& dst,
const SrcXprType& src,
594 const internal::sub_assign_op<typename DstXprType::Scalar, typename SrcXprType::Scalar>&) {
595 EIGEN_INTERNAL_ASSERT_SAME_SHAPE(dst, src);
596 for (Index k = 0; k < src.rows(); ++k) dst.coeffRef(src.indices().coeff(k), k) -= src.scales().coeff(k);
610template <
typename Lhs,
typename Rhs,
int ProductTag>
611struct generic_product_impl<Lhs, Rhs, ScaledPermutationShape, DenseShape, ProductTag>
612 : generic_product_impl_base<Lhs, Rhs,
613 generic_product_impl<Lhs, Rhs, ScaledPermutationShape, DenseShape, ProductTag>> {
614 using Scalar =
typename Product<Lhs, Rhs>::Scalar;
616 template <
typename Dest>
617 static EIGEN_DEVICE_FUNC
void evalTo(Dest& dst,
const Lhs& lhs,
const Rhs& rhs) {
618 permutation_matrix_product<Rhs, OnTheLeft, false, DenseShape>::run(dst, lhs.permutation(), rhs);
619 for (Index k = 0; k < lhs.rows(); ++k) {
620 auto row = dst.row(lhs.indices().coeff(k));
621 row = lhs.scales().coeff(k) * row;
625 template <
typename Dest>
626 static EIGEN_DEVICE_FUNC
void scaleAndAddTo(Dest& dst,
const Lhs& lhs,
const Rhs& rhs,
const Scalar& alpha) {
627 typename nested_eval<Rhs, 1>::type rhsNested(rhs);
628 for (Index k = 0; k < lhs.rows(); ++k)
629 dst.row(lhs.indices().coeff(k)) += (alpha * lhs.scales().coeff(k)) * rhsNested.row(k);
633template <
typename Lhs,
typename Rhs,
int ProductTag>
634struct generic_product_impl<Lhs, Rhs, DenseShape, ScaledPermutationShape, ProductTag>
635 : generic_product_impl_base<Lhs, Rhs,
636 generic_product_impl<Lhs, Rhs, DenseShape, ScaledPermutationShape, ProductTag>> {
637 using Scalar =
typename Product<Lhs, Rhs>::Scalar;
639 template <
typename Dest>
640 static EIGEN_DEVICE_FUNC
void evalTo(Dest& dst,
const Lhs& lhs,
const Rhs& rhs) {
641 permutation_matrix_product<Lhs, OnTheRight, false, DenseShape>::run(dst, rhs.permutation(), lhs);
642 for (Index k = 0; k < rhs.rows(); ++k) dst.col(k) *= rhs.scales().coeff(k);
645 template <
typename Dest>
646 static EIGEN_DEVICE_FUNC
void scaleAndAddTo(Dest& dst,
const Lhs& lhs,
const Rhs& rhs,
const Scalar& alpha) {
647 typename nested_eval<Lhs, 1>::type lhsNested(lhs);
648 for (Index k = 0; k < rhs.rows(); ++k)
649 dst.col(k) += alpha * (lhsNested.col(rhs.indices().coeff(k)) * rhs.scales().coeff(k));
654template <
typename Lhs,
typename Rhs,
int ProductTag,
bool ViewOnTheRight>
655struct scaled_permutation_view_product_impl;
657template <
typename Lhs,
typename Rhs,
int ProductTag>
658struct scaled_permutation_view_product_impl<Lhs, Rhs, ProductTag, true>
659 : generic_product_impl_base<Lhs, Rhs, scaled_permutation_view_product_impl<Lhs, Rhs, ProductTag, true>> {
660 using Scalar =
typename Product<Lhs, Rhs>::Scalar;
661 using DenseType =
typename Rhs::DenseMatrixType;
662 using DenseImpl = generic_product_impl<Lhs, DenseType, ScaledPermutationShape, DenseShape, ProductTag>;
664 template <
typename Dest>
665 static EIGEN_DEVICE_FUNC
void evalTo(Dest& dst,
const Lhs& lhs,
const Rhs& rhs) {
666 const DenseType dense(rhs);
667 DenseImpl::evalTo(dst, lhs, dense);
669 template <
typename Dest>
670 static EIGEN_DEVICE_FUNC
void scaleAndAddTo(Dest& dst,
const Lhs& lhs,
const Rhs& rhs,
const Scalar& alpha) {
671 const DenseType dense(rhs);
672 DenseImpl::scaleAndAddTo(dst, lhs, dense, alpha);
676template <
typename Lhs,
typename Rhs,
int ProductTag>
677struct scaled_permutation_view_product_impl<Lhs, Rhs, ProductTag, false>
678 : generic_product_impl_base<Lhs, Rhs, scaled_permutation_view_product_impl<Lhs, Rhs, ProductTag, false>> {
679 using Scalar =
typename Product<Lhs, Rhs>::Scalar;
680 using DenseType =
typename Lhs::DenseMatrixType;
681 using DenseImpl = generic_product_impl<DenseType, Rhs, DenseShape, ScaledPermutationShape, ProductTag>;
683 template <
typename Dest>
684 static EIGEN_DEVICE_FUNC
void evalTo(Dest& dst,
const Lhs& lhs,
const Rhs& rhs) {
685 const DenseType dense(lhs);
686 DenseImpl::evalTo(dst, dense, rhs);
688 template <
typename Dest>
689 static EIGEN_DEVICE_FUNC
void scaleAndAddTo(Dest& dst,
const Lhs& lhs,
const Rhs& rhs,
const Scalar& alpha) {
690 const DenseType dense(lhs);
691 DenseImpl::scaleAndAddTo(dst, dense, rhs, alpha);
695template <
typename Lhs,
typename Rhs,
int ProductTag>
696struct generic_product_impl<Lhs, Rhs, ScaledPermutationShape, TriangularShape, ProductTag>
697 : scaled_permutation_view_product_impl<Lhs, Rhs, ProductTag, true> {};
698template <
typename Lhs,
typename Rhs,
int ProductTag>
699struct generic_product_impl<Lhs, Rhs, ScaledPermutationShape, SelfAdjointShape, ProductTag>
700 : scaled_permutation_view_product_impl<Lhs, Rhs, ProductTag, true> {};
701template <
typename Lhs,
typename Rhs,
int ProductTag>
702struct generic_product_impl<Lhs, Rhs, TriangularShape, ScaledPermutationShape, ProductTag>
703 : scaled_permutation_view_product_impl<Lhs, Rhs, ProductTag, false> {};
704template <
typename Lhs,
typename Rhs,
int ProductTag>
705struct generic_product_impl<Lhs, Rhs, SelfAdjointShape, ScaledPermutationShape, ProductTag>
706 : scaled_permutation_view_product_impl<Lhs, Rhs, ProductTag, false> {};
Derived & setZero()
Definition CwiseNullaryOp.h:521
Base class for diagonal matrices and expressions.
Definition DiagonalMatrix.h:34
const DiagonalVectorType & diagonal() const
Definition DiagonalMatrix.h:71
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
Base class for permutations.
Definition PermutationMatrix.h:92
constexpr const IndicesType & indices() const
Definition PermutationMatrix.h:160
Expression of the product of two arbitrary matrices or vectors.
Definition Product.h:225
Base class for scaled permutation matrices.
Definition ScaledPermutationMatrix.h:82
const PermutationType & permutation() const
Definition ScaledPermutationMatrix.h:117
PlainObject transpose() const
Definition ScaledPermutationMatrix.h:153
internal::scaled_permutation_product_result< Derived, OtherDerived, StorageIndex >::type operator*(const DiagonalBase< OtherDerived > &other) const
Definition ScaledPermutationMatrix.h:214
PlainObject adjoint() const
Definition ScaledPermutationMatrix.h:164
PlainObject operator*(const Scalar &alpha) const
Definition ScaledPermutationMatrix.h:302
friend PlainObject operator*(const InverseImpl< OtherDerived, PermutationStorage > &other, const ScaledPermutationBase &scaled)
Definition ScaledPermutationMatrix.h:275
const Product< Derived, OtherDerived, DefaultProduct > operator*(const TriangularBase< OtherDerived > &other) const
Definition ScaledPermutationMatrix.h:195
Scalar coeff(Index row, Index col) const
Definition ScaledPermutationMatrix.h:124
friend PlainObject operator*(const Scalar &alpha, const ScaledPermutationBase &scaled)
Definition ScaledPermutationMatrix.h:305
const ScalesType & scales() const
Definition ScaledPermutationMatrix.h:121
friend PlainObject operator*(const PermutationBase< OtherDerived > &other, const ScaledPermutationBase &scaled)
Definition ScaledPermutationMatrix.h:249
PlainObject inverse() const
Definition ScaledPermutationMatrix.h:142
constexpr Index rows() const
Definition ScaledPermutationMatrix.h:112
PlainObject operator*(const PermutationBase< OtherDerived > &other) const
Definition ScaledPermutationMatrix.h:236
Scalar determinant() const
Definition ScaledPermutationMatrix.h:171
constexpr const IndicesType & indices() const
Definition ScaledPermutationMatrix.h:119
friend internal::scaled_permutation_product_result< OtherDerived, Derived, StorageIndex >::type operator*(const DiagonalBase< OtherDerived > &other, const ScaledPermutationBase &scaled)
Definition ScaledPermutationMatrix.h:223
friend const Product< OtherDerived, Derived, DefaultProduct > operator*(const TriangularBase< OtherDerived > &other, const ScaledPermutationBase &scaled)
Definition ScaledPermutationMatrix.h:202
const Product< Derived, OtherDerived, DefaultProduct > operator*(const MatrixBase< OtherDerived > &other) const
Definition ScaledPermutationMatrix.h:180
friend const Product< OtherDerived, Derived, DefaultProduct > operator*(const MatrixBase< OtherDerived > &other, const ScaledPermutationBase &scaled)
Definition ScaledPermutationMatrix.h:188
internal::scaled_permutation_product_result< Derived, OtherDerived, StorageIndex >::type operator*(const ScaledPermutationBase< OtherDerived > &other) const
Definition ScaledPermutationMatrix.h:288
constexpr Index cols() const
Definition ScaledPermutationMatrix.h:114
PlainObject operator*(const InverseImpl< OtherDerived, PermutationStorage > &other) const
Definition ScaledPermutationMatrix.h:260
PlainObject operator-() const
Definition ScaledPermutationMatrix.h:310
DenseMatrixType toDenseMatrix() const
Definition ScaledPermutationMatrix.h:130
Scaled permutation matrix with its storage.
Definition ScaledPermutationMatrix.h:363
void resize(Index size)
Definition ScaledPermutationMatrix.h:437
ScaledPermutationMatrix(const DiagonalBase< OtherDerived > &diagonal)
Definition ScaledPermutationMatrix.h:405
internal::scaled_permutation_result< typenameDiagonalDerived::Scalar, PermutationDerived, DiagonalDerived, typenamePermutationDerived::StorageIndex >::type operator*(const PermutationBase< PermutationDerived > &permutation, const DiagonalBase< DiagonalDerived > &diagonal)
Definition ScaledPermutationMatrix.h:468
const PermutationType & permutation() const
Definition ScaledPermutationMatrix.h:424
ScaledPermutationMatrix(const ScaledPermutationBase< OtherDerived > &other)
Definition ScaledPermutationMatrix.h:412
const ScalesType & scales() const
Definition ScaledPermutationMatrix.h:432
constexpr const IndicesType & indices() const
Definition ScaledPermutationMatrix.h:428
ScaledPermutationMatrix(const PermutationBase< OtherDerived > &permutation)
Definition ScaledPermutationMatrix.h:400
ScaledPermutationMatrix(Index size)
Definition ScaledPermutationMatrix.h:380
constexpr IndicesType & indices()
Definition ScaledPermutationMatrix.h:430
internal::scaled_permutation_result< typenameDiagonalDerived::Scalar, PermutationDerived, DiagonalDerived, typenamePermutationDerived::StorageIndex >::type operator*(const DiagonalBase< DiagonalDerived > &diagonal, const PermutationBase< PermutationDerived > &permutation)
Definition ScaledPermutationMatrix.h:481
ScaledPermutationMatrix & operator=(const ScaledPermutationBase< OtherDerived > &other)
Definition ScaledPermutationMatrix.h:417
ScaledPermutationMatrix(const PermutationBase< PermutationDerived > &permutation, const DiagonalBase< DiagonalDerived > &diagonal)
Definition ScaledPermutationMatrix.h:384
ScaledPermutationMatrix()=default
void setIdentity()
Definition ScaledPermutationMatrix.h:443
ScalesType & scales()
Definition ScaledPermutationMatrix.h:434
internal::scaled_permutation_result< typenameDiagonalDerived::Scalar, PermutationType, DiagonalDerived, typenamePermutationType::StorageIndex >::type operator*(const InverseImpl< PermutationType, PermutationStorage > &inverse, const DiagonalBase< DiagonalDerived > &diagonal)
Definition ScaledPermutationMatrix.h:498
ScaledPermutationMatrix(const MatrixBase< IndicesDerived > &indices, const MatrixBase< ScalesDerived > &scales)
Definition ScaledPermutationMatrix.h:392
PermutationType & permutation()
Definition ScaledPermutationMatrix.h:426
internal::scaled_permutation_result< typenameDiagonalDerived::Scalar, PermutationType, DiagonalDerived, typenamePermutationType::StorageIndex >::type operator*(const DiagonalBase< DiagonalDerived > &diagonal, const InverseImpl< PermutationType, PermutationStorage > &inverse)
Definition ScaledPermutationMatrix.h:515
void setIdentity(Index size)
Definition ScaledPermutationMatrix.h:449
Base class for triangular part in a matrix.
Definition TriangularMatrix.h:68
Definition EigenBase.h:34
constexpr Derived & derived()
Definition EigenBase.h:50
constexpr Index size() const noexcept
Definition EigenBase.h:65
Eigen::Index Index
The interface type of indices.
Definition EigenBase.h:44