pylops_mpi.basicoperators.MPIHStack#
- class pylops_mpi.basicoperators.MPIHStack(ops, base_comm=<mpi4py.MPI.Intracomm object>, dtype=None)[source]#
MPI HStack Operator
Create a horizontal stack of a set of linear operators using MPI. Each rank must initialize this operator by providing one or more linear operators which will be computed within each rank. Both model and data vectors are of
pylops_mpi.DistributedArraytype.- Parameters:
- ops
list One or more
pylops.LinearOperatorto be horizontally stacked.- base_comm
mpi4py.MPI.Comm, optional Base MPI Communicator. Defaults to
mpi4py.MPI.COMM_WORLD.- dtype
str, optional Type of elements in input array.
- ops
- Attributes:
- shape
tuple Operator shape
- shape
- Raises:
- ValueError
If
opshave different number of rows
Notes
An MPIHStack is composed of N linear operators stacked horizontally, represented by L. Each rank has one or more
pylops.LinearOperator, which we represent here compactly as \(\mathbf{L}_i\) for rank \(i\).Each operator performs forward mode operations using its corresponding model vector, denoted as m. This vector is effectively a
pylops_mpi.DistributedArray, with partition set topylops_mpi.Partition.SCATTERi.e. unique portions assigned to each rank.Afterwards, a collective reduction operation is performed where matrix-vector product values from linear operators are summed up, and broadcasted to all ranks in the communicator, represented by d.
\[\begin{split}d = \begin{bmatrix} \mathbf{L}_1 & \mathbf{L}_2 & \ldots & \mathbf{L}_n \end{bmatrix} \begin{bmatrix} \mathbf{m}_1 \\ \mathbf{m}_2 \\ \vdots \\ \mathbf{m}_n \end{bmatrix}\end{split}\]For the adjoint mode, each operator performs adjoint matrix-vector product using its corresponding model vector, denoted by m which is a
pylops_mpi.DistributedArraywith partition set topylops_mpi.Partition.BROADCASTi.e. array is broadcasted to all ranks.Afterwards, the result of the adjoint matrix-vector product is stored in a
pylops_mpi.DistributedArray, which is represented by the variable d.\[\begin{split}\begin{bmatrix} \mathbf{d}_1 \\ \mathbf{d}_2 \\ \vdots \\ \mathbf{d}_n \end{bmatrix} = \begin{bmatrix} \mathbf{L}_1^H \\ \mathbf{L}_2^H \\ \vdots \\ \mathbf{L}_n^H \end{bmatrix} m\end{split}\]Methods
__init__(ops[, base_comm, dtype])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