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>
    84       setIdentity(tr.
size());
    85       for(
Index k=size()-1; k>=0; --k)
    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;
   169       for(
Index k = 0; k < size(); ++k)
   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)
   448     inline Map(
const StorageIndex* indicesPtr, 
Index size)
   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 friend const Product< OtherDerived, InverseType, AliasFreeProduct > operator*(const MatrixBase< OtherDerived > &matrix, const InverseType &trPerm)
Map & operator=(const PermutationBase< Other > &other)
void assignProduct(const Lhs &lhs, const Rhs &rhs)
PermutationMatrix(const InverseImpl< Other, PermutationStorage > &other)
Expression of the product of two arbitrary matrices or vectors. 
PermutationStorage StorageKind
PlainPermutationType operator*(const PermutationBase< Other > &other) const
PermutationMatrix(const MatrixBase< Other > &indices)
friend PlainPermutationType operator*(const InverseImpl< Other, PermutationStorage > &other, const PermutationBase &perm)
IndicesType::Nested m_indices
PlainPermutationType eval() const
Traits::IndicesType IndicesType
InverseReturnType inverse() const
A matrix or vector expression mapping an existing array of data. 
PlainPermutationType operator*(const InverseImpl< Other, PermutationStorage > &other) const
PermutationType::PlainPermutationType PlainPermutationType
DenseMatrixType toDenseMatrix() const
PermutationBase< Map > Base
DenseMatrixType toDenseMatrix() const
Traits::StorageIndex StorageIndex
Derived & applyTranspositionOnTheRight(Index i, Index j)
void assignTranspose(const PermutationBase< OtherDerived > &other)
PermutationMatrix & operator=(const PermutationMatrix &other)
EIGEN_DEVICE_FUNC Derived & setZero()
internal::traits< PermutationMatrix > Traits
PermutationType::DenseMatrixType DenseMatrixType
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
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)
Scalar coeff(Index row, Index col) const
Expression of the inverse of another expression. 
const StorageIndex & coeff(Index i) const
Traits::IndicesType IndicesType
PermutationMatrix & operator=(const TranspositionsBase< Other > &tr)
const PermutationWrapper< const Derived > asPermutation() const
const IndicesType & indices() const
_StorageIndex StorageIndex
Derived & operator=(const TranspositionsBase< OtherDerived > &tr)
void evalTo(MatrixBase< DenseDerived > &other) const
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
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)
const IndicesType & indices() const
internal::traits< Map > Traits
EIGEN_DEVICE_FUNC const Product< MatrixDerived, PermutationDerived, AliasFreeProduct > operator*(const MatrixBase< MatrixDerived > &matrix, const PermutationBase< PermutationDerived > &permutation)
PermutationMatrix(const TranspositionsBase< Other > &tr)
internal::traits< PermutationWrapper > Traits
PlainPermutationType PlainObject
PermutationWrapper(const IndicesType &indices)
Derived & applyTranspositionOnTheLeft(Index i, Index j)
internal::traits< Derived > Traits
PermutationMatrix(Index size)
Map & operator=(const TranspositionsBase< Other > &tr)
InverseReturnType transpose() const
internal::traits< PermutationType > PermTraits
_StorageIndex StorageIndex
PermutationMatrix(internal::PermPermProduct_t, const Lhs &lhs, const Rhs &rhs)
const Product< InverseType, OtherDerived, AliasFreeProduct > operator*(const MatrixBase< OtherDerived > &matrix) const
const internal::remove_all< typename IndicesType::Nested >::type & indices() 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)
Index determinant() 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)
Inverse< Derived > InverseReturnType
void evalTo(MatrixBase< DenseDerived > &other) const
const IndicesType & indices() const
void swap(scoped_array< T > &a, scoped_array< T > &b)
Traits::IndicesType IndicesType
Map & operator=(const Map &other)
PermutationBase< PermutationWrapper > Base