Laplacian

class odl.Laplacian(*args, **kwargs)

Bases: PointwiseTensorFieldOperator

Spatial Laplacian operator for DiscretizedSpace spaces.

Calls helper function finite_diff to calculate each component of the resulting product space vector.

Outside the domain zero padding is assumed.

__init__(domain, range=None, pad_mode='constant', pad_const=0)[source]

Initialize a new instance.

Parameters

domainDiscretizedSpace

Space of elements which the operator is acting on.

pad_modestring, optional

The padding mode to use outside the domain.

'constant': Fill with pad_const.

'symmetric': Reflect at the boundaries, not doubling the outmost values.

'periodic': Fill in values from the other side, keeping the order.

'order0': Extend constantly with the outmost values (ensures continuity).

'order1': Extend with constant slope (ensures continuity of the first derivative). This requires at least 2 values along each axis.

'order2': Extend with second order accuracy (ensures continuity of the second derivative). This requires at least 3 values along each axis where padding is applied.

pad_constfloat, optional

For pad_mode == 'constant', f assumes pad_const for indices outside the domain of f

Examples

>>> data = np.array([[ 0., 0., 0.],
...                  [ 0., 1., 0.],
...                  [ 0., 0., 0.]])
>>> space = odl.uniform_discr([0, 0], [3, 3], [3, 3])
>>> f = space.element(data)
>>> lap = Laplacian(space)
>>> lap(f)
uniform_discr([ 0.,  0.], [ 3.,  3.], (3, 3)).element(
    [[ 0.,  1.,  0.],
     [ 1., -4.,  1.],
     [ 0.,  1.,  0.]]
)