aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/Core/PermutationMatrix.h
diff options
context:
space:
mode:
authorGravatar Georg Drenkhahn <Georg.Drenkhahn@gmail.com>2014-09-22 17:59:02 +0200
committerGravatar Georg Drenkhahn <Georg.Drenkhahn@gmail.com>2014-09-22 17:59:02 +0200
commit2946992ad4bc929d231282b477a23175cc1c0090 (patch)
tree8d83888ef40063e7057e65830a8bf0c53a0ae42b /Eigen/src/Core/PermutationMatrix.h
parent821ff0ecfb4efe86e5045742682c918b01e5a263 (diff)
Using StorageIndexType for loop assigning initial permutation. Adding assert for index overflow.
Diffstat (limited to 'Eigen/src/Core/PermutationMatrix.h')
-rw-r--r--Eigen/src/Core/PermutationMatrix.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/Eigen/src/Core/PermutationMatrix.h b/Eigen/src/Core/PermutationMatrix.h
index b67046144..d5113ce19 100644
--- a/Eigen/src/Core/PermutationMatrix.h
+++ b/Eigen/src/Core/PermutationMatrix.h
@@ -374,7 +374,9 @@ class PermutationMatrix : public PermutationBase<PermutationMatrix<SizeAtCompile
PermutationMatrix(const Transpose<PermutationBase<Other> >& other)
: m_indices(other.nestedPermutation().size())
{
- for (typename IndicesType::Index i=0; i<m_indices.size();++i) m_indices.coeffRef(other.nestedPermutation().indices().coeff(i)) = i;
+ eigen_internal_assert(m_indices.size() <= NumTraits<StorageIndexType>::highest());
+ for (StorageIndexType i=0; i<m_indices.size();++i)
+ m_indices.coeffRef(other.nestedPermutation().indices().coeff(i)) = i;
}
template<typename Lhs,typename Rhs>
PermutationMatrix(internal::PermPermProduct_t, const Lhs& lhs, const Rhs& rhs)