Skip to content

Commit

Permalink
add link to numpy docs describing what this is doing
Browse files Browse the repository at this point in the history
the linked numpy doc goes into more detail on how this is more performant than a raw python `for` loop but not as performant as writing a complete ufunc ourselves.
  • Loading branch information
tomeichlersmith committed Jan 31, 2024
1 parent 53b95a9 commit 9508833
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions DetDescr/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ def to_layer(rawid):
# id is a np.array of raw ID numbers e.g. read in from the EcalSimHits_test.id_ branch of LDMX_Events
layer = to_layer(id)
```
This isn't very performant on larger arrays; however, it does allow the user to use some internal
optimizations that NumPy has and avoid a raw python `for` loop. We could look at incorporating
numpy into our Python bindings
This isn't very performant on larger arrays; however, it does allow the user to avoid a raw python `for` loop.
Effectively, we are using a [non-ufunc extension](https://numpy.org/doc/stable/user/c-info.ufunc-tutorial.html#example-non-ufunc-extension).
We could look at incorporating numpy into our Python bindings
(via [Boost.Python NumPy](https://live.boost.org/doc/libs/1_65_1/libs/python/doc/html/numpy/index.html))
to make this as performant as possible.

Expand Down

0 comments on commit 9508833

Please sign in to comment.