BlueBrain / HighFive

HighFive - Header-only C++ HDF5 interface
https://bluebrain.github.io/HighFive/
Boost Software License 1.0
673 stars 159 forks source link

Implement `squeeze` and `reshape`. #991

Closed 1uc closed 4 months ago

1uc commented 4 months ago

These methods allow reshaping the memory space. This can be used as an alternative to broadcasting.

Example:

Let dset be a dataset with shape [3, 1, 1]. Then,

dset.reshapeMemSpace({3}).read<std::vector<double>>();
dset.squeezeMemSpace({1, 2}).read<std::vector<double>>();

can be used to read into a one-dimensional dataset.

1uc commented 4 months ago

This is preparatory work to allow #992.

codecov-commenter commented 4 months ago

Codecov Report

Attention: Patch coverage is 83.75000% with 13 lines in your changes are missing coverage. Please review.

Project coverage is 86.26%. Comparing base (070badf) to head (1f09187). Report is 1 commits behind head on master.

Files Patch % Lines
src/examples/broadcasting_arrays.cpp 0.00% 9 Missing :warning:
include/highfive/bits/H5Attribute_misc.hpp 72.72% 3 Missing :warning:
include/highfive/bits/H5Slice_traits_misc.hpp 92.85% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #991 +/- ## ========================================== - Coverage 86.31% 86.26% -0.05% ========================================== Files 92 94 +2 Lines 5919 5986 +67 ========================================== + Hits 5109 5164 +55 - Misses 810 822 +12 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.