Read complex values from .mat
files via HDF5 C++ API
#343
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Allows us to read complex MATLAB arrays via the HDF5 API.
To do this, we have to define (at runtime) a
H5::CompType
instance that describes the data-structure that needs to be read in - in this case, that describes the format in which MATLAB saves complex data. Note that there is no HDF5 standard for complex datatypes, so trying to read complex data from something likeh5py
- created files will require separate, but similar, treatment.Implementation
The
hdf5_compound_types.{h,cpp}
file has been created to contain compound types.Currently there is only one compound type,
MATLAB_complex
. But the following convention has been set given the remark above about compound datatypes and the lack of standard format for complex-values in particular:struct
that is compatible with the compound data-type to be readto_hdf5_CompType()
method that returns aH5::CompType
instance, that can be passed to the API to read data into the aforementionedstruct
via theread
method.std::
datatypes (orstd::vector
s thereof) so that we don't have to reimplement algebra.Testing
Additional tests in
test_hdf5_compound_types.cpp
that check that:HDF5Reader::read()
method performs as expected forMATLAB_complex
types