diff options
author | Gael Guennebaud <g.gael@free.fr> | 2014-02-14 23:10:16 +0100 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2014-02-14 23:10:16 +0100 |
commit | cd606bbc943c4862cf0cf596d3ef97aae32c2887 (patch) | |
tree | 0eb43ae9c7d41de71965d9c798a97e9f671279f9 /Eigen/src/SparseLU/SparseLU_Memory.h | |
parent | 0508af42870e01922f8195c70f1bf920e1df2b0a (diff) |
Fix infinite loop in sparselu
Diffstat (limited to 'Eigen/src/SparseLU/SparseLU_Memory.h')
-rw-r--r-- | Eigen/src/SparseLU/SparseLU_Memory.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Eigen/src/SparseLU/SparseLU_Memory.h b/Eigen/src/SparseLU/SparseLU_Memory.h index d068d62df..1ffa7d54e 100644 --- a/Eigen/src/SparseLU/SparseLU_Memory.h +++ b/Eigen/src/SparseLU/SparseLU_Memory.h @@ -70,7 +70,7 @@ Index SparseLUImpl<Scalar,Index>::expand(VectorType& vec, Index& length, Index if(num_expansions == 0 || keep_prev) new_len = length ; // First time allocate requested else - new_len = Index(alpha * length); + new_len = (std::max)(length+1,Index(alpha * length)); VectorType old_vec; // Temporary vector to hold the previous values if (nbElts > 0 ) @@ -107,7 +107,7 @@ Index SparseLUImpl<Scalar,Index>::expand(VectorType& vec, Index& length, Index do { alpha = (alpha + 1)/2; - new_len = Index(alpha * length); + new_len = (std::max)(length+1,Index(alpha * length)); #ifdef EIGEN_EXCEPTIONS try #endif |