11 #ifndef EIGEN_PERMUTATIONMATRIX_H 12 #define EIGEN_PERMUTATIONMATRIX_H 45 template<
typename Derived>
52 #ifndef EIGEN_PARSED_BY_DOXYGEN 55 Flags = Traits::Flags,
56 RowsAtCompileTime = Traits::RowsAtCompileTime,
57 ColsAtCompileTime = Traits::ColsAtCompileTime,
58 MaxRowsAtCompileTime = Traits::MaxRowsAtCompileTime,
59 MaxColsAtCompileTime = Traits::MaxColsAtCompileTime
73 template<
typename OtherDerived>
81 template<
typename OtherDerived>
86 applyTranspositionOnTheRight(k,tr.
coeff(k));
90 #ifndef EIGEN_PARSED_BY_DOXYGEN 110 #ifndef EIGEN_PARSED_BY_DOXYGEN 111 template<
typename DenseDerived>
115 for (
Index i=0; i<rows(); ++i)
116 other.coeffRef(indices().coeff(i),i) =
typename DenseDerived::Scalar(1);
130 const IndicesType&
indices()
const {
return derived().indices(); }
132 IndicesType&
indices() {
return derived().indices(); }
138 indices().resize(newSize);
144 StorageIndex n = StorageIndex(
size());
145 for(StorageIndex i = 0; i < n; ++i)
146 indices().coeffRef(i) = i;
171 if(indices().coeff(k) == i) indices().coeffRef(k) = StorageIndex(j);
172 else if(indices().coeff(k) == j) indices().coeffRef(k) = StorageIndex(i);
188 std::swap(indices().coeffRef(i), indices().coeffRef(j));
208 #ifndef EIGEN_PARSED_BY_DOXYGEN 210 template<
typename OtherDerived>
213 for (
Index i=0; i<rows();++i) indices().coeffRef(other.
indices().coeff(i)) = i;
215 template<
typename Lhs,
typename Rhs>
219 for (
Index i=0; i<rows();++i) indices().coeffRef(i) = lhs.indices().coeff(rhs.indices().coeff(i));
229 template<
typename Other>
237 template<
typename Other>
245 template<
typename Other>
friend 263 while(r<n && mask[r]) r++;
269 for(
Index k=indices().coeff(k0); k!=k0; k=indices().coeff(k))
283 template<
int SizeAtCompileTime,
int MaxSizeAtCompileTime,
typename _StorageIndex>
285 :
traits<Matrix<_StorageIndex,SizeAtCompileTime,SizeAtCompileTime,0,MaxSizeAtCompileTime,MaxSizeAtCompileTime> >
307 template<
int SizeAtCompileTime,
int MaxSizeAtCompileTime,
typename _StorageIndex>
316 #ifndef EIGEN_PARSED_BY_DOXYGEN 332 template<
typename OtherDerived>
334 : m_indices(other.indices()) {}
336 #ifndef EIGEN_PARSED_BY_DOXYGEN 349 template<
typename Other>
354 template<
typename Other>
356 : m_indices(tr.
size())
362 template<
typename Other>
370 template<
typename Other>
373 return Base::operator=(tr.
derived());
376 #ifndef EIGEN_PARSED_BY_DOXYGEN 388 const IndicesType&
indices()
const {
return m_indices; }
395 #ifndef EIGEN_PARSED_BY_DOXYGEN 396 template<
typename Other>
398 : m_indices(other.derived().nestedExpression().
size())
401 StorageIndex end = StorageIndex(m_indices.size());
402 for (StorageIndex i=0; i<end;++i)
403 m_indices.coeffRef(other.derived().nestedExpression().indices().
coeff(i)) = i;
405 template<
typename Lhs,
typename Rhs>
407 : m_indices(lhs.indices().
size())
409 Base::assignProduct(lhs,rhs);
420 template<
int SizeAtCompileTime,
int MaxSizeAtCompileTime,
typename _StorageIndex,
int _PacketAccess>
422 :
traits<Matrix<_StorageIndex,SizeAtCompileTime,SizeAtCompileTime,0,MaxSizeAtCompileTime,MaxSizeAtCompileTime> >
431 template<
int SizeAtCompileTime,
int MaxSizeAtCompileTime,
typename _StorageIndex,
int _PacketAccess>
433 :
public PermutationBase<Map<PermutationMatrix<SizeAtCompileTime, MaxSizeAtCompileTime, _StorageIndex>,_PacketAccess> >
439 #ifndef EIGEN_PARSED_BY_DOXYGEN 444 inline Map(
const StorageIndex* indicesPtr)
445 : m_indices(indicesPtr)
449 : m_indices(indicesPtr,size)
453 template<
typename Other>
455 {
return Base::operator=(other.
derived()); }
458 template<
typename Other>
460 {
return Base::operator=(tr.
derived()); }
462 #ifndef EIGEN_PARSED_BY_DOXYGEN 468 m_indices = other.m_indices;
474 const IndicesType&
indices()
const {
return m_indices; }
485 template<
typename _IndicesType>
493 RowsAtCompileTime = _IndicesType::SizeAtCompileTime,
494 ColsAtCompileTime = _IndicesType::SizeAtCompileTime,
495 MaxRowsAtCompileTime = IndicesType::MaxSizeAtCompileTime,
496 MaxColsAtCompileTime = IndicesType::MaxSizeAtCompileTime,
513 template<
typename _IndicesType>
520 #ifndef EIGEN_PARSED_BY_DOXYGEN 540 template<
typename MatrixDerived,
typename PermutationDerived>
547 (matrix.derived(), permutation.
derived());
552 template<
typename PermutationDerived,
typename MatrixDerived>
559 (permutation.
derived(), matrix.derived());
563 template<
typename PermutationType>
565 :
public EigenBase<Inverse<PermutationType> >
575 #ifndef EIGEN_PARSED_BY_DOXYGEN 578 RowsAtCompileTime = PermTraits::RowsAtCompileTime,
579 ColsAtCompileTime = PermTraits::ColsAtCompileTime,
580 MaxRowsAtCompileTime = PermTraits::MaxRowsAtCompileTime,
581 MaxColsAtCompileTime = PermTraits::MaxColsAtCompileTime
585 #ifndef EIGEN_PARSED_BY_DOXYGEN 586 template<
typename DenseDerived>
590 for (
Index i=0; i<derived().rows();++i)
591 other.coeffRef(i, derived().nestedExpression().indices().coeff(i)) =
typename DenseDerived::Scalar(1);
596 PlainPermutationType
eval()
const {
return derived(); }
602 template<
typename OtherDerived>
friend 611 template<
typename OtherDerived>
619 template<
typename Derived>
633 #endif // EIGEN_PERMUTATIONMATRIX_H Scalar coeff(Index row, Index col) const
friend const Product< OtherDerived, InverseType, AliasFreeProduct > operator*(const MatrixBase< OtherDerived > &matrix, const InverseType &trPerm)
void setIdentity(geometry_msgs::Transform &tx)
Map & operator=(const PermutationBase< Other > &other)
void assignProduct(const Lhs &lhs, const Rhs &rhs)
EIGEN_DEVICE_FUNC Derived & setZero()
PermutationMatrix(const InverseImpl< Other, PermutationStorage > &other)
Expression of the product of two arbitrary matrices or vectors.
PermutationStorage StorageKind
PermutationMatrix(const MatrixBase< Other > &indices)
friend PlainPermutationType operator*(const InverseImpl< Other, PermutationStorage > &other, const PermutationBase &perm)
IndicesType::Nested m_indices
Traits::IndicesType IndicesType
A matrix or vector expression mapping an existing array of data.
const internal::remove_all< typename IndicesType::Nested >::type & indices() const
PermutationType::PlainPermutationType PlainPermutationType
PermutationBase< Map > Base
Traits::StorageIndex StorageIndex
Derived & applyTranspositionOnTheRight(Index i, Index j)
void assignTranspose(const PermutationBase< OtherDerived > &other)
PermutationMatrix & operator=(const PermutationMatrix &other)
internal::traits< PermutationMatrix > Traits
PermutationType::DenseMatrixType DenseMatrixType
static constexpr size_t size(Tuple< Args... > &)
Provides access to the number of elements in a tuple as a compile-time constant expression.
const IndicesType & indices() const
Map(const StorageIndex *indicesPtr)
Holds information about the various numeric (i.e. scalar) types allowed by Eigen. ...
Map< const Matrix< _StorageIndex, SizeAtCompileTime, 1, 0, MaxSizeAtCompileTime, 1 >, _PacketAccess > IndicesType
Derived & operator=(const PermutationBase< OtherDerived > &other)
Eigen::Index Index
The interface type of indices.
PermutationMatrix & operator=(const PermutationBase< Other > &other)
const PermutationMatrix & Nested
const Product< InverseType, OtherDerived, AliasFreeProduct > operator*(const MatrixBase< OtherDerived > &matrix) const
Base class for permutations.
PermutationBase< PermutationMatrix > Base
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar & coeffRef(Index rowId, Index colId)
Matrix< _StorageIndex, SizeAtCompileTime, 1, 0, MaxSizeAtCompileTime, 1 > IndicesType
PermutationMatrix(const PermutationMatrix &other)
Expression of the inverse of another expression.
Traits::IndicesType IndicesType
PermutationMatrix & operator=(const TranspositionsBase< Other > &tr)
void evalTo(MatrixBase< DenseDerived > &other) const
PlainPermutationType operator*(const PermutationBase< Other > &other) const
_StorageIndex StorageIndex
void evalTo(MatrixBase< DenseDerived > &other) const
Derived & operator=(const TranspositionsBase< OtherDerived > &tr)
PermutationStorage StorageKind
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Matrix< StorageIndex, RowsAtCompileTime, ColsAtCompileTime, 0, MaxRowsAtCompileTime, MaxColsAtCompileTime > DenseMatrixType
_IndicesType::Scalar StorageIndex
PermutationMatrix< IndicesType::SizeAtCompileTime, IndicesType::MaxSizeAtCompileTime, StorageIndex > PlainPermutationType
DenseMatrixType toDenseMatrix() const
Index determinant() const
EigenBase< Derived > Base
CwiseUnaryOp< internal::scalar_inverse_op< Scalar >, const Derived > InverseReturnType
Class to view a vector of integers as a permutation matrix.
Derived & operator=(const PermutationBase &other)
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)
internal::traits< Map > Traits
PermutationMatrix(const TranspositionsBase< Other > &tr)
internal::traits< PermutationWrapper > Traits
PlainPermutationType PlainObject
InverseReturnType inverse() const
PermutationWrapper(const IndicesType &indices)
const PermutationWrapper< const Derived > asPermutation() const
Derived & applyTranspositionOnTheLeft(Index i, Index j)
internal::traits< Derived > Traits
PermutationMatrix(Index size)
Map & operator=(const TranspositionsBase< Other > &tr)
const IndicesType & indices() const
internal::traits< PermutationType > PermTraits
_StorageIndex StorageIndex
PermutationMatrix(internal::PermPermProduct_t, const Lhs &lhs, const Rhs &rhs)
PlainPermutationType eval() const
Traits::StorageIndex StorageIndex
PermutationStorage StorageKind
IndicesType::Scalar StorageIndex
#define eigen_internal_assert(x)
Traits::IndicesType IndicesType
void setIdentity(Index newSize)
Inverse< PermutationType > InverseType
The matrix class, also used for vectors and row-vectors.
void resize(Index newSize)
const IndicesType & indices() const
EIGEN_DEVICE_FUNC Derived & derived()
Base class for all dense matrices, vectors, and expressions.
Map(const StorageIndex *indicesPtr, Index size)
PermutationMatrix(const PermutationBase< OtherDerived > &other)
void swap(mpfr::mpreal &x, mpfr::mpreal &y)
Inverse< Derived > InverseReturnType
Traits::IndicesType IndicesType
Map & operator=(const Map &other)
PlainPermutationType operator*(const InverseImpl< Other, PermutationStorage > &other) const
DenseMatrixType toDenseMatrix() const
const StorageIndex & coeff(Index i) const
PermutationBase< PermutationWrapper > Base