Skip to content

Commit

Permalink
testing issue
Browse files Browse the repository at this point in the history
  • Loading branch information
joanglaunes committed May 10, 2023
1 parent 0994d10 commit 976526a
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions pykeops/pykeops/sandbox/issue_310.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import numpy as np
from pykeops.numpy import Genred
# Simple formula
formula = "V0"
variables = ["V0=Vi(4)"]
# Sum on Vi
op = Genred(formula, variables, reduction_op="Sum", axis=0)
# data
arg = np.random.randn(10, 4)
# Perform reduction (add a dimension)
res = op(arg, backend="CPU")
print(res.shape)
#> (1, 4)
# Sum on Vj
op = Genred(formula, variables, reduction_op="Sum", axis=1)
# data
arg = np.random.randn(10, 4)
# Perform reduction (should do nothing?)
res = op(arg, backend="CPU")
print(res.shape)
#> (10, 4)
print(sum(res - arg))
#> array([0., 0., 0., 0.])

0 comments on commit 976526a

Please sign in to comment.