Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eigen max matrix size for 32 bit applications

Tags:

c++

matrix

eigen

So, I'm finding the Eigen package crashes when I try to declare a matrix larger than 10000x10000. I need to declare a matrix like this.. about 13000x13000 elements reliably. I ran a test like:

for( int tortureEigen = 1 ; tortureEigen < 50000 ; tortureEigen++ )
{
  printf( "Torturing Eigen with %dx%d..\n", tortureEigen, tortureEigen ) ;
  Eigen::MatrixXd m( tortureEigen, tortureEigen ) ;
}

Crashes on my machine (6 GB RAM) at 14008 elements.

I'm kind of disappointed! I thought Eigen was like MATLAB or octave and should not crash using larger arrays, even if it does hit the disk or something..

And what's more is when I run this test and keep TaskMan open, the process that is creating these matrices doesn't even use that much memory. TaskMan reports under 2k usage.

Using Eigen 2.0.15 stable release

like image 990
bobobobo Avatar asked Dec 17 '22 22:12

bobobobo


1 Answers

eigen developer here. You'd be far better off asking Eigen questions on our support channels e.g. forum... ;-)

Short answer: are you using fixed or dynamic-size matrices?

  • if fixed-size, switch to dynamic-size (for such huge sizes, it's a no-brainer anyway)

  • if you're getting the bug with dynamic-sized matrices, I'm suprised but at the same time I can see where the value 10000 comes from. In any case, if you upgrade to eigen3 (the development branch), your problem will be gone.

like image 101
Benoit Jacob Avatar answered Dec 19 '22 11:12

Benoit Jacob