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

Best memory practice for C++ class making heavy use of Eigen

Tags: memory, eigen, c memory, eigen, c memory, eigen, c
(comma "," separated)
grekop
Registered Member
Posts
10
Karma
0
Hello all,
I have a C++ class which performs many operations on fix-sized large Eigen matrices (2000 rows by 100 columns matrix of doubles for example ).
The way i have my program structured currently i have in the heap ( as members of the class) these matrices.
With the newest version of eigen i get a compilation error that objects in the heap are too large!
However with older versions of Eigen i don't have this problem ?
Note that these big matrices are not completely re-written from scratch at each iteration.
The best practice would be to keep the matrix as a fixed size matrix in the heap, or recreate it at each call of the class ?
Instead of not recreating the matrix at each step could i store it some-where different than the heap ?
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
You can define EIGEN_STACK_ALLOCATION_LIMIT with an higher value. Default is 131072 (128kB). However, for such big object the overhead of dynamic allocation is negligible. So I'd recommend to simply use MatrixXd objects (or the like).

It is documented there: http://eigen.tuxfamily.org/dox-devel/To ... tml#title2


Bookmarks



Who is online

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