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

About indices for Eigen matrices and vectors

Tags: None
(comma "," separated)
eigenlearner
Registered Member
Posts
17
Karma
0
I noticed that the indices for Eigen matrices and vectors are of int types, not unsigned int or size_t. When building 64bit Windows applications, the int is still 4 bytes therefore a matrix is limited to max 2GB. And the integer index range for a squared matrix is 0-46340(which is sqrt(2147483647)). This is really a big limitation to me when solving PDE problems.

So my question is why Eigen does not us size_t or other unsigned 64bit integer types as index type?
jitseniesen
Registered Member
Posts
204
Karma
2
The default index type for dense matrices is std::ptrdiff_t. This should be big enough in most cases. If not, you can change it by "#define EIGEN_DEFAULT_DENSE_INDEX_TYPE <new index type>".

The default index type for sparse matrices is int, I think. This is presumably to save memory: since the indices are stored, having a small index type helps. As you see, int is not big enough for many cases. You can change the index type by specifying the third template parameter for SparseMatrix, as indicated in the documentation at http://eigen.tuxfamily.org/dox-devel/cl ... ml#details .


Bookmarks



Who is online

Registered users: Baidu [Spider], Bing [Bot], Google [Bot]