NumpyTensorSpace._norm¶
-
NumpyTensorSpace.
_norm
(self, x)[source]¶ Return the norm of
x
.This function is part of the subclassing API. Do not call it directly.
- Parameters
- x
NumpyTensor
Element whose norm is calculated.
- x
- Returns
- norm
float
Norm of the element.
- norm
Examples
Different exponents result in difference norms:
>>> space_2 = odl.rn(3, exponent=2) >>> x = space_2.element([3, 0, 4]) >>> space_2.norm(x) 5.0 >>> space_1 = odl.rn(3, exponent=1) >>> x = space_1.element([3, 0, 4]) >>> space_1.norm(x) 7.0
Weighting is supported, too:
>>> space_1_w = odl.rn(3, exponent=1, weighting=[2, 1, 1]) >>> x = space_1_w.element([3, 0, 4]) >>> space_1_w.norm(x) 10.0