New user self-registration is disabled due to spam. Please email eigen-core-team @ if you need an account.
Before reporting a bug, please make sure that your Eigen version is up-to-date!
Bug 1075 - AlignedBox::sample() method when using AlignedBoxXd fails assertion
Summary: AlignedBox::sample() method when using AlignedBoxXd fails assertion
Alias: None
Product: Eigen
Classification: Unclassified
Component: Geometry (show other bugs)
Version: 3.2
Hardware: x86 - 64-bit Mac OS
: Normal Crash
Assignee: Nobody
Depends on:
Reported: 2015-09-28 20:30 UTC by niekbouman
Modified: 2015-09-30 09:45 UTC (History)
4 users (show)


Description niekbouman 2015-09-28 20:30:06 UTC
I am using an AlignedBoxXd, when I call sample() on it, I get an assertion failure:

Assertion failed: (index >= 0 && index < size()), function operator[], file /opt/local/include/eigen3/Eigen/src/Core/DenseCoeffsBase.h, line 378. 

The problems seems to be that the vector 'r' in the code below (AlignedBox.h, line 166), which is of type VectorType (I guess VectorXd in this case) is not given a size before it is used in 'r[d]' (line 171).

  inline VectorType sample() const
  165   {
  166     VectorType r;
  167     for(Index d=0; d<dim(); ++d)
  168     {
  169       if(!ScalarTraits::IsInteger)
  170       {
  171         r[d] = m_min[d] + (m_max[d]-m_min[d])
  172              * internal::random<Scalar>(Scalar(0), Scalar(1));
  173       }
  174       else
  175         r[d] = internal::random(m_min[d], m_max[d]);
  176     }
  177     return r;
  178   }
Comment 1 Gael Guennebaud 2015-09-30 09:45:31 UTC
Thank you for the report.


Note You need to log in before you can comment on or make changes to this bug.