pylops.signalprocessing.Bilinear¶
- class pylops.signalprocessing.Bilinear(iava, dims, forceflat=None, dtype='float64', name='B')[source]¶
Bilinear interpolation operator.
Apply bilinear interpolation onto fractionary positions
iavaalong the first two axes of a n-dimensional array.Note
The vector
iavashould contain unique pais. If the same pair is repeated twice an error will be raised.- Parameters:
- iava
listornumpy.ndarray Array of size \([2 \times n_\text{ava}]\) containing pairs of floating indices of locations of available samples for interpolation.
- dims
list Number of samples for each dimension
- forceflat
bool, optional Added in version 2.2.0.
Force an array to be flattened after rmatvec. Note that this is only required when len(dims)=2, otherwise pylops will detect whether to return a 1d or nd array.
- dtype
str, optional Type of elements in input array.
- name
str, optional Added in version 2.0.0.
Name of operator (to be used by
pylops.utils.describe.describe)
- iava
- Attributes:
- iava_t
numpy.ndarray Indices of points above iava for bilinear interpolation.
- iava_b
numpy.ndarray Indices of points below iava for bilinear interpolation.
- iava_l
numpy.ndarray Indices of points left of iava for bilinear interpolation.
- iava_r
numpy.ndarray Indices of points right of iava for bilinear interpolation.
- weights_tb
numpy.ndarray Weights for top/bottom points for bilinear interpolation.
- weights_lr
numpy.ndarray Weights for left/right points for bilinear interpolation.
- dims
tuple Shape of the array after the adjoint, but before flattening.
For example,
x_reshaped = (Op.H * y.ravel()).reshape(Op.dims).- dimsd
tuple Shape of the array after the forward, but before flattening.
For example,
y_reshaped = (Op * x.ravel()).reshape(Op.dimsd).- shape
tuple Operator shape.
- iava_t
- Raises:
- ValueError
If the vector
iavacontains repeated values.
Notes
Bilinear interpolation of a subset of \(N\) values at locations
iavafrom an input n-dimensional vector \(\mathbf{x}\) of size \([m_1 \times m_2 \times ... \times m_{ndim}]\) can be expressed as:\[y_{\mathbf{i}} = (1-w^0_{i}) (1-w^1_{i}) x_{l^{l,0}_i, l^{l,1}_i} + w^0_{i} (1-w^1_{i}) x_{l^{r,0}_i, l^{l,1}_i} + (1-w^0_{i}) w^1_{i} x_{l^{l,0}_i, l^{r,1}_i} + w^0_{i} w^1_{i} x_{l^{r,0}_i, l^{r,1}_i} \quad \forall i=1,2,\ldots,M\]where \(\mathbf{l^{l,0}}=[\lfloor l_1^0 \rfloor, \lfloor l_2^0 \rfloor, ..., \lfloor l_N^0 \rfloor]\), \(\mathbf{l^{l,1}}=[\lfloor l_1^1 \rfloor, \lfloor l_2^1 \rfloor, ..., \lfloor l_N^1 \rfloor]\), \(\mathbf{l^{r,0}}=[\lfloor l_1^0 \rfloor + 1, \lfloor l_2^0 \rfloor + 1, ..., \lfloor l_N^0 \rfloor + 1]\), \(\mathbf{l^{r,1}}=[\lfloor l_1^1 \rfloor + 1, \lfloor l_2^1 \rfloor + 1, ..., \lfloor l_N^1 \rfloor + 1]\), are vectors containing the indices of the original array at which samples are taken, and \(\mathbf{w^j}=[l_1^i - \lfloor l_1^i \rfloor, l_2^i - \lfloor l_2^i \rfloor, ..., l_N^i - \lfloor l_N^i \rfloor]\) (\(\forall j=0,1\)) are the bilinear interpolation weights.
Methods
__init__(iava, dims[, forceflat, dtype, name])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()