This repository was archived by the owner on Feb 26, 2025. It is now read-only.
This repository was archived by the owner on Feb 26, 2025. It is now read-only.
Eigen::MatrixXd
as column major. #532Closed
Description
I've created a PR for adding an example which writes an Eigen::MatrixXd
, see #531. It's supposed to create a matrix
0 1 2
100 101 102
...
900 901 902
This matrix is then written to file. When dumping the resulting file I get
HDF5 "eigen_matrix_example.h5" {
GROUP "/" {
DATASET "dset" {
DATATYPE H5T_IEEE_F64LE
DATASPACE SIMPLE { ( 10, 3 ) / ( 10, 3 ) }
DATA {
(0,0): 0, 100, 200,
(1,0): 300, 400, 500,
(2,0): 600, 700, 800,
(3,0): 900, 1, 101,
(4,0): 201, 301, 401,
(5,0): 501, 601, 701,
(6,0): 801, 901, 2,
(7,0): 102, 202, 302,
(8,0): 402, 502, 602,
(9,0): 702, 802, 902
}
}
}
}
Which is consistent with HDF5 assuming data is row-major (C-style) and the actual Eigen matrix being column-major (Fortran/BLAS-style). I couldn't immediately find any code that transposes the matrix before writing it.
Note that a write-read cycle using HighFive returns, as expected, the same matrix.
Can someone confirm that I've set up the example properly and maybe comment on the desired behaviour?