ArrayWeighting

class odl.space.weighting.ArrayWeighting(array, impl, exponent=2.0)[source]

Bases: Weighting

Weighting of a space by an array.

The exact definition of the weighted inner product, norm and distance functions depend on the concrete space.

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

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(x1, x2)

Calculate the distance between two elements.

equiv(other)

Return True if other is an equivalent weighting.

inner(x1, x2)

Return the inner product of two elements.

is_valid()

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

norm(x)

Calculate the norm of an element.

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

Initialize a new instance.

Parameters:
arrayarray-like

Weighting array of inner product, norm and distance. Native Tensor instances are stored as-is without copying.

implstring

Specifier for the implementation backend.

exponentpositive float, optional

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