odl

ODL (Operator Discretization Library).

ODL is a Python library for fast prototyping focusing on (but not restricted to) inverse problems.

Modules

Classes

AdapterOperator()

Operators that do not do anything mathematical, but allow bridging together operators that would otherwise be incompatible, e.g. due to array storage on different computational devices.

ArrayBackend(impl, array_namespace, ...)

Class to implement the array backend associated to each TensorSpace Implementations.

ArrayBackendChange(domain_impl, range_impl)

A pseudo-operator that transfers arrays from one backend to another.

BroadcastOperator(*args, **kwargs)

Broadcast argument to set of operators.

CartesianProduct(*sets)

Cartesian product of a finite number of sets.

ComplexEmbedding(*args, **kwargs)

Operator that embeds a vector into a complex space.

ComplexModulus(*args, **kwargs)

Operator that computes the modulus (absolute value) of a vector.

ComplexModulusSquared(*args, **kwargs)

Operator that computes the squared complex modulus (absolute value).

ComplexNumbers()

Set of complex numbers.

ComponentProjection(*args, **kwargs)

Projection onto the subspace identified by an index.

ComponentProjectionAdjoint(*args, **kwargs)

Adjoint operator to ComponentProjection.

ConstantOperator(*args, **kwargs)

Operator that always returns the same value.

DeviceChange(domain_device, range_device[, ...])

A pseudo-operator that copies arrays from one computational device to another.

DiagonalOperator(*args, **kwargs)

Diagonal 'matrix' of operators.

DiscretizedSpace(partition, tspace, **kwargs)

Discretization of a Lebesgue L^p space.

DiscretizedSpaceElement(space, tensor)

Representation of a DiscretizedSpace element.

DistOperator(*args, **kwargs)

Operator taking the distance to a fixed space element.

Divergence(*args, **kwargs)

Divergence operator for DiscretizedSpace spaces.

EmptySet()

Set with no member elements (except None).

Field()

A set that satisfies the field axioms.

FiniteSet(*elements)

A set given by a finite number of elements.

FlatteningOperator(*args, **kwargs)

Operator that reshapes the object as a column vector.

FunctionalLeftVectorMult(*args, **kwargs)

Expression type for the functional left vector multiplication.

Gradient(*args, **kwargs)

Spatial gradient operator for DiscretizedSpace spaces.

IdentityOperator(*args, **kwargs)

Operator mapping each element to itself.

ImagPart(*args, **kwargs)

Operator that extracts the imaginary part of a vector.

InnerProductOperator(*args, **kwargs)

Operator taking the inner product with a fixed space element.

Integers()

Set of integers.

IntervalProd(min_pt, max_pt)

An n-dimensional rectangular box.

Laplacian(*args, **kwargs)

Spatial Laplacian operator for DiscretizedSpace spaces.

LinCombOperator(*args, **kwargs)

Operator mapping two space elements to a linear combination.

LinearSpace(field)

Abstract linear vector space.

MatrixOperator(*args, **kwargs)

A matrix acting as a linear operator.

MultiplyOperator(*args, **kwargs)

Operator multiplying by a fixed space or field element.

NormOperator(*args, **kwargs)

Vector space norm as an operator.

OpDomainError

Exception for domain errors.

OpNotImplementedError

Exception for not implemented errors in LinearSpace's.

OpRangeError

Exception for domain errors.

OpTypeError

Exception for operator type errors.

Operator(*args, **kwargs)

Abstract mathematical operator.

OperatorComp(*args, **kwargs)

Expression type for the composition of operators.

OperatorLeftScalarMult(*args, **kwargs)

Expression type for the operator left scalar multiplication.

OperatorLeftVectorMult(*args, **kwargs)

Expression type for the operator left vector multiplication.

OperatorPointwiseProduct(*args, **kwargs)

Expression type for the pointwise operator multiplication.

OperatorRightScalarMult(*args, **kwargs)

Expression type for the operator right scalar multiplication.

