[Hdf-forum] Output Column Major from C

digitalriptide digitalriptide at gmail.com
Fri Aug 1 15:13:55 CDT 2014


I have an array in C that contains a number of doubles that represent a
matrix stored in column major order. I can output this data to an HDF5 file
with the following C code:

...
dims[2] = { 2, 3 };
dataspace_id = H5Screate_simple( 2, dims, NULL );
dataset_id = H5Dcreate2( hdf_file_id, group_id, H5T_NATIVE_DOUBLE,
dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT );
H5Dwrite( dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT,
column_major_data );
...

but when I view the data with h5dump, for example, the matrix is displayed
as if it is row major. Is there some way to tell HDF5 to interpret the data
as column major instead of row major? I can always permute my data before
saving out, but this is a bit of extra code that I would like to avoid.

Thank you for your advice!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.lists.hdfgroup.org/pipermail/hdf-forum_lists.hdfgroup.org/attachments/20140801/69e9cde9/attachment.html>


More information about the Hdf-forum mailing list