Builtin Operators¶
Devito provides a number of convenience Operators that can be imported and run in user code to facilitate development. These are exposed as free functions.
All builtin Operators support MPI.
Builtin Operators provided by Devito.

devito.builtins.
assign
(f, v=0)[source]¶ Assign a value to a Function.
 Parameters
f (Function) – The lefthand side of the assignment.
v (scalar, optional) – The righthand side of the assignment.

devito.builtins.
smooth
(f, g, axis=None)[source]¶ Smooth a Function through simple moving average.
 Parameters
f (Function) – The lefthand side of the smoothing kernel, that is the smoothed Function.
g (Function) – The righthand side of the smoothing kernel, that is the Function being smoothed.
axis (Dimension or list of Dimensions, optional) – The Dimension along which the smoothing operation is performed. Defaults to
f
’s innermost Dimension.
Notes
More info about simple moving average available at:
https://en.wikipedia.org/wiki/Moving_average#Simple_moving_average

devito.builtins.
norm
(f, order=2)[source]¶ Compute the norm of a Function.
 Parameters
f (Function) – Input Function.
order (int, optional) – The order of the norm. Defaults to 2.

devito.builtins.
sumall
(f)[source]¶ Compute the sum of all Function data.
 Parameters
f (Function) – Input Function.

devito.builtins.
inner
(f, g)[source]¶ Inner product of two Functions.
 Parameters
 Raises
ValueError – If the two input Functions are defined over different grids, or have different dimensionality, or their dimensionwise sizes don’t match. If in input are two SparseFunctions and their coordinates don’t match, the exception is raised.
Notes
The inner product is the sum of all dimensionwise products. For 1D Functions, the inner product corresponds to the dot product.