Is your feature request related to a problem? Please describe.
Complex numbers are widely used in the physical sciences, and in some domains are very commonplace. C, C++, Fortran, Python, and Julia all have native complex numbers, all with the same representation in memory, that of an array of two numbers in the rectangular/Cartesian form. Currently, because there is no built-in datatype for HDF5 then library and application authors must create their own. A nice summary of the approaches different authors have taken is in this discussion on the CF-Conventions. Note that there are broadly speaking three approaches, but the one labelled 2a appears to be the most common.
Complex numbers have been discussed here previously, though still without real consensus:
Describe the solution you'd like
The minimal implementation that is most useful to the most number of people would be a set of complex types for float
and double
base types equivalent to the compound type:
DATATYPE "H5T_COMPLEX_<base float>" H5T_COMPOUND {
H5T_<base float> "r";
H5T_<base float> "i";
}
This would coincide with the choices made by h5py and HDF5.jl, for example.
The <base float>
above would either be NATIVE_FLOAT
/NATIVE_DOUBLE
and/or the IEEE_F*
types.
Describe alternatives you've considered
The existing solution is for each library and application to invent their own datatype. This has led to incompatible definitions for the type, reducing interoperability between tools and datasets. It also adds friction for developers and users in having to create the type or re-structure their data in comparison to other native types.
Additional context
Some commentators have called for this type to be flexible enough to work for higher order complex numbers such as quarternions. I'm not proposing that here as these types are generally not built-in types in the programming languages, at least not those used in the physical sciences. I believe that there may also be much more variety in the representations of quarternions so that it perhaps makes less sense to bless one particular form.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4