This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Maximum matrix size?

Tags: None
(comma "," separated)
stair314
Registered Member
Posts
8
Karma
0

Maximum matrix size?

Sat Aug 08, 2009 6:20 am
Is there a fixed size above which Eigen will seg fault? I have found a very simply case where a matrix-matrix multiply will cause a seg fault, but I'm not sure if this is a "bug" or if this is me exceeding the intended usage. If it's a bug I'll file it on the tracker.

#include <Eigen/Core>
#include <Eigen/Array>
#include <iostream>

using namespace std;
USING_PART_OF_NAMESPACE_EIGEN

int main(int argc, char ** argv)
{
int m = 784;
int n = 12800;
int p = 1;
MatrixXf a(m,n);
MatrixXf b(n,p);
MatrixXf c(m,p);
c = a * b;
return 0;
}

Interestingly enough, if I set n much higher, such as to 25600, it works fine.
User avatar
bjacob
Registered Member
Posts
658
Karma
3

Re: Maximum matrix size?

Sat Aug 08, 2009 8:11 am
I tried your program: here it runs fine.

I don't know where your segfault comes from. There's no maximum size in Eigen, at least not for dynamic-size matrices as you're using.

Note that your matrices have uninitialized coefficients, but indeed that shouldn't cause a segfault.


Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list!
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS

Re: Maximum matrix size?

Sat Aug 08, 2009 8:39 am
here it segfault with the 2.0 branch, I'll investigate...
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS

Re: Maximum matrix size?

Sat Aug 08, 2009 8:46 am
ok, this is what I thought, EIGEN_STACK_ALLOCATION_LIMIT was set to a too large value. So you can workaround by defining :

#define EIGEN_STACK_ALLOCATION_LIMIT 1000000

before including Eigen/Core, or you can fetch the current 2.0 branch using mercurial.
stair314
Registered Member
Posts
8
Karma
0

Re: Maximum matrix size?

Sat Aug 08, 2009 6:11 pm
Thanks! That fixed it.


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Sogou [Bot]