OperatorRightVectorMult(*args, **kwargs)

Expression type for the operator right vector multiplication.

OperatorSum(*args, **kwargs)

Expression type for the sum of operators.

OperatorVectorSum(*args, **kwargs)

Operator that computes op(x) + y.

PartialDerivative(*args, **kwargs)

Calculate the discrete partial derivative along a given axis.

PointwiseInner(*args, **kwargs)

Take the point-wise inner product with a given vector field.

PointwiseNorm(*args, **kwargs)

Take the point-wise norm of a vector field.

PointwiseSum(*args, **kwargs)

Take the point-wise sum of a vector field.

PowerOperator(*args, **kwargs)

Operator taking a fixed power of a space or field element.

ProductSpace(*spaces, **kwargs)

Cartesian product of LinearSpace's.

ProductSpaceOperator(*args, **kwargs)

A "matrix of operators" on product spaces.

RealNumbers()

Set of real numbers.

RealPart(*args, **kwargs)

Operator that extracts the real part of a vector.

RectGrid(*coord_vectors)

An n-dimensional rectilinear grid.

RectPartition(intv_prod, grid)

Rectangular partition by hypercubes based on RectGrid.

ReductionOperator(*args, **kwargs)

Reduce argument over set of operators.

Resampling(*args, **kwargs)

An operator that resamples on a different grid in the same set.

ResizingOperator(*args, **kwargs)

Operator mapping a discretized function to a new domain.

SamplingOperator(*args, **kwargs)

Operator that samples coefficients.

ScalingOperator(*args, **kwargs)

Operator of multiplication with a scalar.

Set()

An abstract set.

SetIntersection(*sets)

The intersection of several subsets.

SetUnion(*sets)

The union of several subsets.

Strings(length)

Set of fixed-length (unicode) strings.

UniversalSet()

Set of all objects.

UniversalSpace()

A dummy linear space class.

WeightedSumSamplingOperator(*args, **kwargs)

Operator computing the sum of coefficients at sampling locations.

ZeroOperator(*args, **kwargs)

Operator mapping each element to the zero element.

Functions

abs(x[, out])

Calculates the absolute value for each element x_i of the input array x.

acos(x[, out])

Calculates an implementation-dependent approximation of the principal value of the inverse cosine for each element x_i of the input array x.

acosh(x[, out])

Calculates an implementation-dependent approximation to the inverse hyperbolic cosine for each element x_i of the input array x.

add(x1, x2[, out])

Calculates the sum for each element x1_i of the input array x1 with the respective element x2_i of the input array x2.

all(x)

Test whether all array elements along a given axis evaluate to True.

allclose(x, y[, rtol, atol, equal_nan])

Returns True if two arrays are element-wise equal within a tolerance.

any(x)

Test whether any array element along a given axis evaluates to True.

arange(impl, start[, stop, step, dtype, device])

Returns evenly spaced values within the half-open interval [start, stop) as a one-dimensional array.

as_scipy_functional(func[, return_gradient])

Wrap op as a function operating on linear arrays.

as_scipy_operator(op)

Wrap op as a scipy.sparse.linalg.LinearOperator.

asarray(x)

Returns an array corresponding to an ODL object.

asin(x[, out])

Calculates an implementation-dependent approximation of the principal value of the inverse sine for each element x_i of the input array x.

asinh(x[, out])

Calculates an implementation-dependent approximation to the inverse hyperbolic sine for each element x_i in the input array x.

atan(x[, out])

Calculates an implementation-dependent approximation of the principal value of the inverse tangent for each element x_i of the input array x.

atan2(x1, x2[, out])

Calculates an implementation-dependent approximation of the inverse tangent of the quotient x1/x2, having domain [-infinity, +infinity]     imes [-infinity, +infinity] (where the ` imes` notation denotes the set of ordered pairs of elements (x1_i, x2_i)) and codomain [-pi, +pi], for each pair of elements (x1_i, x2_i) of the input arrays x1 and x2, respectively.

