From 0a49a24f5c7e97cf9b210916ddd8431bede3afa3 Mon Sep 17 00:00:00 2001 From: India Marsden Date: Tue, 23 Jun 2026 14:50:41 +0100 Subject: [PATCH] change use of np.cross with numpy update --- fuse/traces.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/fuse/traces.py b/fuse/traces.py index b5f97225..0719312c 100644 --- a/fuse/traces.py +++ b/fuse/traces.py @@ -98,11 +98,16 @@ def tabulate(self, Qwts, trace_entity): return result def manipulate_basis(self, basis): - if basis.shape == (1, 1): + if basis.shape[-1] == 1: return basis elif basis.shape == (1, 2): result = np.matmul(basis, np.array([[0, -1], [1, 0]])) - elif basis.shape[0] == 2: + elif basis.shape == (2, 2): + # Two dim cross product - pad with zeros and take z component of result + zeros_row = np.zeros((basis.shape[0], 1), dtype=basis.dtype) + basis = np.hstack([basis, zeros_row]) + result = np.cross(basis[0], basis[1])[2] + elif basis.shape == (2, 3): result = np.cross(basis[0], basis[1]) else: raise ValueError("Immersion of HDiv edges not defined in 3D")