NumpyTensorSpaceArrayWeighting

class odl.space.npy_tensors.NumpyTensorSpaceArrayWeighting(array, exponent=2.0)[source]

Bases: odl.space.weighting.ArrayWeighting

Weighting of a NumpyTensorSpace by an array.

This class defines a weighting by an array that has the same shape as the tensor space. Since the space is not known to this class, no checks of shape or data type are performed. See Notes for mathematical details.

Attributes
array

Weighting array of this instance.

exponent

Exponent of this weighting.

impl

Implementation backend of this weighting.

repr_part

String usable in a space’s __repr__ method.

Methods

dist(self, x1, x2)

Calculate the distance between two elements.

equiv(self, other)

Return True if other is an equivalent weighting.

inner(self, x1, x2)

Return the weighted inner product of x1 and x2.

is_valid(self)

Return True if the array is a valid weight, i.e. positive.

norm(self, x)

Return the weighted norm of x.

__init__(self, array, exponent=2.0)[source]

Initialize a new instance.

Parameters
arrayarray-like, one-dim.

Weighting array of the inner product, norm and distance. All its entries must be positive, however this is not verified during initialization.

exponentpositive float

Exponent of the norm. For values other than 2.0, no inner product is defined.

Notes

  • For exponent 2.0, a new weighted inner product with array W is defined as

    \langle A, B\rangle_W :=
\langle W \odot A, B\rangle =
\langle w \odot a, b\rangle =
b^{\mathrm{H}} (w \odot a),

    where a, b, w are the “flattened” counterparts of tensors A, B, W, respectively, b^{\mathrm{H}} stands for transposed complex conjugate and w \odot a for element-wise multiplication.

  • For other exponents, only norm and dist are defined. In the case of exponent \infty, the weighted norm is

    \| A\|_{W, \infty} :=
\| W \odot A\|_{\infty} =
\| w \odot a\|_{\infty},

    otherwise it is (using point-wise exponentiation)

    \| A\|_{W, p} :=
\| W^{1/p} \odot A\|_{p} =
\| w^{1/p} \odot a\|_{\infty}.

  • Note that this definition does not fulfill the limit property in p, i.e.

    \| A\|_{W, p} \not\to
\| A\|_{W, \infty} \quad (p \to \infty)

    unless all weights are equal to 1.

  • The array W may only have positive entries, otherwise it does not define an inner product or norm, respectively. This is not checked during initialization.