def inverse(self):
        """Operator that reshapes to original shape.

        Examples
        --------
        >>> space = odl.uniform_discr([-1, -1], [1, 1], shape=(2, 4))
        >>> op = odl.FlatteningOperator(space)
        >>> y = op.range.element([1, 2, 3, 4, 5, 6, 7, 8])
        >>> op.inverse(y)
        uniform_discr([-1., -1.], [ 1.,  1.], (2, 4)).element(
            [[ 1.,  2.,  3.,  4.],
             [ 5.,  6.,  7.,  8.]]
        )
        >>> op = odl.FlatteningOperator(space, order='F')
        >>> op.inverse(y)
        uniform_discr([-1., -1.], [ 1.,  1.], (2, 4)).element(
            [[ 1.,  3.,  5.,  7.],
             [ 2.,  4.,  6.,  8.]]
        )
        >>> op(op.inverse(y)) == y
        True
        """
        op = self
        scaling = getattr(self.domain, 'cell_volume', 1.0)

        class FlatteningOperatorInverse(Operator):

            """Inverse of `FlatteningOperator`.

            This operator reshapes a flat vector back to original shape::

                FlatteningOperatorInverse(x) == reshape(x, orig_shape)
            """

            def __init__(self):
                """Initialize a new instance."""
                super(FlatteningOperatorInverse, self).__init__(
                    op.range, op.domain, linear=True)

            def _call(self, x):
                """Reshape ``x`` back to n-dim. shape."""
                return np.reshape(x.asarray(), self.range.shape,
                                  order=op.order)

            def adjoint(self):
                """Adjoint of this operator, a scaled `FlatteningOperator`."""
                return scaling * op

            def inverse(self):
                """Inverse of this operator."""
                return op

            def __repr__(self):
                """Return ``repr(self)``."""
                return '{!r}.inverse'.format(op)

            def __str__(self):
                """Return ``str(self)``."""
                return repr(self)

        return FlatteningOperatorInverse()
def inverse ( self ) : op = self scaling = getattr ( self . domain , 'cell_volume' , 1.0 ) class FlatteningOperatorInverse ( Operator ) : def __init__ ( self ) : super ( FlatteningOperatorInverse , self ) . __init__ ( op . range , op . domain , linear = True ) def _call ( self , x ) : return np . reshape ( x . asarray ( ) , self . range . shape , order = op . order ) def adjoint ( self ) : return scaling * op def inverse ( self ) : return op def __repr__ ( self ) : return '{!r}.inverse' . format ( op ) def __str__ ( self ) : return repr ( self ) return FlatteningOperatorInverse ( )
Operator that reshapes to original shape.

        Examples
        --------
        >>> space = odl.uniform_discr([-1, -1], [1, 1], shape=(2, 4))
        >>> op = odl.FlatteningOperator(space)
        >>> y = op.range.element([1, 2, 3, 4, 5, 6, 7, 8])
        >>> op.inverse(y)
        uniform_discr([-1., -1.], [ 1.,  1.], (2, 4)).element(
            [[ 1.,  2.,  3.,  4.],
             [ 5.,  6.,  7.,  8.]]
        )
        >>> op = odl.FlatteningOperator(space, order='F')
        >>> op.inverse(y)
        uniform_discr([-1., -1.], [ 1.,  1.], (2, 4)).element(
            [[ 1.,  3.,  5.,  7.],
             [ 2.,  4.,  6.,  8.]]
        )
        >>> op(op.inverse(y)) == y
        True