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

How to resize a statically allocated matrix

Tags: None
(comma "," separated)
suresh
Registered Member
Posts
1
Karma
0
OS
Hi
How to resize a statically allocated matrix in eigen2?
thanks
suresh
Hauke
Registered Member
Posts
109
Karma
3
OS
suresh wrote:Hi
How to resize a statically allocated matrix in eigen2?
thanks
suresh


I think you are looking for the following
Code: Select all
  Matrix<double,Dynamic,Dynamic,AutoAlign,16,16> some_static_matrix(4,4);
  std::cout << sizeof(some_static_matrix) - 16*16*sizeof(double) - 2*sizeof(int) << std::endl;
  some_static_matrix.resize(5,5);
  std::cout << sizeof(some_static_matrix) - 16*16*sizeof(double) - 2*sizeof(int) << std::endl;

The size of the object is in both cases 16*16*sizeof(double) plus the size of two integers (I think it are integers in Eigen2) to store the current size. So, to have a resizable stack matrix, you have to live with the memory penalty of two additional integers (in Eigen3, two additional DenseIndex variables).

Regards,
Hauke


Bookmarks



Who is online

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