boostorg / boostorg/histogram

Feature request: strided array support for fill?

オープン
#331 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
C++
スター
334
フォーク
76
PR マージ指標
30日以内にマージされた PR はありません

説明

In #327, the bug seems to be that single values are not supported correctly. In https://github.com/scikit-hep/hist/issues/303, scalars are currently not allowed for samples - in working on this, I found that `h.fill(0.3, sample=[1, 2], weight=1)` is not supported in boost-histogram, due to the spans not matching (may be solvable on the boost-histogram side).

A way to support this easily could be to support strided arrays, like NumPy, Eigen, Boost.MultiArray, etc. all provide. If an array is described by a stride and an offset, then setting that stride to 0 would allow a scalar value without having a scalar datatype. Then there would be half as many items in the fill variant, just arrays, no scalars anymore.

A related issue is that boost-histogram has to copy the input array if it's not already a dense 1D array. If describing an array with a starting pointer, stride, and offset was possible, then this would no longer be necessary, only the datatype would have to match to avoid a copy.

Thoughts?

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。