HDF5 rowmajor or colmajor

前端 未结 2 2474
你的背包
你的背包 2021-01-12 20:50

Is it possible to know if a matrix stored in HDF5 format is in RowMajor or ColMajor? For example when I save matrices from octave, which stores them internally as ColMajor,

2条回答
  •  清歌不尽
    2021-01-12 20:57

    HDF5 stores data in row major order:

    HDF5 uses C storage conventions, assuming that the last listed dimension is the fastest-changing dimension and the first-listed dimension is the slowest changing.

    from the HDF5 User's Guide.

    However, if you're using Octave's built-in HDF5 interface, it will automatically transpose the arrays for you. In general, how the data is actually written in the HDF5 file should be completely opaque to the end-user, and the interface should deal with differences in array ordering, etc.

提交回复
热议问题