HighFive icon indicating copy to clipboard operation
HighFive copied to clipboard

Deprecate broadcasting.

Open 1uc opened this issue 2 years ago • 1 comments

HighFive has a feature that allows reading an array with leading (or trailing) singleton dimensions into an array with lower dimension, i.e. if the selection is {1, 3} we can read this into anything one-dimensional, such as an std::vector<double>.

It's currently one of the reasons we need to know the dimension of a container at compile time. The proposal is to drop the feature from v3 and replace it with the explicit ability to reshape a selection. Something similar to:

count = {1, 12};
dset.select(RegularHyperSlab(offset, count))
    .reshapeMemSpace({count[1]})
    .read<std::vector<double>>();

The advantage is that we don't internally change the rank of an array. We avoid the need to know at compile-time the rank of an array. It can work even if one wants to strip from both sides. It would also work for HyperSlabs since for them the resulting selection could be any subregion, we currently only allow reading those selection into one-dimensional arrays. If the user knows it's two-dimensional they can provide the dimensions by using a different overload. It should works symmetrically on reading and writing. I feel it has rather low mental cost / complexity.

1uc avatar Feb 02 '24 13:02 1uc

Yes of course. This feature is a pain to fix the auto-magic support of a lot of types.

alkino avatar Feb 05 '24 08:02 alkino

Removed by #992.

1uc avatar May 14 '24 05:05 1uc