Skip to content

Commit 53d8721

Browse files
committed
add documentation
1 parent 8324599 commit 53d8721

File tree

1 file changed

+65
-1
lines changed

1 file changed

+65
-1
lines changed

README.md

Lines changed: 65 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,68 @@ Pkg.add("LinearOperatorCollection")
2020
```
2121

2222
## Usage
23-
...
23+
After loading the package one can construct an operator `Op` using the generic syntax
24+
```julia
25+
op = Op(T; kargs...)
26+
```
27+
Here, `T` is the element type of the operator that usually should match the element type that
28+
the operator will later operate on. The keyword arguments are operator specific but there are
29+
some common parameters. For instance, most operators have a `shape` parameter, which encodes
30+
the size of the vector `x`, the operator is applied to
31+
32+
### Extensions
33+
To keep the load time of this package low, many operators are implemented using package extensions.
34+
For instance, in order to get the `FFTOp`, one needs to load not only `LinearOperatorCollection` but
35+
also `FFTW`:
36+
```julia
37+
using LinearOperatorCollection, FFTW
38+
```
39+
Small operators are implemented in LinearOperatorCollection directly.
40+
41+
### Example
42+
43+
The following shows how to build a two dimensional FFT operator and apply it to an image:
44+
```julia
45+
using LinearOperatorCollection, FFTW, LinearAlgebra
46+
47+
N = (64, 64)
48+
x = vec( rand(ComplexF64, N) ) # The image needs to be vectorized so that the operator can be applied
49+
50+
F = FFTOp(ComplexF64, shape=N, shift=true) # shift will apply fftshifts before and after the FFT
51+
52+
# apply operator
53+
y = F * x
54+
# apply the adjoint operator
55+
z = adjoint(F) * y
56+
57+
# apply the in place variants, which do not allocate memory during the computation
58+
mul!(y, F, x)
59+
mul!(z, adjoint(F), x)
60+
```
61+
62+
### Implemented operators
63+
64+
Currently the following operators are implemented:
65+
* `WeightingOp`: A diagonal weighting matrix
66+
* `SamplingOp`: An operator which (sub)-samples the input vector
67+
* `NormalOp`: An operator building the normal matrix `A' W A` in a lazy fashion
68+
* `GradientOp`: An operator calculating the gradient along one or several directions
69+
* `FFTOp`: An operator applying the fast Fourier transform
70+
* `DCTOp`: An operator applying the discrete cosine transform
71+
* `DSTOp`: An operator applying the discrete sine transform
72+
* `NFFTOp`: An operator applying the non-equidistant fast Fourier transform
73+
* `WaveletOp`: An operator applying the wavelet transformation
74+
75+
### Factory method
76+
77+
One can also create operators using a factory method that takes as input the abstract type. The above
78+
operator can be also created by
79+
```julia
80+
F = createLinearOperator(FFTOp{ComplexF64}, shape=N, shift=true)
81+
```
82+
This is useful in cases where the operator should be exchangeable. A list of all implemented
83+
can be obtained by calling
84+
```julia
85+
list = linearOperatorList()
86+
```
87+

0 commit comments

Comments
 (0)