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();
177 template <
typename OtherDerived>
185 template <
typename OtherDerived>
192 template <
typename OtherDerived>
199 template <
typename OtherDerived>
211 template <
typename OtherDerived>
212 typename internal::scaled_permutation_product_result<Derived, OtherDerived, StorageIndex>::type
operator*(
214 using Result =
typename internal::scaled_permutation_product_result<Derived, OtherDerived, StorageIndex>::type;
215 EIGEN_INTERNAL_ASSERT_SAME_ROWS(*
this, other);
220 template <
typename OtherDerived>
221 friend typename internal::scaled_permutation_product_result<OtherDerived, Derived, StorageIndex>::type
operator*(
223 using Result =
typename internal::scaled_permutation_product_result<OtherDerived, Derived, StorageIndex>::type;
224 EIGEN_INTERNAL_ASSERT_SAME_ROWS(other, scaled);
225 Result result(scaled.
rows());
226 result.indices() = scaled.
indices();
227 for (
Index k = 0; k < scaled.
rows(); ++k)
228 result.scales().coeffRef(k) = other.
diagonal().coeff(scaled.
indices().coeff(k)) * scaled.
scales().coeff(k);
233 template <
typename OtherDerived>
235 EIGEN_INTERNAL_ASSERT_SAME_ROWS(*
this, other);
236 PlainObject result(
rows());
239 result.indices().coeffRef(k) =
indices().coeff(source);
240 result.scales().coeffRef(k) =
scales().coeff(source);
246 template <
typename OtherDerived>
248 EIGEN_INTERNAL_ASSERT_SAME_ROWS(other, scaled);
249 PlainObject result(scaled.
rows());
250 for (
Index k = 0; k < scaled.
rows(); ++k)
251 result.indices().coeffRef(k) = StorageIndex(other.
indices().coeff(scaled.
indices().coeff(k)));
252 result.scales() = scaled.
scales();
257 template <
typename OtherDerived>
258 PlainObject
operator*(
const InverseImpl<OtherDerived, PermutationStorage>& other)
const {
259 EIGEN_INTERNAL_ASSERT_SAME_ROWS(*
this, other);
261 internal::invert_permutation_indices(other.derived().nestedExpression().indices(),
inverse);
262 PlainObject result(
rows());
265 result.indices().coeffRef(k) =
indices().coeff(source);
266 result.scales().coeffRef(k) =
scales().coeff(source);
272 template <
typename OtherDerived>
273 friend PlainObject
operator*(
const InverseImpl<OtherDerived, PermutationStorage>& other,
275 EIGEN_INTERNAL_ASSERT_SAME_ROWS(other, scaled);
277 internal::invert_permutation_indices(other.derived().nestedExpression().indices(),
inverse);
278 PlainObject result(scaled.
rows());
279 for (
Index k = 0; k < scaled.
rows(); ++k) result.indices().coeffRef(k) =
inverse.coeff(scaled.
indices().coeff(k));
280 result.scales() = scaled.
scales();
285 template <
typename OtherDerived>
286 typename internal::scaled_permutation_product_result<Derived, OtherDerived, StorageIndex>::type
operator*(
288 using Result =
typename internal::scaled_permutation_product_result<Derived, OtherDerived, StorageIndex>::type;
289 EIGEN_INTERNAL_ASSERT_SAME_ROWS(*
this, other);
290 Result result(
rows());
293 result.indices().coeffRef(k) =
indices().coeff(source);
294 result.scales().coeffRef(k) =
scales().coeff(source) * other.
scales().coeff(k);
304 return PlainObject(scaled.
indices(), alpha * scaled.
scales());
313 template <
typename OtherDerived>
314 EIGEN_DEVICE_FUNC
friend const EIGEN_CWISE_BINARY_RETURN_TYPE(OtherDerived, Derived, internal::scalar_sum_op)
316 return EIGEN_CWISE_BINARY_RETURN_TYPE(OtherDerived, Derived, internal::scalar_sum_op)(lhs.derived(), rhs.derived());
320 template <
typename OtherDerived>
321 EIGEN_DEVICE_FUNC
friend const EIGEN_CWISE_BINARY_RETURN_TYPE(Derived, OtherDerived, internal::scalar_sum_op)
323 return EIGEN_CWISE_BINARY_RETURN_TYPE(Derived, OtherDerived, internal::scalar_sum_op)(lhs.derived(), rhs.derived());
327 template <
typename OtherDerived>
328 EIGEN_DEVICE_FUNC
friend const EIGEN_CWISE_BINARY_RETURN_TYPE(OtherDerived, Derived, internal::scalar_difference_op)
330 return EIGEN_CWISE_BINARY_RETURN_TYPE(OtherDerived, Derived, internal::scalar_difference_op)(lhs.derived(),
335 template <
typename OtherDerived>
336 EIGEN_DEVICE_FUNC
friend const EIGEN_CWISE_BINARY_RETURN_TYPE(Derived, OtherDerived, internal::scalar_difference_op)
338 return EIGEN_CWISE_BINARY_RETURN_TYPE(Derived, OtherDerived, internal::scalar_difference_op)(lhs.derived(),
358template <
typename Scalar_,
int SizeAtCompileTime,
int MaxSizeAtCompileTime,
typename StorageIndex_>
361 ScaledPermutationMatrix<Scalar_, SizeAtCompileTime, MaxSizeAtCompileTime, StorageIndex_>> {
363 using Traits = internal::traits<ScaledPermutationMatrix>;
366#ifndef EIGEN_PARSED_BY_DOXYGEN
367 using Scalar = Scalar_;
368 using StorageIndex = StorageIndex_;
369 using PermutationType =
typename Traits::PermutationType;
370 using ScalesType =
typename Traits::ScalesType;
371 using IndicesType =
typename PermutationType::IndicesType;
381 template <
typename PermutationDerived,
typename DiagonalDerived>
384 : m_permutation(
permutation), m_scales(diagonal.diagonal()) {
385 EIGEN_INTERNAL_ASSERT_SAME_ROWS(
permutation, diagonal);
389 template <
typename IndicesDerived,
typename ScalesDerived>
397 template <
typename OtherDerived>
402 template <
typename OtherDerived>
404 : m_permutation(diagonal.
rows()), m_scales(diagonal.diagonal()) {
405 m_permutation.setIdentity();
409 template <
typename OtherDerived>
414 template <
typename OtherDerived>
417 m_scales = other.
scales();
422 EIGEN_DEVICE_FUNC
const PermutationType&
permutation()
const {
return m_permutation; }
424 EIGEN_DEVICE_FUNC PermutationType&
permutation() {
return m_permutation; }
426 EIGEN_DEVICE_FUNC
constexpr const IndicesType&
indices()
const {
return m_permutation.indices(); }
428 EIGEN_DEVICE_FUNC
constexpr IndicesType&
indices() {
return m_permutation.indices(); }
430 EIGEN_DEVICE_FUNC
const ScalesType&
scales()
const {
return m_scales; }
432 EIGEN_DEVICE_FUNC ScalesType&
scales() {
return m_scales; }
436 m_permutation.resize(
size);
437 m_scales.resize(
size);
442 m_permutation.setIdentity();
453 PermutationType m_permutation;
463template <
typename PermutationDerived,
typename DiagonalDerived>
464typename internal::scaled_permutation_result<
typename DiagonalDerived::Scalar, PermutationDerived, DiagonalDerived,
465 typename PermutationDerived::StorageIndex>::type
468 typename internal::scaled_permutation_result<
typename DiagonalDerived::Scalar, PermutationDerived,
469 DiagonalDerived,
typename PermutationDerived::StorageIndex>::type;
470 EIGEN_INTERNAL_ASSERT_SAME_ROWS(
permutation, diagonal);
476template <
typename DiagonalDerived,
typename PermutationDerived>
477typename internal::scaled_permutation_result<
typename DiagonalDerived::Scalar, PermutationDerived, DiagonalDerived,
478 typename PermutationDerived::StorageIndex>::type
481 typename internal::scaled_permutation_result<
typename DiagonalDerived::Scalar, PermutationDerived,
482 DiagonalDerived,
typename PermutationDerived::StorageIndex>::type;
483 EIGEN_INTERNAL_ASSERT_SAME_ROWS(
permutation, diagonal);
493template <
typename PermutationType,
typename DiagonalDerived>
494typename internal::scaled_permutation_result<
typename DiagonalDerived::Scalar, PermutationType, DiagonalDerived,
495 typename PermutationType::StorageIndex>::type
499 typename internal::scaled_permutation_result<
typename DiagonalDerived::Scalar, PermutationType, DiagonalDerived,
500 typename PermutationType::StorageIndex>::type;
501 EIGEN_INTERNAL_ASSERT_SAME_ROWS(
inverse, diagonal);
503 internal::invert_permutation_indices(
inverse.derived().nestedExpression().indices(), result.indices());
504 result.scales() = diagonal.
diagonal();
510template <
typename DiagonalDerived,
typename PermutationType>
511typename internal::scaled_permutation_result<
typename DiagonalDerived::Scalar, PermutationType, DiagonalDerived,
512 typename PermutationType::StorageIndex>::type
514 const InverseImpl<PermutationType, PermutationStorage>&
inverse) {
516 typename internal::scaled_permutation_result<
typename DiagonalDerived::Scalar, PermutationType, DiagonalDerived,
517 typename PermutationType::StorageIndex>::type;
518 EIGEN_INTERNAL_ASSERT_SAME_ROWS(
inverse, diagonal);
520 internal::invert_permutation_indices(
inverse.derived().nestedExpression().indices(), result.indices());
522 result.scales().coeffRef(k) = diagonal.
diagonal().coeff(result.indices().coeff(k));
528template <
typename Scalar_,
int SizeAtCompileTime,
int MaxSizeAtCompileTime,
typename StorageIndex_>
529struct evaluator_traits<
ScaledPermutationMatrix<Scalar_, SizeAtCompileTime, MaxSizeAtCompileTime, StorageIndex_>> {
530 using Kind = IndexBased;
531 using Shape = ScaledPermutationShape;
536template <
typename Scalar_,
int SizeAtCompileTime,
int MaxSizeAtCompileTime,
typename StorageIndex_>
537struct evaluator<ScaledPermutationMatrix<Scalar_, SizeAtCompileTime, MaxSizeAtCompileTime, StorageIndex_>>
538 : evaluator_base<ScaledPermutationMatrix<Scalar_, SizeAtCompileTime, MaxSizeAtCompileTime, StorageIndex_>> {
539 using XprType = ScaledPermutationMatrix<Scalar_, SizeAtCompileTime, MaxSizeAtCompileTime, StorageIndex_>;
540 using Scalar = Scalar_;
541 using CoeffReturnType = Scalar;
543 static constexpr int CoeffReadCost =
544 int(NumTraits<StorageIndex_>::ReadCost) + int(NumTraits<Scalar>::ReadCost) + int(NumTraits<Scalar>::AddCost);
545 static constexpr unsigned int Flags = 0;
546 static constexpr int Alignment = 0;
548 EIGEN_DEVICE_FUNC
explicit evaluator(
const XprType& xpr) : m_indices(xpr.indices()), m_scales(xpr.scales()) {}
550 EIGEN_DEVICE_FUNC Scalar coeff(Index row, Index col)
const {
551 return Index(m_indices.coeff(col)) == row ? m_scales.coeff(col) : Scalar(0);
555 EIGEN_DEVICE_FUNC Scalar coeff(Index index)
const {
556 eigen_assert(index == 0);
557 return m_scales.coeff(index);
561 evaluator<typename XprType::IndicesType> m_indices;
562 evaluator<typename XprType::ScalesType> m_scales;
565struct ScaledPermutation2Dense {};
568struct AssignmentKind<DenseShape, ScaledPermutationShape> {
569 using Kind = ScaledPermutation2Dense;
573template <
typename DstXprType,
typename SrcXprType,
typename Functor>
574struct Assignment<DstXprType, SrcXprType, Functor, ScaledPermutation2Dense> {
575 static EIGEN_DEVICE_FUNC
void run(
576 DstXprType& dst,
const SrcXprType& src,
577 const internal::assign_op<typename DstXprType::Scalar, typename SrcXprType::Scalar>&) {
578 if (dst.rows() != src.rows() || dst.cols() != src.cols()) dst.resize(src.rows(), src.cols());
580 for (Index k = 0; k < src.rows(); ++k) dst.coeffRef(src.indices().coeff(k), k) = src.scales().coeff(k);
583 static EIGEN_DEVICE_FUNC
void run(
584 DstXprType& dst,
const SrcXprType& src,
585 const internal::add_assign_op<typename DstXprType::Scalar, typename SrcXprType::Scalar>&) {
586 EIGEN_INTERNAL_ASSERT_SAME_SHAPE(dst, src);
587 for (Index k = 0; k < src.rows(); ++k) dst.coeffRef(src.indices().coeff(k), k) += src.scales().coeff(k);
590 static EIGEN_DEVICE_FUNC
void run(
591 DstXprType& dst,
const SrcXprType& src,
592 const internal::sub_assign_op<typename DstXprType::Scalar, typename SrcXprType::Scalar>&) {
593 EIGEN_INTERNAL_ASSERT_SAME_SHAPE(dst, src);
594 for (Index k = 0; k < src.rows(); ++k) dst.coeffRef(src.indices().coeff(k), k) -= src.scales().coeff(k);
608template <
typename Lhs,
typename Rhs,
int ProductTag>
609struct generic_product_impl<Lhs, Rhs, ScaledPermutationShape, DenseShape, ProductTag>
610 : generic_product_impl_base<Lhs, Rhs,
611 generic_product_impl<Lhs, Rhs, ScaledPermutationShape, DenseShape, ProductTag>> {
612 using Scalar =
typename Product<Lhs, Rhs>::Scalar;
614 template <
typename Dest>
615 static EIGEN_DEVICE_FUNC
void evalTo(Dest& dst,
const Lhs& lhs,
const Rhs& rhs) {
616 permutation_matrix_product<Rhs, OnTheLeft, false, DenseShape>::run(dst, lhs.permutation(), rhs);
617 for (Index k = 0; k < lhs.rows(); ++k) {
618 auto row = dst.row(lhs.indices().coeff(k));
619 row = lhs.scales().coeff(k) * row;
623 template <
typename Dest>
624 static EIGEN_DEVICE_FUNC
void scaleAndAddTo(Dest& dst,
const Lhs& lhs,
const Rhs& rhs,
const Scalar& alpha) {
625 typename nested_eval<Rhs, 1>::type rhsNested(rhs);
626 for (Index k = 0; k < lhs.rows(); ++k)
627 dst.row(lhs.indices().coeff(k)) += (alpha * lhs.scales().coeff(k)) * rhsNested.row(k);
631template <
typename Lhs,
typename Rhs,
int ProductTag>
632struct generic_product_impl<Lhs, Rhs, DenseShape, ScaledPermutationShape, ProductTag>
633 : generic_product_impl_base<Lhs, Rhs,
634 generic_product_impl<Lhs, Rhs, DenseShape, ScaledPermutationShape, ProductTag>> {
635 using Scalar =
typename Product<Lhs, Rhs>::Scalar;
637 template <
typename Dest>
638 static EIGEN_DEVICE_FUNC
void evalTo(Dest& dst,
const Lhs& lhs,
const Rhs& rhs) {
639 permutation_matrix_product<Lhs, OnTheRight, false, DenseShape>::run(dst, rhs.permutation(), lhs);
640 for (Index k = 0; k < rhs.rows(); ++k) dst.col(k) *= rhs.scales().coeff(k);
643 template <
typename Dest>
644 static EIGEN_DEVICE_FUNC
void scaleAndAddTo(Dest& dst,
const Lhs& lhs,
const Rhs& rhs,
const Scalar& alpha) {
645 typename nested_eval<Lhs, 1>::type lhsNested(lhs);
646 for (Index k = 0; k < rhs.rows(); ++k)
647 dst.col(k) += alpha * (lhsNested.col(rhs.indices().coeff(k)) * rhs.scales().coeff(k));
652template <
typename Lhs,
typename Rhs,
int ProductTag,
bool ViewOnTheRight>
653struct scaled_permutation_view_product_impl;
655template <
typename Lhs,
typename Rhs,
int ProductTag>
656struct scaled_permutation_view_product_impl<Lhs, Rhs, ProductTag, true>
657 : generic_product_impl_base<Lhs, Rhs, scaled_permutation_view_product_impl<Lhs, Rhs, ProductTag, true>> {
658 using Scalar =
typename Product<Lhs, Rhs>::Scalar;
659 using DenseType =
typename Rhs::DenseMatrixType;
660 using DenseImpl = generic_product_impl<Lhs, DenseType, ScaledPermutationShape, DenseShape, ProductTag>;
662 template <
typename Dest>
663 static EIGEN_DEVICE_FUNC
void evalTo(Dest& dst,
const Lhs& lhs,
const Rhs& rhs) {
664 const DenseType dense(rhs);
665 DenseImpl::evalTo(dst, lhs, dense);
667 template <
typename Dest>
668 static EIGEN_DEVICE_FUNC
void scaleAndAddTo(Dest& dst,
const Lhs& lhs,
const Rhs& rhs,
const Scalar& alpha) {
669 const DenseType dense(rhs);
670 DenseImpl::scaleAndAddTo(dst, lhs, dense, alpha);
674template <
typename Lhs,
typename Rhs,
int ProductTag>
675struct scaled_permutation_view_product_impl<Lhs, Rhs, ProductTag, false>
676 : generic_product_impl_base<Lhs, Rhs, scaled_permutation_view_product_impl<Lhs, Rhs, ProductTag, false>> {
677 using Scalar =
typename Product<Lhs, Rhs>::Scalar;
678 using DenseType =
typename Lhs::DenseMatrixType;
679 using DenseImpl = generic_product_impl<DenseType, Rhs, DenseShape, ScaledPermutationShape, ProductTag>;
681 template <
typename Dest>
682 static EIGEN_DEVICE_FUNC
void evalTo(Dest& dst,
const Lhs& lhs,
const Rhs& rhs) {
683 const DenseType dense(lhs);
684 DenseImpl::evalTo(dst, dense, rhs);
686 template <
typename Dest>
687 static EIGEN_DEVICE_FUNC
void scaleAndAddTo(Dest& dst,
const Lhs& lhs,
const Rhs& rhs,
const Scalar& alpha) {
688 const DenseType dense(lhs);
689 DenseImpl::scaleAndAddTo(dst, dense, rhs, alpha);
693template <
typename Lhs,
typename Rhs,
int ProductTag>
694struct generic_product_impl<Lhs, Rhs, ScaledPermutationShape, TriangularShape, ProductTag>
695 : scaled_permutation_view_product_impl<Lhs, Rhs, ProductTag, true> {};
696template <
typename Lhs,
typename Rhs,
int ProductTag>
697struct generic_product_impl<Lhs, Rhs, ScaledPermutationShape, SelfAdjointShape, ProductTag>
698 : scaled_permutation_view_product_impl<Lhs, Rhs, ProductTag, true> {};
699template <
typename Lhs,
typename Rhs,
int ProductTag>
700struct generic_product_impl<Lhs, Rhs, TriangularShape, ScaledPermutationShape, ProductTag>
701 : scaled_permutation_view_product_impl<Lhs, Rhs, ProductTag, false> {};
702template <
typename Lhs,
typename Rhs,
int ProductTag>
703struct generic_product_impl<Lhs, Rhs, SelfAdjointShape, ScaledPermutationShape, ProductTag>
704 : 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:211
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:212
PlainObject adjoint() const
Definition ScaledPermutationMatrix.h:164
PlainObject operator*(const Scalar &alpha) const
Definition ScaledPermutationMatrix.h:300
friend PlainObject operator*(const InverseImpl< OtherDerived, PermutationStorage > &other, const ScaledPermutationBase &scaled)
Definition ScaledPermutationMatrix.h:273
const Product< Derived, OtherDerived, DefaultProduct > operator*(const TriangularBase< OtherDerived > &other) const
Definition ScaledPermutationMatrix.h:193
Scalar coeff(Index row, Index col) const
Definition ScaledPermutationMatrix.h:124
friend PlainObject operator*(const Scalar &alpha, const ScaledPermutationBase &scaled)
Definition ScaledPermutationMatrix.h:303
const ScalesType & scales() const
Definition ScaledPermutationMatrix.h:121
friend PlainObject operator*(const PermutationBase< OtherDerived > &other, const ScaledPermutationBase &scaled)
Definition ScaledPermutationMatrix.h:247
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:234
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:221
friend const Product< OtherDerived, Derived, DefaultProduct > operator*(const TriangularBase< OtherDerived > &other, const ScaledPermutationBase &scaled)
Definition ScaledPermutationMatrix.h:200
const Product< Derived, OtherDerived, DefaultProduct > operator*(const MatrixBase< OtherDerived > &other) const
Definition ScaledPermutationMatrix.h:178
friend const Product< OtherDerived, Derived, DefaultProduct > operator*(const MatrixBase< OtherDerived > &other, const ScaledPermutationBase &scaled)
Definition ScaledPermutationMatrix.h:186
internal::scaled_permutation_product_result< Derived, OtherDerived, StorageIndex >::type operator*(const ScaledPermutationBase< OtherDerived > &other) const
Definition ScaledPermutationMatrix.h:286
constexpr Index cols() const
Definition ScaledPermutationMatrix.h:114
PlainObject operator*(const InverseImpl< OtherDerived, PermutationStorage > &other) const
Definition ScaledPermutationMatrix.h:258
PlainObject operator-() const
Definition ScaledPermutationMatrix.h:308
DenseMatrixType toDenseMatrix() const
Definition ScaledPermutationMatrix.h:130
Scaled permutation matrix with its storage.
Definition ScaledPermutationMatrix.h:361
void resize(Index size)
Definition ScaledPermutationMatrix.h:435
ScaledPermutationMatrix(const DiagonalBase< OtherDerived > &diagonal)
Definition ScaledPermutationMatrix.h:403
internal::scaled_permutation_result< typenameDiagonalDerived::Scalar, PermutationDerived, DiagonalDerived, typenamePermutationDerived::StorageIndex >::type operator*(const PermutationBase< PermutationDerived > &permutation, const DiagonalBase< DiagonalDerived > &diagonal)
Definition ScaledPermutationMatrix.h:466
const PermutationType & permutation() const
Definition ScaledPermutationMatrix.h:422
ScaledPermutationMatrix(const ScaledPermutationBase< OtherDerived > &other)
Definition ScaledPermutationMatrix.h:410
const ScalesType & scales() const
Definition ScaledPermutationMatrix.h:430
constexpr const IndicesType & indices() const
Definition ScaledPermutationMatrix.h:426
ScaledPermutationMatrix(const PermutationBase< OtherDerived > &permutation)
Definition ScaledPermutationMatrix.h:398
ScaledPermutationMatrix(Index size)
Definition ScaledPermutationMatrix.h:378
constexpr IndicesType & indices()
Definition ScaledPermutationMatrix.h:428
internal::scaled_permutation_result< typenameDiagonalDerived::Scalar, PermutationDerived, DiagonalDerived, typenamePermutationDerived::StorageIndex >::type operator*(const DiagonalBase< DiagonalDerived > &diagonal, const PermutationBase< PermutationDerived > &permutation)
Definition ScaledPermutationMatrix.h:479
ScaledPermutationMatrix & operator=(const ScaledPermutationBase< OtherDerived > &other)
Definition ScaledPermutationMatrix.h:415
ScaledPermutationMatrix(const PermutationBase< PermutationDerived > &permutation, const DiagonalBase< DiagonalDerived > &diagonal)
Definition ScaledPermutationMatrix.h:382
ScaledPermutationMatrix()=default
void setIdentity()
Definition ScaledPermutationMatrix.h:441
ScalesType & scales()
Definition ScaledPermutationMatrix.h:432
internal::scaled_permutation_result< typenameDiagonalDerived::Scalar, PermutationType, DiagonalDerived, typenamePermutationType::StorageIndex >::type operator*(const InverseImpl< PermutationType, PermutationStorage > &inverse, const DiagonalBase< DiagonalDerived > &diagonal)
Definition ScaledPermutationMatrix.h:496
ScaledPermutationMatrix(const MatrixBase< IndicesDerived > &indices, const MatrixBase< ScalesDerived > &scales)
Definition ScaledPermutationMatrix.h:390
PermutationType & permutation()
Definition ScaledPermutationMatrix.h:424
internal::scaled_permutation_result< typenameDiagonalDerived::Scalar, PermutationType, DiagonalDerived, typenamePermutationType::StorageIndex >::type operator*(const DiagonalBase< DiagonalDerived > &diagonal, const InverseImpl< PermutationType, PermutationStorage > &inverse)
Definition ScaledPermutationMatrix.h:513
void setIdentity(Index size)
Definition ScaledPermutationMatrix.h:447
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