Operators

The pyunlocbox.operators module implements the following operators:

grad(x[, dim])

Returns the gradient of an array.

div(*args, **kwargs)

Returns the divergence of an array.

pyunlocbox.operators.grad(x, dim=2, **kwargs)[source]

Returns the gradient of an array.

Parameters
dimint

Dimension of the grad

wxint
wyint
wzint
wtint

Weights to apply on each axis

Returns
dx, dy, dz, dtndarrays

Gradients following each axes, only the necessary ones are returned

Examples

>>> import numpy as np
>>> from pyunlocbox import operators
>>> x = np.arange(16).reshape(4, 4)
>>> dx, dy = operators.grad(x)
pyunlocbox.operators.div(*args, **kwargs)[source]

Returns the divergence of an array.

Parameters
dxarray_like
dyarray_like
dzarray_like
dtarray_like

Arrays to operate on

Returns
xarray_like

Divergence vector

Examples

>>> import numpy as np
>>> from pyunlocbox import operators
>>> x = np.arange(16).reshape(4, 4)
>>> dx, dy = operators.grad(x)
>>> divx = operators.div(dx, dy)