Linear Operators¶
We provide a collection of linear operators with efficient JAX based implementations that are relevant in standard signal/image processing problems. We also provide a bunch of utilities to combine and convert linear operators.
This module is inspired by pylops
although the implementation approach
is different.
A linear operator \(T : X \to Y\) connects a model space \(X\) to a data space \(Y\).
A linear operator satisfies following laws:
Thus, for a general linear combination:
We are concerned with linear operators \(T : \mathbb{F}^n \to \mathbb{F}^m\) where \(\mathbb{F}\) is either the field of real numbers or complex numbers. \(X = \mathbb{F}^n\) is the model space and \(Y = \mathbb{F}^m\) is the data space.
Such a linear operator can be represented by a two dimensional matrix \(A\).
The forward operation is given by:
The corresponding adjoint operation is given by:
We represent a linear operator by a pair of functions times
and trans
.
The times
function implements the forward operation while the trans
function implements the adjoint operation.
An inverse problem consists of computing \(x\) given \(y\) and \(A\).
1D, 2D, ND operators
A 1D operator takes a 1D array as input and returns a 1D array as output. E.g. identity, pad, etc.
A 2D operator takes a 2D array as input and returns a 2D array as output. E.g. conv2D, dwt2D, etc.
An ND operator takes an ND array as input and returns an ND array as output.
The vectors may be stored using multi-dimensional arrays in memory. E.g., images are usually stored in 2-3 dimensional arrays. The operators themselves may work directly on multi-dimensions arrays. E.g. a 2D convolution operator can be applied directly to an image to result in another image.
In other words, the vectors from the model space as well as data space may be stored in memory using 1D,2D,…,ND array. They should still be treated as vectors for the purposes of this module.
This is a departure from pylops convention where input to a linear operator must be flattened into a 1D array and output needs to be reshaped again. In this library, the input and output to a 2D linear operator would be a 2D array.
axis parameter in a 1D linear operator
A 1D linear operator may get an ND array as input.
In this case, the axis parameter to the operator specifies the axis along which the linear operator is to be applied.
The input ND array will be broken into slices of 1D arrays along the axis and the linear operator will be applied separately to each slice.
Then the slices will be combined to generate the output ND array.
E.g. if the input is a matrix then:
axis=0 means apply the linear operator over each column (along axis=0)
axis=1 means apply the linear operator over each row (along axis=1)
This is based on the convention followed by numpy.apply_along_axis
.
Data types¶
Represents a finite linear operator \(T : A -> B\) where \(A\) and \(B\) are finite vector spaces. |
Basic operators¶
|
Returns an identity linear operator from model space to data space |
|
Converts a matrix into a linear operator |
|
Converts a real matrix into a linear operator |
|
Converts a sparse real matrix into a linear operator |
|
Returns a linear operator T such that \(T v = \alpha v\) |
|
Returns a linear operator which mimics multiplication by a diagonal matrix |
|
Returns a linear operator which maps everything to 0 vector in data space |
|
Returns an operator which flips the order of entries in input upside down |
|
Returns an operator which computes the sum of a vector |
|
Returns a linear operator T such that \(T x = \langle v , x \rangle = v^H x\) |
|
Adds zeros before and after a vector. |
|
An operator which constructs a symmetric vector by pre-pending the input in reversed order |
|
An operator which computes y = x[I] over an index set I |
|
Returns a linear operator which reshapes vectors from model space to data space |
|
Returns a linear operator which reshapes arrays to vectors |
|
Returns a linear operator implements the Heaviside step function |
|
Returns a linear operator that computes the inverse of Heaviside/cumsum on input |
Operator calculus¶
It is possible to combine one or more linear operators to create new linear operators. The functions in this section provide different ways to combine linear operators.
|
Returns the negative of a linear operator \(T = -A\) |
|
Returns the linear operator \(T = \alpha A\) for the operator \(A\) |
|
Returns the sum of two linear operators \(T = A + B\) |
|
Returns a linear operator \(T = A - B\) |
|
Returns the composite linear operator \(T = AB\) such that \(T(x)= A(B(x))\) |
|
Returns the transpose of a given operator \(T = A^T\) |
|
Returns the adjoint of a given operator \(T = A^H\) |
|
Returns the linear operator \(T = [A \, B]\) |
|
Returns the linear operator \(T = A^p\) |
|
Returns a block diagonal operator from 2 or more operators |
|
A wrapper to convert an operator into an overcomplete windowed operator |
Signal processing operators¶
|
Computes a running average of entries in x |
|
Implements an FIR filter defined by coeffs |
|
Implements a convolution operator with the filter h |
|
Performs 2 dimensional convolution on the input array |
|
Performs N dimensional convolution on input array |
Orthonormal transforms and bases¶
|
1D FFT operator |
|
Returns a 1D Discrete Wavelet Transform operator |
|
Returns a 2D Discrete Wavelet Transform operator |
Returns an operator which represents the DFT orthonormal basis |
|
|
Returns an operator which represents the DCT-II orthonormal basis |
Returns an operator which represents the Walsh Hadamard Transform Basis |
Unions of bases¶
Returns an operator for a two-ortho basis dictionary consisting of Dirac basis and Fourier basis |
Random compressive sensing operators¶
|
An operator which represents a Gaussian sensix matrix (with normalized columns) |
|
An operator which represents a Rademacher sensing matrix |
|
An operator representing a random orthonormal basis |
|
An operator whose rows are orthonormal (sampled from a random orthonormal basis) |
|
An operator which represents a sparse binary sensing matrix |
Operators for special matrices¶
|
Circulant matrix operator |
Derivatives (finite differences)¶
|
Computes the first derivative |
|
|
|
Returns a total variation linear operator for 1D signals |
|
Returns a total variation linear operator for 2D images |
Convenience operators¶
These operators are technically not linear on \(\mathbb{F}^n \to \mathbb{F}^m\)
|
Returns the real parts of a vector of complex numbers |
Operator parts¶
|
Returns the i-th column of the operator T |
|
Returns the i-th column of the operator T |
Properties of a linear operator¶
These are still experimental and not efficient.
|
Estimates the norm of a linear operator by power method |
|
Estimates the norm of a linear operator by power method |
Computes the upper frame bound for a linear operator using full SVD |
Utilities¶
|
Returns the same linear operator with compiled times and trans functions |
|
Converts a linear operator to a matrix |
Converts the adjoint of a linear operator to a matrix |
|
Converts a linear operator to a matrix in complex numbers |