pylops.LinearOperator#
- class pylops.LinearOperator(Op=None, dtype=None, shape=None, dims=None, dimsd=None, clinear=None, explicit=None, forceflat=None, name=None)[source]#
Common interface for performing matrix-vector products.
This class acts as an abstract interface between matrix-like objects and iterative solvers, providing methods to perform matrix-vector and adjoint matrix-vector products as as well as convenience methods such as
eigs
,cond
, andconj
.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 developed within PyLops. Find more details regarding implementation of new operators at Implementing new operators.
- Parameters
- Op
scipy.sparse.linalg.LinearOperator
orpylops.linearoperator.LinearOperator
Operator. If other arguments are provided, they will overwrite those obtained from
Op
.- dtype
str
, optional Type of elements in input array.
- shape
tuple(int, int)
, optional Shape of operator. If not provided, obtained from
dims
anddimsd
.- dims
tuple(int, ..., int)
, optional New in version 2.0.0.
Dimensions of model. If not provided,
(self.shape[1],)
is used.- dimsd
tuple(int, ..., int)
, optional New in version 2.0.0.
Dimensions of data. If not provided,
(self.shape[0],)
is used.- clinear
bool
, optional New in version 1.17.0.
Operator is complex-linear. Defaults to
True
.- explicit
bool
, optional Operator contains a matrix that can be solved explicitly (
True
) or not (False
). Defaults toFalse
.- forceflat
bool
, optional New in version 2.2.0.
Force an array to be flattened after matvec/rmatvec if the input is ambiguous (i.e., is a 1D array both when operating with ND arrays and with 1D arrays). Defaults to
None
for operators that have no ambiguity or toTrue
for those with ambiguity.- name
str
, optional New in version 2.0.0.
Name of operator (to be used by
pylops.utils.describe.describe
)
- Op
Methods
__init__
([Op, dtype, shape, dims, dimsd, ...])adjoint
()apply_columns
(cols)Apply subset of columns of operator
cond
([uselobpcg])Condition number of linear operator.
conj
()Complex conjugate operator
div
(y[, niter, densesolver])Solve the linear problem \(\mathbf{y}=\mathbf{A}\mathbf{x}\).
dot
(x)Matrix-matrix or matrix-vector multiplication.
eigs
([neigs, symmetric, niter, uselobpcg])Most significant eigenvalues of linear operator.
matmat
(X)Matrix-matrix multiplication.
matvec
(x)Matrix-vector multiplication.
reset_count
()Reset counters
rmatmat
(X)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.LinearOperator
#
Acoustic Wave Equation modelling
Dual-Tree Complex Wavelet Transform
Non-stationary Filter Estimation
Normal Moveout (NMO) Correction
Operators with Multiprocessing
Total Variation (TV) Regularization
19. Image Domain Least-squares migration