atanh(x[, out])

Calculates an implementation-dependent approximation to the inverse hyperbolic tangent for each element x_i of the input array x.

bitwise_and(x1, x2[, out])

Computes the bitwise AND of the underlying binary representation of each element x1_i of the input array x1 with the respective element x2_i of the input array x2.

bitwise_invert(x[, out])

Inverts (flips) each bit for each element x_i of the input array x.

bitwise_left_shift(x1, x2[, out])

Shifts the bits of each element x1_i of the input array x1 to the left by appending x2_i (i.e., the respective element in the input array x2) zeros to the right of x1_i.

bitwise_or(x1, x2[, out])

Computes the bitwise OR of the underlying binary representation of each element x1_i of the input array x1 with the respective element x2_i of the input array x2.

bitwise_right_shift(x1, x2[, out])

Shifts the bits of each element x1_i of the input array x1 to the right according to the respective element x2_i of the input array x2.

bitwise_xor(x1, x2[, out])

Computes the bitwise XOR of the underlying binary representation of each element x1_i of the input array x1 with the respective element x2_i of the input array x2.

can_cast(array_namespace, from_dtype, to_dtype)

NumPy-like can_cast for Python Array API backends.

ceil(x[, out])

Rounds each element x_i of the input array x to the smallest (i.e., closest to -infty) integer-valued number that is not less than x_i.

check_device(impl, device)

Checks the device argument.

clip(x[, out, min, max])

Clamps each element x_i of the input array x to the range [min, max].

cn(shape[, dtype, impl, device])

Return a space of complex tensors.

conj(x[, out])

Returns the complex conjugate for each element x_i of the input array x.

copysign(x1, x2[, out])

Composes a floating-point value with the magnitude of x1_i and the sign of x2_i for each element of the input array x1.

cos(x[, out])

Calculates an implementation-dependent approximation to the cosine for each element x_i of the input array x.

cosh(x[, out])

Calculates an implementation-dependent approximation to the hyperbolic cosine for each element x_i in the input array x.

cumulative_prod(x[, axis, dtype, ...])

Calculates the cumulative product of elements in the input array x.

cumulative_sum(x[, axis, dtype, include_initial])

Calculates the cumulative sum of elements in the input array x.

divide(x1, x2[, out])

Calculates the division of each element x1_i of the input array x1 with the respective element x2_i of the input array x2.

empty(impl, shape[, dtype, device])

Returns an uninitialized array having a specified shape.

empty_like(x[, dtype, device])

Returns an uninitialized array with the same shape as an input array x.

equal(x1, x2[, out])

Computes the truth value of x1_i == x2_i for each element x1_i of the input array x1 with the respective element x2_i of the input array x2.

exp(x1[, out])

Calculates an implementation-dependent approximation to the exponential function for each element x_i of the input array x (e raised to the power of x_i, where e is the base of the natural logarithm).

expm1(x1[, out])

Calculates an implementation-dependent approximation to exp(x_i) - 1 for each element x_i of the input array x.

eye(impl, n_rows[, n_cols, k, dtype, device])

Returns a two-dimensional array with ones on the kth diagonal and zeros elsewhere.

floor(x1[, out])

Rounds each element x_i of the input array x to the largest (i.e., closest to +infty) integer-valued number that is not greater than x_i.

floor_divide(x1, x2[, out])

Calculates the largest integer-valued number that is not greater than the result of dividing each element x1_i of the input array x1 by the respective element x2_i of the input array x2.

full(impl, shape, fill_value[, dtype, device])

Returns a new array having a specified shape and filled with fill_value.

full_like(x, fill_value[, dtype, device])

Returns a new array filled with fill_value and having the same shape as an input array x.

get_array_and_backend(x[, must_be_contiguous])

Convenience function for getting an ArrayBackend from an array-like argument.

greater(x1, x2[, out])

Computes the truth value of x1_i > x2_i for each element x1_i of the input array x1 with the respective element x2_i of the input array x2.

