pylops.Pad¶
-
class
pylops.
Pad
(dims, pad, dtype='float64')[source]¶ Pad operator.
Zero-pad model in forward model and extract non-zero subsequence in adjoint. Padding can be performed in one or multiple directions to any multi-dimensional input arrays.
Parameters: - dims :
int
ortuple
Number of samples for each dimension
- pad :
tuple
Number of samples to pad. If
dims
is a scalar,pad
is a single tuple(pad_in, pad_end)
. Ifdims
is a tuple,pad
is a tuple of tuples where each inner tuple contains the number of samples to pad in each dimension- dtype :
str
, optional Type of elements in input array.
Raises: - ValueError
If any element of
pad
is negative.
Notes
Given an array of size \(N\), the Pad operator simply adds \(\text{pad}_\text{in}\) at the start and \(\text{pad}_\text{end}\) at the end in forward mode:
\[y_{i} = x_{i-\text{pad}_\text{in}} \quad \forall i=\text{pad}_\text{in},\ldots,\text{pad}_\text{in}+N-1\]and \(y_i = 0 \quad \forall i=0,\ldots,\text{pad}_\text{in}-1, \text{pad}_\text{in}+N-1,\ldots,N+\text{pad}_\text{in}+\text{pad}_\text{end}\)
In adjoint mode, values from \(\text{pad}_\text{in}\) to \(N-\text{pad}_\text{end}\) are extracted from the data:
\[x_{i} = y_{\text{pad}_\text{in}+i} \quad \forall i=0, N-1\]Attributes: Methods
__init__
(dims, pad[, dtype])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)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
()Transpose this linear operator. - dims :