pylops.FunctionOperator¶
-
class
pylops.
FunctionOperator
(f, *args, **kwargs)[source]¶ Function Operator.
Simple wrapper to functions for forward f and adjoint fc multiplication.
Functions \(f\) and \(fc\) are such that \(f:\mathbb{F}^m \to \mathbb{F}^n\) and \(fc:\mathbb{F}^n \to \mathbb{F}^m\) where \(\mathbb{F}\) is the appropriate underlying type (e.g., \(\mathbb{R}\) for real or \(\mathbb{C}\) for complex)
FunctionOperator can be called in the following ways:
FunctionOperator(f, n)
,FunctionOperator(f, n, m)
,FunctionOperator(f, fc, n)
, andFunctionOperator(f, fc, n, m)
.The first two methods can only be used for forward modelling and will return NotImplementedError if the adjoint is called. The first and third method assume the matrix (or matrices) to be square. All methods can be called with the dtype keyword argument.
Parameters: Examples
>>> from pylops.basicoperators import FunctionOperator >>> def forward(v): ... return np.array([2*v[0], 3*v[1]]) ... >>> A = FunctionOperator(forward, 2) >>> A <2x2 FunctionOperator with dtype=float64> >>> A.matvec(np.ones(2)) array([2., 3.]) >>> A @ np.ones(2) array([2., 3.])
Attributes: Methods
__init__
(f, *args, **kwargs)Initialize this LinearOperator. adjoint
()Hermitian adjoint. apply_columns
(cols)Apply subset of columns of operator cond
([uselobpcg])Condition number of linear operator. conj
()Complex conjugate operator div
(y[, niter])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. rmatmat
(X)Adjoint matrix-matrix multiplication. rmatvec
(x)Adjoint matrix-vector multiplication. todense
()Return dense matrix. tosparse
()Return sparse matrix. transpose
()Transpose this linear operator.