greater_equal(x1, x2[, out])

Computes the truth value of x1_i >= x2_i for each element x1_i of the input array x1 with the respective element x2_i of the input array x2.

hypot(x1, x2[, out])

Computes the square root of the sum of squares for each element x1_i of the input array x1 with the respective element x2_i of the input array x2.

imag(x1[, out])

Returns the imaginary part of each element x_i of the input array x.

isclose(x, y[, rtol, atol, equal_nan])

Returns a boolean array where two arrays are element-wise equal within a tolerance.

isfinite(x1[, out])

Tests each element x_i of the input array x to determine if it is finite (i.e., not NaN and not an infinity).

isinf(x1[, out])

Tests each element x_i of the input array x to determine if it is a positive or negative infinity.

isnan(x1[, out])

Tests each element x_i of the input array x to determine if it is a NaN.

less(x1, x2[, out])

Computes the truth value of x1_i < x2_i for each element x1_i of the input array x1 with the respective element x2_i of the input array x2.

less_equal(x1, x2[, out])

Computes the truth value of x1_i <= x2_i for each element x1_i of the input array x1 with the respective element x2_i of the input array x2.

linspace(impl, start, stop, num[, dtype, ...])

Returns evenly spaced numbers over a specified interval.

log(x1[, out])

Calculates an implementation-dependent approximation to the natural logarithm for each element x_i of the input array x.

log10(x1[, out])

Calculates an implementation-dependent approximation to the base ten logarithm for each element x_i of the input array x.

log1p(x1[, out])

Calculates an implementation-dependent approximation to ln(1 + x_i) for each element x_i of the input array x.

log2(x1[, out])

Calculates an implementation-dependent approximation to the base two logarithm for each element x_i of the input array x.

logaddexp(x1, x2[, out])

Calculates the logarithm of the sum of exponentiations log(exp(x1) + exp(x2)) for each element x1_i of the input array x1 with the respective element x2_i of the input array x2.

logical_and(x1, x2[, out])

Computes the logical AND for each element x1_i of the input array x1 with the respective element x2_i of the input array x2.

logical_not(x1[, out])

Computes the logical NOT for each element x_i of the input array x.

logical_or(x1, x2[, out])

Computes the logical OR for each element x1_i of the input array x1 with the respective element x2_i of the input array x2.

logical_xor(x1, x2[, out])

Computes the logical XOR for each element x1_i of the input array x1 with the respective element x2_i of the input array x2.

lookup_array_backend(impl)

Convenience function for getting an ArrayBackend from an impl argument.

matrix_representation(op)

Return a matrix representation of a linear operator.

max(x[, axis, keepdims])

Calculates the maximum value of the input array x.

maximum(x1, x2[, out])

Computes the maximum value for each element x1_i of the input array x1 relative to the respective element x2_i of the input array x2.

mean(x[, axis, keepdims])

Calculates the arithmetic mean of the input array x.

meshgrid(impl, *arrays[, indexing])

Returns coordinate matrices from coordinate vectors.

min(x[, axis, keepdims])

Calculates the minimum value of the input array x.

minimum(x1, x2[, out])

Calculates an implementation-dependent approximation of the principal value of the inverse cosine for each element.

multiply(x1, x2[, out])

Calculates the product for each element x1_i of the input array x1 with the respective element x2_i of the input array x2.

negative(x1[, out])

Numerically negates each element x_i of the input array x.

nextafter(x1, x2[, out])

Returns the next representable floating-point value for each element x1_i of the input array x1 in the direction of the respective element x2_i of the input array x2.

nonuniform_partition(*coord_vecs, **kwargs)

Return a partition with un-equally sized cells.

not_equal(x1, x2[, out])

Computes the truth value of x1_i != x2_i for each element x1_i of the input array x1 with the respective element x2_i of the input array x2.

odl_all_equal(x, y)

Test whether all array elements along a given axis evaluate to True.

ones(impl, shape[, dtype, device])

Returns a new array having a specified shape and filled with ones.

