HDF5 rowmajor 或 colmajor

标签 hdf5

是否可以知道以 HDF5 格式存储的矩阵是 RowMajor 还是 ColMajor?例如,当我从 octave 中保存矩阵时,它们在内部存储为 ColMajor,当我在我的 C 代码中读取它们时,我需要转置它们,其中矩阵存储在 RowMajor 中,反之亦然。

最佳答案

HDF5 按行主要顺序存储数据:

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.



来自 HDF5 User's Guide .

然而 ,如果您使用 Octave 的内置 HDF5 接口(interface),它会自动为您转置数组。一般来说,数据实际上是如何写入 HDF5 文件的,对最终用户来说应该是完全不透明的,接口(interface)应该处理数组排序等方面的差异。

关于HDF5 rowmajor 或 colmajor,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24116713/

相关文章:

c++ - 在 hdf5 中使用 std::string 会产生不可读的输出

python - 在 HDF 存储中构建数据结构

c# - 如何将大型多维数组分段写入 HDF5 文件?

go - GO中如何指向C头文件?

c++ - 从 HDF5 vector 填充 Armadillo vec

c# - 如果我将 Offset 设置为非零,则使用 hyperslab 从 HDF5 文件读取数据时出现异常

python - 当字符串列内容比已有内容长时,HDFStore.append(string, DataFrame) 失败

c++ - HDF5 中的嵌套复合数据类型

python - 将日期从 HDF5 数据集转换为 numpy 数组

python - 使用 HDFStore 压缩数据