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
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
andx2
.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
- array
array-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.
- array
Notes
For exponent 2.0, a new weighted inner product with array is defined as
where are the “flattened” counterparts of tensors , respectively, stands for transposed complex conjugate and for element-wise multiplication.
For other exponents, only norm and dist are defined. In the case of exponent , the weighted norm is
otherwise it is (using point-wise exponentiation)
Note that this definition does not fulfill the limit property in , i.e.
unless all weights are equal to 1.
The array may only have positive entries, otherwise it does not define an inner product or norm, respectively. This is not checked during initialization.