fingia
fingia

Reputation: 649

Eigen Dynamic matrices size

Say one has the following code:

cout<< sizeof(Eigen::Matrix<double, -1, -1 , 0 , 10, 10>)<<endl;
cout<< sizeof(Eigen::Matrix<double, -1, -1>)<<endl;

The first line outputs 3664 bytes, and the second one, 24 bytes.

I am trying to understand why specifying the maximum size results in this?

Computer architecture is x64.

Upvotes: 0

Views: 349

Answers (1)

ggael
ggael

Reputation: 29265

hm, you probably did a copy-paste mistake, because, as expected, I obtain:

816
24

Indeed, as explain in the documentation of Eigen::Matrix, specifying the maximum sizes at compile time amounts, in your case, to the following structure:

struct {
  double data[10*10]; // 800 Bytes
  long rows, cols;    // 16 Bytes
};

Upvotes: 1

Related Questions