pylops_mpi.basicoperators.MPILaplacian#
- class pylops_mpi.basicoperators.MPILaplacian(dims, axes=(-2, -1), weights=(1, 1), sampling=(1, 1), edge=False, kind='centered', base_comm=<mpi4py.MPI.Intracomm object>, dtype=<class 'numpy.float64'>)[source]#
MPI Laplacian
Apply second-order centered Laplacian operator to a multi-dimensional distributed array.
Note
At least 2 dimensions are required, use
pylops_mpi.basicoperators.MPISecondDerivative
for one dimension.- Parameters:
- dims
tuple
Number of samples for each dimension.
- axes
int
, optional Axes along which the Laplacian is applied.
- weights
tuple
, optional Weight to apply to each direction (real laplacian operator if
weights=(1, 1)
)- sampling
tuple
, optional Sampling steps for each direction
- edge
bool
, optional Use reduced order derivative at edges (
True
) or ignore them (False
) for centered derivative- kind
str
, optional Derivative kind (
forward
,centered
, orbackward
)- base_comm
mpi4py.MPI.Comm
, optional MPI Base Communicator. Defaults to
mpi4py.MPI.COMM_WORLD
.- dtype
str
, optional Type of elements in input array.
- dims
- Raises:
- ValueError
If
axes
.weights
, andsampling
do not have the same size.
Notes
The MPILaplacian operator applies a second derivative along multiple directions of a multi-dimensional distributed array.
We utilize the
pylops_mpi.basicoperators.MPISecondDerivative
to calculate the second derivative along the first direction(i.e., axis=0). For other values of axis, thepylops.SecondDerivative
operator is pushed into thepylops_mpi.basicoperators.MPIBlockDiag
operator. Subsequently, the matrix-vector product is performed between the SecondDerivative operator and the distributed data.For simplicity, given a two-dimensional array, the Laplacian is:
\[y[i, j] = (x[i+1, j] + x[i-1, j] + x[i, j-1] +x[i, j+1] - 4x[i, j]) / (\Delta x \Delta y)\]Methods
__init__
(dims[, axes, weights, sampling, ...])adjoint
()Adjoint MPI LinearOperator
conj
()Complex conjugate operator
dot
(x)Matrix Vector Multiplication
matvec
(x)Matrix-vector multiplication.
rmatvec
(x)Adjoint Matrix-vector multiplication.
transpose
()Transposition of MPI LinearOperator