From 6ed2b4aedd879e117c7d92a52579d76190dcf5a2 Mon Sep 17 00:00:00 2001 From: Wenzel Jakob Date: Tue, 22 Sep 2015 03:03:40 +0200 Subject: [PATCH] fix internal checks in QMC samplers --- src/samplers/halton.cpp | 2 +- src/samplers/hammersley.cpp | 2 +- src/samplers/sobol.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/samplers/halton.cpp b/src/samplers/halton.cpp index 12941660..3d5690df 100644 --- a/src/samplers/halton.cpp +++ b/src/samplers/halton.cpp @@ -363,7 +363,7 @@ public: Point2 next2D() { /* Skip over dimensions that were reserved to arrays */ - if (m_dimension >= m_arrayStartDim && m_dimension < m_arrayEndDim) + if (m_dimension + 1 >= m_arrayStartDim && m_dimension < m_arrayEndDim) m_dimension = m_arrayEndDim; if (m_dimension + 1 >= primeTableSize) Log(EError, "Lookup dimension exceeds the prime number table size! " diff --git a/src/samplers/hammersley.cpp b/src/samplers/hammersley.cpp index 85a1f11c..ae97b526 100644 --- a/src/samplers/hammersley.cpp +++ b/src/samplers/hammersley.cpp @@ -258,7 +258,7 @@ public: Point2 next2D() { /* Skip over dimensions that were reserved to arrays */ - if (m_dimension >= m_arrayStartDim && m_dimension < m_arrayEndDim) + if (m_dimension + 1 >= m_arrayStartDim && m_dimension < m_arrayEndDim) m_dimension = m_arrayEndDim; if (m_dimension + 1 >= primeTableSize) Log(EError, "Lookup dimension exceeds the prime number table size! " diff --git a/src/samplers/sobol.cpp b/src/samplers/sobol.cpp index c001e61d..99d938a1 100644 --- a/src/samplers/sobol.cpp +++ b/src/samplers/sobol.cpp @@ -231,7 +231,7 @@ public: Float value1, value2; /* Skip over dimensions that were reserved to arrays */ - if (m_dimension >= m_arrayStartDim && m_dimension < m_arrayEndDim) + if (m_dimension + 1 >= m_arrayStartDim && m_dimension < m_arrayEndDim) m_dimension = m_arrayEndDim; if (m_dimension + 1 >= sobol::Matrices::num_dimensions)