ones_like(x[, dtype, device])

Returns a new array filled with ones and having the same shape as an input array x.

positive(x1[, out])

Numerically positive each element x_i of the input array x.

pow(x1, x2[, out])

Calculates an implementation-dependent approximation of x1_i raised to the power of x2_i for each element x1_i of the input array x1, where x2_i is the corresponding element in the input array x2.

power_method_opnorm(op[, xstart, maxiter, ...])

Estimate the operator norm with the power method.

prod(x[, axis, dtype, keepdims])

Calculates the product of input array x elements.

real(x1[, out])

Returns the real part of each element x_i of the input array x.

reciprocal(x1[, out])

Returns the reciprocal for each element x_i of the input array x.

remainder(x1, x2[, out])

Calculates the remainder of dividing each element x1_i of the input array x1 by the respective element x2_i of the input array x2.

rn(shape[, dtype, impl, device])

Return a space of real tensors.

round(x1[, out])

Rounds each element x_i of the input array x to the nearest integer.

sign(x1[, out])

Returns an indication of the sign of each element x_i of the input array x.

signbit(x1[, out])

Determines whether the sign bit is set for each element x_i of the input array x

sin(x1[, out])

Calculates an implementation-dependent approximation to the sine for each element x_i of the input array x.

sinh(x1[, out])

Calculates an implementation-dependent approximation to the hyperbolic sine for each element x_i in the input array x.

space_weighting(impl[, device])

Notes:

sparse_meshgrid(*x)

Make a sparse meshgrid by adding empty dimensions.

sqrt(x1[, out])

Calculates the square root for each element x_i of the input array x.

square(x1[, out])

Calculates the square of each element x_i (i.e., x_i * x_i) of the input array x

std(x[, axis, correction, keepdims])

Calculates the standard deviation of the input array x.

subtract(x1, x2[, out])

Calculates the difference for each element x1_i of the input array x1 with the respective element x2_i of the input array x2.

sum(x[, axis, dtype, keepdims])

Calculates the sum of the input array x.

tan(x1[, out])

Calculates an implementation-dependent approximation to the tangent for each element x_i of the input array x.

tanh(x1[, out])

Calculates an implementation-dependent approximation to the hyperbolic tangent for each element x_i in the input array x.

tensor_space(shape[, dtype, impl, device])

Return a tensor space with arbitrary scalar data type.

tril(x[, k])

Returns the lower triangular part of a matrix (or a stack of matrices) x.

triu(x[, k])

Returns the upper triangular part of a matrix (or a stack of matrices) x.

trunc(x1[, out])

Rounds each element x_i of the input array x to the nearest integer towards zero.

uniform_discr(min_pt, max_pt, shape[, ...])

Return a uniformly discretized L^p function space.

uniform_discr_fromdiscr(discr[, min_pt, ...])

Return a discretization based on an existing one.

uniform_discr_fromintv(intv_prod, shape[, ...])

Return a uniformly discretized L^p function space.

uniform_discr_frompartition(partition[, ...])

Return a uniformly discretized L^p function space.

uniform_grid(min_pt, max_pt, shape[, ...])

Return a grid from sampling an implicit interval product uniformly.

uniform_grid_fromintv(intv_prod, shape[, ...])

Return a grid from sampling an interval product uniformly.

uniform_partition([min_pt, max_pt, shape, ...])

Return a partition with equally sized cells.

uniform_partition_fromgrid(grid[, min_pt, ...])

Return a partition of an interval product based on a given grid.

uniform_partition_fromintv(intv_prod, shape)

Return a partition of an interval product into equally sized cells.

var(x[, axis, correction, keepdims])

Calculates the variance of the input array x.

vector(array[, dtype, impl, device])

Create a vector from an array-like object.

zeros(impl, shape[, dtype, device])

Returns a new array having a specified shape and filled with zeros.

zeros_like(x[, dtype, device])

Returns a new array filled with zeros and having the same shape as an input array x.