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 or tuple

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). If dims 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 \(pad_{in}\) at the start and \(pad_{end}\) at the end in forward mode:

\[y_{i} = x_{i-pad_{in}} \quad \forall i=pad_{in},pad_{in}+1,...,pad_{in}+N-1\]

and \(y_i = 0 \quad \forall i=0,...,pad_{in}-1, pad_{in}+N-1,...,N+pad_{in}+pad_{end}\)

In adjoint mode, values from \(pad_{in}\) to \(N-pad_{end}\) are extracted from the data:

\[x_{i} = y_{pad_{in}+i} \quad \forall i=0, N-1\]
Attributes:
shape : tuple

Operator shape

explicit : bool

Operator contains a matrix that can be solved explicitly (True) or not (False)

Methods

__init__(self, dims, pad[, dtype]) Initialize this LinearOperator.
adjoint(self) Hermitian adjoint.
apply_columns(self, cols) Apply subset of columns of operator
cond(self, \*\*kwargs_eig) Condition number of linear operator.
conj(self) Complex conjugate operator
div(self, y[, niter]) Solve the linear problem \(\mathbf{y}=\mathbf{A}\mathbf{x}\).
dot(self, x) Matrix-matrix or matrix-vector multiplication.
eigs(self[, neigs, symmetric, niter]) Most significant eigenvalues of linear operator.
matmat(self, X) Matrix-matrix multiplication.
matvec(self, x) Matrix-vector multiplication.
rmatmat(self, X) Adjoint matrix-matrix multiplication.
rmatvec(self, x) Adjoint matrix-vector multiplication.
todense(self) Return dense matrix.
transpose(self) Transpose this linear operator.

Examples using pylops.Pad