pylops.MultiOperator¶
- class pylops.MultiOperator(Op=None, dtype=None, shape=None, dims=None, dimsd=None, clinear=None, explicit=None, forceflat=None, name=None)[source]¶
Multiprocess/threading operator
This class acts as a base class for all operators that wish to support multiprocessing/multithreading in their
matvec/rmatvecmethods.Implements basic methods to instantiate and tear down a pool of workers and
_matvec/_rmatvecinterfaces that dispatch to the actual implementations for serial/multiprocess/multithread, namely:_matvec_serial/_rmatvec_serial: serial implementation;_matvec_multiproc/_rmatvec_multiproc: multiprocess implementation;_matvec_multithread/_rmatvec_multithread: multithreading implementation.
Developers are in charge of implementing these methods for specific operators or overwriting
_matvec/_rmatvecif not all of the implementations are available. Moreover, derived classes must call_setup_poolin their constructor (beforesuper().__init__), as this method defines thenproc,parallel_kindandpoolattributes used by all other methods.Note that
nproccan be changed after construction: this will stop the current worker pool and restart a new one. The chosenparallel_kindis retained when changingnproc. On the other hand,parallel_kindcannot be changed after construction.Note
End users of PyLops should not use this class directly but simply use operators that are already implemented. This class is meant for developers and it has to be used as the parent class of any new operator with multiprocess/multithreading capabilities developed within PyLops.
Methods
__init__([Op, dtype, shape, dims, dimsd, ...])adjoint()apply_columns(cols)Apply subset of columns of operator
close()Close the pool of workers used for multiprocessing / multithreading.
cond([uselobpcg, backend])Condition number of linear operator.
conj()Complex conjugate operator
div(y[, niter, densesolver])Solve the linear problem or divide by a scalar
dot(x)Dot-product
eigs([neigs, symmetric, niter, uselobpcg, ...])N-most significant eigenvalues of a linear operator.
matmat(X[, pool])Matrix-matrix multiplication.
matvec(x)Matrix-vector multiplication.
reset_count()Reset counters
rmatmat(X[, pool])Matrix-matrix multiplication.
rmatvec(x)Adjoint matrix-vector multiplication.
todense([backend])Return dense matrix.
toimag([forw, adj])Imag operator
toreal([forw, adj])Real operator
tosparse()Return sparse matrix.
trace([neval, method, backend])Trace of linear operator.
transpose()
Examples using pylops.MultiOperator¶
PWD-based slope estimation and structural smoothing