summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
Diffstat (limited to 'numpy')
-rw-r--r--numpy/linalg/linalg.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/numpy/linalg/linalg.py b/numpy/linalg/linalg.py
index 7ce854197..40f259001 100644
--- a/numpy/linalg/linalg.py
+++ b/numpy/linalg/linalg.py
@@ -2520,9 +2520,11 @@ def norm(x, ord=None, axis=None, keepdims=False):
x = x.ravel(order='K')
if isComplexType(x.dtype.type):
- sqnorm = dot(x.real, x.real) + dot(x.imag, x.imag)
+ x_real = x.real
+ x_imag = x.imag
+ sqnorm = x_real.dot(x_real) + x_imag.dot(x_imag)
else:
- sqnorm = dot(x, x)
+ sqnorm = x.dot(x)
ret = sqrt(sqnorm)
if keepdims:
ret = ret.reshape(ndim*[1])