FlatteningOperator

class odl.operator.tensor_ops.FlatteningOperator(*args, **kwargs)[source]

Bases: odl.operator.operator.Operator

Operator that reshapes the object as a column vector.

The operation performed by this operator is

FlatteningOperator(x) == ravel(x)

The range of this operator is always a TensorSpace, i.e., even if the domain is a discrete function space.

Attributes
adjoint

Adjoint of the flattening, a scaled version of the inverse.

domain

Set of objects on which this operator can be evaluated.

inverse

Operator that reshapes to original shape.

is_functional

True if this operator’s range is a Field.

is_linear

True if this operator is linear.

order

order of the flattening operation.

range

Set in which the result of an evaluation of this operator lies.

Methods

_call(self, x)

Flatten x.

derivative(self, point)

Return the operator derivative at point.

norm(self[, estimate])

Return the operator norm of this operator.

__init__(self, domain, order='C')[source]

Initialize a new instance.

Parameters
domainTensorSpace

Set of elements on which this operator acts.

order{‘C’, ‘F’}, optional

If provided, flattening is performed in this order. 'C' means that that the last index is changing fastest, while in 'F' ordering, the first index changes fastest.

Examples

>>> space = odl.uniform_discr([-1, -1], [1, 1], shape=(2, 3))
>>> op = odl.FlatteningOperator(space)
>>> op.range
rn(6)
>>> x = space.element([[1, 2, 3],
...                    [4, 5, 6]])
>>> op(x)
rn(6).element([ 1.,  2.,  3.,  4.,  5.,  6.])
>>> op = odl.FlatteningOperator(space, order='F')
>>> op(x)
rn(6).element([ 1.,  4.,  2.,  5.,  3.,  6.])