Skip to content

Commit

Permalink
replace numba with numpy
Browse files Browse the repository at this point in the history
  • Loading branch information
DomFijan committed Nov 16, 2024
1 parent bf04639 commit 80c749e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 17 deletions.
1 change: 0 additions & 1 deletion .github/workflows/requirements-test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@ numpy == 2.0
ruptures == 1.1.9
scikit-learn == 1.5
pandas == 2.2.2
numba == 0.60
xarray == 2024.6
19 changes: 3 additions & 16 deletions dupin/data/spatial.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,11 @@
from . import base


def _njit(*args, **kwargs):
"""Allow for JIT when numba is found."""
try:
import numba
except ImportError:
return lambda x: x
return numba.njit(*args, **kwargs)


@_njit()
def _freud_neighbor_summing(
arr: np.ndarray,
particle_index: np.ndarray,
neighbor_index: np.ndarray,
base: np.ndarray,
arr, particle_index, neighbor_index, base
) -> np.ndarray:
for i, j in zip(particle_index, neighbor_index):
base[i] += arr[j]
np.add.at(base, particle_index, arr[neighbor_index])
return base


class NeighborAveraging(base.DataMap):
Expand Down

0 comments on commit 80c749e

Please sign in to comment.