Skip to content

Commit

Permalink
put abs() inside the sum
Browse files Browse the repository at this point in the history
  • Loading branch information
majosm committed Oct 20, 2021
1 parent 214e865 commit 1778902
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions grudge/reductions.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,10 @@ def _norm(dcoll: DiscretizationCollection, vec, p, dd) -> Any:
if p == 2:
from grudge.op import _apply_mass_operator
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))))
nodal_sum(
dcoll,
dd,
abs(vec.conj() * _apply_mass_operator(dcoll, dd, dd, vec))))
elif p == np.inf:
return nodal_max(dcoll, dd, abs(vec))
else:
Expand Down

0 comments on commit 1778902

Please sign in to comment.