Skip to content

Commit

Permalink
Fix benign bug in midpoint evaluation. (#17)
Browse files Browse the repository at this point in the history
Resolves #16
  • Loading branch information
f0uriest authored Dec 3, 2024
2 parents 48fe56b + fa14060 commit 0cb837c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion quadax/adaptive.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ def adaptive_quadrature(
epsrel = setdefault(epsrel, jnp.sqrt(jnp.finfo(jnp.array(1.0)).eps))
fun, interval = map_interval(fun, interval)
vfunc = wrap_func(fun, args)
f = jax.eval_shape(vfunc, (interval[0] + interval[-1] / 2))
f = jax.eval_shape(vfunc, (interval[0] + interval[-1]) / 2)
epmach = jnp.finfo(f.dtype).eps
shape = f.shape

Expand Down
2 changes: 1 addition & 1 deletion quadax/romberg.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def romberg(
fun, interval = map_interval(fun, interval)
vfunc = wrap_func(fun, args)
a, b = interval
f = jax.eval_shape(vfunc, (a + b / 2))
f = jax.eval_shape(vfunc, (a + b) / 2)

result = jnp.zeros((divmax + 1, divmax + 1, *f.shape), f.dtype)
result = result.at[0, 0].set(vfunc(a) + vfunc(b))
Expand Down

0 comments on commit 0cb837c

Please sign in to comment.