CustomDist

class odl.core.space.weightings.weighting.CustomDist(dist, impl, device, shape=())[source]

Bases: Weighting

Class for handling a user-specified distance.

Note that this removes inner and norm.

__init__(dist, impl, device, shape=())[source]

Initialize a new instance.

Parameters

distcallable

The distance function defining a metric on a LinearSpace. It must accept two LinearSpaceElement arguments, return a float and and fulfill the following mathematical conditions for any three space elements x, y, z:

  • dist(x, y) >= 0

  • dist(x, y) = 0 if and only if x = y

  • dist(x, y) = dist(y, x)

  • dist(x, y) <= dist(x, z) + dist(z, y)

implstring

Specifier for the implementation backend

device :

device identifier, compatible with the backend associated with impl

shape :

what shape array need to have to be processed by this weighting. The dist callable can assume that the shape has already been checked. If an empty shape is specified (the default), dist should be able to handle arrays of arbitrary shape.