Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: fix nans in Spread #615

Merged
merged 1 commit into from
Oct 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions pylops/basicoperators/_spread_numba.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import math
import os

from numba import jit, prange
Expand All @@ -21,8 +22,8 @@ def _matvec_numba_table(x, y, dims, interp, table, dtable):
dindices = dtable[ix0, it]

for i, indexfloat in enumerate(indices):
index = int(indexfloat)
if index != -9223372036854775808: # =int(np.nan)
if not math.isnan(indexfloat):
index = int(indexfloat)
if not interp:
y[i, index] += x[ix0, it]
else:
Expand All @@ -45,8 +46,8 @@ def _rmatvec_numba_table(x, y, dims, dimsd, interp, table, dtable):
dindices = dtable[ix0, it]

for i, indexfloat in enumerate(indices):
index = int(indexfloat)
if index != -9223372036854775808: # =int(np.nan)
if not math.isnan(indexfloat):
index = int(indexfloat)
if not interp:
y[ix0, it] += x[i, index]
else:
Expand All @@ -71,8 +72,8 @@ def _matvec_numba_onthefly(x, y, dims, interp, fh):
else:
indices, dindices = fh(ix0, it)
for i, indexfloat in enumerate(indices):
index = int(indexfloat)
if index != -9223372036854775808: # =int(np.nan)
if not math.isnan(indexfloat):
index = int(indexfloat)
if not interp:
y[i, index] += x[ix0, it]
else:
Expand All @@ -95,8 +96,8 @@ def _rmatvec_numba_onthefly(x, y, dims, dimsd, interp, fh):
else:
indices, dindices = fh(ix0, it)
for i, indexfloat in enumerate(indices):
index = int(indexfloat)
if index != -9223372036854775808: # =int(np.nan)
if not math.isnan(indexfloat):
index = int(indexfloat)
if not interp:
y[ix0, it] += x[i, index]
else:
Expand Down