This package contains a collection of linear operators that are in particular useful for multi-dimensional signal and image processing tasks. All operators are build using the LinearOperators.jl base type and derive from AbstractLinearOperator
. For example this package
provides operators for the FFT (Fast Fourier Transform) and its non-equidistant variant (NFFT), the DCT (Discrete Cosine Transform), and the Wavelet transform. This package, however, does not implement
these transformation itself but uses established libraries for them. So in fact, LinearOperatorCollection's main purpose is to add a wrapper around low-level libraries like
FFTW.jl and NFFT.jl, which allows to use the transformation as if they would be linear operators, i.e. implement Op * x
, adjoint(Op) * x
and the mul!
based in-place variants of the former.
Within Julia, use the package manager to install this package:
using Pkg
Pkg.add("LinearOperatorCollection")
After loading the package one can construct an operator Op
using the generic syntax
op = Op(T; kargs...)
Here, T
is the element type of the operator that usually should match the element type that
the operator will later operate on. The keyword arguments are operator specific but there are
some common parameters. For instance, most operators have a shape
parameter, which encodes
the size of the vector x
, the operator is applied to
To keep the load time of this package low, many operators are implemented using package extensions.
For instance, in order to get the FFTOp
, one needs to load not only LinearOperatorCollection
but
also FFTW
:
using LinearOperatorCollection, FFTW
Small operators are implemented in LinearOperatorCollection directly.
The following shows how to build a two dimensional FFT operator and apply it to an image:
using LinearOperatorCollection, FFTW, LinearAlgebra
N = (64, 64)
x = vec( rand(ComplexF64, N) ) # The image needs to be vectorized so that the operator can be applied
F = FFTOp(ComplexF64, shape=N, shift=true) # shift will apply fftshifts before and after the FFT
# apply operator
y = F * x
# apply the adjoint operator
z = adjoint(F) * y
# apply the in place variants, which do not allocate memory during the computation
mul!(y, F, x)
mul!(z, adjoint(F), x)
Currently the following operators are implemented:
WeightingOp
: A diagonal weighting matrixSamplingOp
: An operator which (sub)-samples the input vectorNormalOp
: An operator building the normal matrixA' W A
in a lazy fashionGradientOp
: An operator calculating the gradient along one or several directionsFFTOp
: An operator applying the fast Fourier transformDCTOp
: An operator applying the discrete cosine transformDSTOp
: An operator applying the discrete sine transformNFFTOp
: An operator applying the non-equidistant fast Fourier transformWaveletOp
: An operator applying the wavelet transformation
One can also create operators using a factory method that takes as input the abstract type. The above operator can be also created by
F = createLinearOperator(FFTOp{ComplexF64}, shape=N, shift=true)
This is useful in cases where the operator should be exchangeable. A list of all implemented can be obtained by calling
list = linearOperatorList()