Skip to content

Commit de9b44f

Browse files
committed
ENH: use dot (BLAS!) in linalg.norm
1 parent ae8d7b5 commit de9b44f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

numpy/linalg/linalg.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -2048,7 +2048,8 @@ def norm(x, ord=None, axis=None):
20482048

20492049
# Check the default case first and handle it immediately.
20502050
if ord is None and axis is None:
2051-
return sqrt(add.reduce((x.conj() * x).real, axis=None))
2051+
xr = x.ravel()
2052+
return sqrt(dot(xr, xr.conj()).real)
20522053

20532054
# Normalize the `axis` argument to a tuple.
20542055
nd = x.ndim

0 commit comments

Comments
 (0)