Lines 295-301
Link Here
|
295 |
|
295 |
|
296 |
/** Constructs an uninitialized permutation matrix of given size. |
296 |
/** Constructs an uninitialized permutation matrix of given size. |
297 |
*/ |
297 |
*/ |
298 |
inline PermutationMatrix(int size) : m_indices(size) |
298 |
inline PermutationMatrix(IndexType size) : m_indices(size) |
299 |
{} |
299 |
{} |
300 |
|
300 |
|
301 |
/** Copy constructor. */ |
301 |
/** Copy constructor. */ |
Lines 541-557
Link Here
|
541 |
: public ReturnByValue<permut_matrix_product_retval<PermutationType, MatrixType, Side, Transposed> > |
541 |
: public ReturnByValue<permut_matrix_product_retval<PermutationType, MatrixType, Side, Transposed> > |
542 |
{ |
542 |
{ |
543 |
typedef typename remove_all<typename MatrixType::Nested>::type MatrixTypeNestedCleaned; |
543 |
typedef typename remove_all<typename MatrixType::Nested>::type MatrixTypeNestedCleaned; |
544 |
|
544 |
typedef typename internal::traits<MatrixType>::Index Index; |
545 |
permut_matrix_product_retval(const PermutationType& perm, const MatrixType& matrix) |
545 |
permut_matrix_product_retval(const PermutationType& perm, const MatrixType& matrix) |
546 |
: m_permutation(perm), m_matrix(matrix) |
546 |
: m_permutation(perm), m_matrix(matrix) |
547 |
{} |
547 |
{} |
548 |
|
548 |
|
549 |
inline int rows() const { return m_matrix.rows(); } |
549 |
inline Index rows() const { return m_matrix.rows(); } |
550 |
inline int cols() const { return m_matrix.cols(); } |
550 |
inline Index cols() const { return m_matrix.cols(); } |
551 |
|
551 |
|
552 |
template<typename Dest> inline void evalTo(Dest& dst) const |
552 |
template<typename Dest> inline void evalTo(Dest& dst) const |
553 |
{ |
553 |
{ |
554 |
const int n = Side==OnTheLeft ? rows() : cols(); |
554 |
const Index n = Side==OnTheLeft ? rows() : cols(); |
555 |
|
555 |
|
556 |
if(is_same<MatrixTypeNestedCleaned,Dest>::value && extract_data(dst) == extract_data(m_matrix)) |
556 |
if(is_same<MatrixTypeNestedCleaned,Dest>::value && extract_data(dst) == extract_data(m_matrix)) |
557 |
{ |
557 |
{ |
Lines 566-575
Link Here
|
566 |
if(r>=m_permutation.size()) |
566 |
if(r>=m_permutation.size()) |
567 |
break; |
567 |
break; |
568 |
// we got one, let's follow it until we are back to the seed |
568 |
// we got one, let's follow it until we are back to the seed |
569 |
int k0 = r++; |
569 |
Index k0 = r++; |
570 |
int kPrev = k0; |
570 |
Index kPrev = k0; |
571 |
mask.coeffRef(k0) = true; |
571 |
mask.coeffRef(k0) = true; |
572 |
for(int k=m_permutation.indices().coeff(k0); k!=k0; k=m_permutation.indices().coeff(k)) |
572 |
for(Index k=m_permutation.indices().coeff(k0); k!=k0; k=m_permutation.indices().coeff(k)) |
573 |
{ |
573 |
{ |
574 |
Block<Dest, Side==OnTheLeft ? 1 : Dest::RowsAtCompileTime, Side==OnTheRight ? 1 : Dest::ColsAtCompileTime>(dst, k) |
574 |
Block<Dest, Side==OnTheLeft ? 1 : Dest::RowsAtCompileTime, Side==OnTheRight ? 1 : Dest::ColsAtCompileTime>(dst, k) |
575 |
.swap(Block<Dest, Side==OnTheLeft ? 1 : Dest::RowsAtCompileTime, Side==OnTheRight ? 1 : Dest::ColsAtCompileTime> |
575 |
.swap(Block<Dest, Side==OnTheLeft ? 1 : Dest::RowsAtCompileTime, Side==OnTheRight ? 1 : Dest::ColsAtCompileTime> |
Lines 582-588
Link Here
|
582 |
} |
582 |
} |
583 |
else |
583 |
else |
584 |
{ |
584 |
{ |
585 |
for(int i = 0; i < n; ++i) |
585 |
for(Index i = 0; i < n; ++i) |
586 |
{ |
586 |
{ |
587 |
Block<Dest, Side==OnTheLeft ? 1 : Dest::RowsAtCompileTime, Side==OnTheRight ? 1 : Dest::ColsAtCompileTime> |
587 |
Block<Dest, Side==OnTheLeft ? 1 : Dest::RowsAtCompileTime, Side==OnTheRight ? 1 : Dest::ColsAtCompileTime> |
588 |
(dst, ((Side==OnTheLeft) ^ Transposed) ? m_permutation.indices().coeff(i) : i) |
588 |
(dst, ((Side==OnTheLeft) ^ Transposed) ? m_permutation.indices().coeff(i) : i) |