From 3df209ce65aa448d37f910face9990585b00c1a7 Mon Sep 17 00:00:00 2001 From: Ed Schmerling Date: Wed, 9 Oct 2024 16:43:14 -0700 Subject: [PATCH] Accommodate new `np.solve` broadcasting rules in NumPy 2.0 Fixes #15. --- hj_reachability/finite_differences/upwind_first.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hj_reachability/finite_differences/upwind_first.py b/hj_reachability/finite_differences/upwind_first.py index 6c0c9fa..892cdc2 100644 --- a/hj_reachability/finite_differences/upwind_first.py +++ b/hj_reachability/finite_differences/upwind_first.py @@ -166,7 +166,7 @@ def _diff_coefficients(k: Optional[int] = None, stencil: Optional[Array] = None) f"{(k, stencil.shape[-1] - 1)}.") return np.linalg.solve( np.diff(poly.polyvander(stencil, k), axis=-2)[..., 1:].swapaxes(-1, -2), - np.eye(k)[(np.newaxis,) * (stencil.ndim - 1) + (0,)]) + np.eye(k)[(np.newaxis,) * (stencil.ndim - 1) + (0, ..., np.newaxis)])[..., 0] def _substencil_coefficients(k: int) -> Array: