Gradient Operators¶
-
pyunlocbox.operators.
grad
(x, dim=2, **kwargs)[source]¶ Returns the gradient of the array
Parameters: dim : int
Dimension of the grad
wx : int
wy : int
wz : int
wt : int
Weights to apply on each axis
Returns: dx, dy, dz, dt : ndarrays
Gradients following each axes, only the necessary ones are returned
Examples
>>> import pyunlocbox >>> import numpy as np >>> x = np.arange(16).reshape(4, 4) >>> dx, dy = pyunlocbox.operators.grad(x)
Divergence Operators¶
-
pyunlocbox.operators.
div
(*args, **kwargs)[source]¶ Returns the divergence of the array
Parameters: dx : array_like
dy : array_like
dz : array_like
dt : array_like
Arrays to operate on
Returns: x : array_like
Divergence vector
Examples
>>> import pyunlocbox >>> import numpy as np >>> x = np.arange(16).reshape(4, 4) >>> dx, dy = pyunlocbox.operators.grad(x) >>> divx = pyunlocbox.operators.div(dx, dy)