From ea69dece6b30801e3423fd351518950dc0b7cace Mon Sep 17 00:00:00 2001 From: Matthew Smith <mjsmith6@illinois.edu> Date: Fri, 15 Oct 2021 12:40:33 -0500 Subject: [PATCH] use actx.np.sqrt instead of ^(1/2) --- grudge/reductions.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/grudge/reductions.py b/grudge/reductions.py index 5e8b4da7..2cde556d 100644 --- a/grudge/reductions.py +++ b/grudge/reductions.py @@ -80,14 +80,14 @@ def _norm(dcoll: DiscretizationCollection, vec, p, dd): return np.fabs(vec) if p == 2: from grudge.op import _apply_mass_operator - # Quantities being summed are real up to rounding error, so abs() can go on - # the outside - return abs( - nodal_sum( - dcoll, - dd, - vec.conj() * _apply_mass_operator(dcoll, dd, dd, vec)) - )**(1/2) + return vec.array_context.np.sqrt( + # Quantities being summed are real up to rounding error, so abs() can + # go on the outside + abs( + nodal_sum( + dcoll, + dd, + vec.conj() * _apply_mass_operator(dcoll, dd, dd, vec)))) elif p == np.inf: return nodal_max(dcoll, dd, abs(vec)) else: -- GitLab