HDF5 rowmajor或colmajor [英] HDF5 rowmajor or colmajor

查看:78
本文介绍了HDF5 rowmajor或colmajor的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以知道以HDF5格式存储的矩阵是RowMajor还是ColMajor?例如,当我保存八度音阶中的矩阵并将其内部存储为ColMajor时,当我在将矩阵存储在RowMajor中的C代码中读取它们时,需要对它们进行转置.

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, I need to transpose them when I read them in my C code where matrices are stored in RowMajor, and vice versa.

推荐答案

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

HDF5 stores data in row major order:

HDF5使用C存储约定,假定最后列出的维度是变化最快的维度,而第一个列出的维度是变化最快的维度.

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用户指南》 .

但是,如果您使用Octave的内置HDF5接口,它将为您自动转置阵列.通常,对于最终用户来说,如何将数据实际写入HDF5文件应该是完全不透明的,并且界面应处理数组顺序等方面的差异.

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.

这篇关于HDF5 rowmajor或colmajor的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