aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/Core/PermutationMatrix.h
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2014-09-29 10:27:51 +0200
committerGravatar Gael Guennebaud <g.gael@free.fr>2014-09-29 10:27:51 +0200
commitf0a62c90bcb59bbea04cbb3cb4cc818cda9251ce (patch)
tree80049098de6576853760c702b313e704be8e0b4a /Eigen/src/Core/PermutationMatrix.h
parent2946992ad4bc929d231282b477a23175cc1c0090 (diff)
Avoid comparisons between different index types.
Diffstat (limited to 'Eigen/src/Core/PermutationMatrix.h')
-rw-r--r--Eigen/src/Core/PermutationMatrix.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/Eigen/src/Core/PermutationMatrix.h b/Eigen/src/Core/PermutationMatrix.h
index d5113ce19..4846f2ae1 100644
--- a/Eigen/src/Core/PermutationMatrix.h
+++ b/Eigen/src/Core/PermutationMatrix.h
@@ -303,7 +303,9 @@ class PermutationMatrix : public PermutationBase<PermutationMatrix<SizeAtCompile
/** Constructs an uninitialized permutation matrix of given size.
*/
explicit inline PermutationMatrix(Index size) : m_indices(size)
- {}
+ {
+ eigen_internal_assert(size <= NumTraits<StorageIndexType>::highest());
+ }
/** Copy constructor. */
template<typename OtherDerived>
@@ -375,7 +377,8 @@ class PermutationMatrix : public PermutationBase<PermutationMatrix<SizeAtCompile
: m_indices(other.nestedPermutation().size())
{
eigen_internal_assert(m_indices.size() <= NumTraits<StorageIndexType>::highest());
- for (StorageIndexType i=0; i<m_indices.size();++i)
+ StorageIndexType end = StorageIndexType(m_indices.size());
+ for (StorageIndexType i=0; i<end;++i)
m_indices.coeffRef(other.nestedPermutation().indices().coeff(i)) = i;
}
template<typename Lhs,typename Rhs>