Skip to content

Commit 1bd34e3

Browse files
committed
Finish initial docs
1 parent b6214f5 commit 1bd34e3

File tree

26 files changed

+121
-238
lines changed

26 files changed

+121
-238
lines changed

docs/make.jl

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,36 +15,43 @@ for (root, dirs, files) in walkdir(INPUT_BASE)
1515
end
1616
end
1717

18+
modules = [LinearOperatorCollection,
19+
isdefined(Base, :get_extension) ? Base.get_extension(LinearOperatorCollection, :LinearOperatorFFTWExt) : LinearOperatorCollection.LinearOperatorFFTWExt,
20+
isdefined(Base, :get_extension) ? Base.get_extension(LinearOperatorCollection, :LinearOperatorNFFTExt) : LinearOperatorCollection.LinearOperatorNFFTExt,
21+
isdefined(Base, :get_extension) ? Base.get_extension(LinearOperatorCollection, :LinearOperatorRadonKAExt) : LinearOperatorCollection.LinearOperatorRadonKAExt,
22+
isdefined(Base, :get_extension) ? Base.get_extension(LinearOperatorCollection, :LinearOperatorWaveletExt) : LinearOperatorCollection.LinearOperatorWaveletExt]
23+
1824
makedocs(
1925
format = Documenter.HTML(prettyurls=get(ENV, "CI", "false") == "true",
2026
canonical="https://github.com/JuliaImageRecon/LinearOperatorCollection.jl",
2127
assets=String[],
2228
collapselevel=1,
2329
),
24-
modules = [LinearOperatorCollection],
30+
modules = modules,
2531
sitename = "LinearOperatorCollection",
2632
authors = "Tobias Knopp, Niklas Hackelberg and Contributors",
2733
pages = [
2834
"Home" => "index.md",
2935
"Getting Started" => "generated/tutorials/overview.md",
3036
"Tutorials" => Any[
3137
"Weighting Operator" => "generated/tutorials/weighting.md",
32-
"Product Operator" => "generated/tutorials/product.md",
38+
"FFT Operator" => "generated/tutorials/fft.md",
3339
"Diagonal Operator" => "generated/tutorials/diagonal.md",
3440
"Gradient Operator" => "generated/tutorials/gradient.md",
35-
"Normal Operator" => "generated/tutorials/normal.md",
36-
"FFT Operator" => "generated/tutorials/fft.md",
37-
"NFFT Operator" => "generated/tutorials/nfft.md",
41+
#"Sampling Operator" => "generated/tutorials/sampling.md",
42+
#"NFFT Operator" => "generated/tutorials/nfft.md",
3843
"Wavelet Operator" => "generated/tutorials/wavelet.md",
39-
"Radon Operator" => "generated/tutorials/radon.md"
44+
"Radon Operator" => "generated/tutorials/radon.md",
45+
"Product Operator" => "generated/tutorials/product.md",
46+
"Normal Operator" => "generated/tutorials/normal.md",
4047
],
4148
"How to" => Any[
42-
"Implement Custom Operators" => "generated/howtos/custom.md",
49+
#"Implement Custom Operators" => "generated/howtos/custom.md",
4350
"Enable GPU Acceleration" => "generated/howtos/gpu.md",
4451
],
45-
"Explanations" => Any[
46-
"Operator Structure" => "operators.md",
47-
],
52+
#"Explanations" => Any[
53+
# "Operator Structure" => "operators.md",
54+
#],
4855
"Reference" => "references.md"
4956
],
5057
warnonly = [:missing_docs]

docs/src/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*Collection of linear operators for multi-dimensional signal and imaging tasks*
44

55

6-
## Purpose
6+
## Introduction
77

88
This package contains a collection of linear operators that are particularly useful for multi-dimensional signal and image processing tasks. Linear operators or linear maps behave like matrices in a matrix-vector product, but aren't necessarily matrices themselves. They can utilize more effective algorithms and can defer their computation until they are multiplied with a vector.
99

docs/src/literate/howots/custom.jl

Whitespace-only changes.

docs/src/literate/howots/gpu.jl

Whitespace-only changes.

docs/src/literate/howtos/custom.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# # Implement Custom Operators
2+
# There are two different ways one can implement a custom LinearOperator. The first one is to directly implement an operator as a LinearOperator from LinearOperators.jl:

docs/src/literate/howtos/gpu.jl

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# # GPU Acceleration
2+
include("../../util.jl") #hide
3+
# GPU kernels generally require all their arguments to exist on the GPU. This is not ncessarily the case for matrix-free operators as provides LinearOperators or LinearOperatorCollection.
4+
# In the case that a matrix free operator is solely a function call and contains no internal array state, the operator is GPU compatible as long as the method has a GPU compatible implementation.
5+
6+
# If the operator has internal fields required for its computation, such as temporary arrays for intermediate values or indices, then it needs to move those to the GPU.
7+
# Furthermore if the operator needs to create a new array in its execution, e.g. it is used in a non-inplace matrix-vector multiplication or it is combined with other operators, then the operator needs to specify
8+
# a storage type. LinearOperatorCollection has several GPU compatible operators, where the storage type is given by setting a `S` parameter:
9+
# ```julia
10+
# using CUDA # or AMDGPU, Metal, ...
11+
# image_gpu = cu(image)
12+
# ```
13+
using LinearOperatorCollection.LinearOperators
14+
image_gpu = image #hide
15+
storage = Complex.(similar(image_gpu, 0))
16+
fop = FFTOp(eltype(image_gpu), shape = (N, N), S = typeof(storage))
17+
LinearOperators.storage_type(fop) == typeof(storage)
18+
19+
# GPU operators can be used just like the other operators. Note however, that a GPU operator does not necessarily work with a CPU vector.

docs/src/literate/tutorials/diagonal.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ dop = DiagOp(ops)
99
typeof(dop)
1010

1111
# We can retrieve the operators:
12-
dop.ops
12+
typeof(dop.ops)
1313

1414
# And visualize the result:
1515
fig = Figure()

docs/src/literate/tutorials/fft.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ image_sine = reshape(sop * vec(image), N, N)
1212

1313
fig = Figure()
1414
plot_image(fig[1,1], image, title = "Image")
15-
plot_image(fig[1,2], abs.(weighted_frequencies) .+ eps(), title = "Frequency Domain", colorscale = log10)
15+
plot_image(fig[1,2], abs.(image_frequencies) .+ eps(), title = "Frequency Domain", colorscale = log10)
1616
plot_image(fig[1,3], image_cosine, title = "Cosine")
1717
plot_image(fig[1,4], image_sine, title = "Sine")
1818
resize_to_layout!(fig)

docs/src/literate/tutorials/normal.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ include("../../util.jl") #hide
88
# \end{equation}
99
# ```
1010
# for some operator $\mathbf{A}$:
11+
using FFTW
1112
fop = op = FFTOp(ComplexF32, shape = (N, N))
1213
nop = NormalOp(eltype(fop), parent = fop)
1314
isapprox(nop * vec(image), vec(image))
@@ -17,7 +18,7 @@ typeof(nop.parent)
1718

1819
# LinearOperatorCollection also provides an opinionated `normalOperator` function which tries to optimize the resulting normal operator.
1920
# As an example consider the normal operator of a weighted fourier operator:
20-
weights = collect(range(0, 1, length = N*N))
21+
weights = Float32.(collect(range(0, 1, length = N*N)))
2122
wop = WeightingOp(weights)
2223
pop = ProdOp(wop, fop)
2324
nop = normalOperator(pop)

docs/src/literate/tutorials/product.jl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,17 @@ include("../../util.jl") #hide
33
# This operator describes the product or composition between two operators:
44
weights = collect(range(0, 1, length = N*N))
55
wop = WeightingOp(weights)
6-
fop = FFTOp(ComplexF64, shape = (N, N))
6+
fop = FFTOp(ComplexF64, shape = (N, N));
77
# A feature of LinearOperators.jl is that operator can be cheaply transposed, conjugated and multiplied and only in the case of a matrix-vector product the combined operation is evaluated.
88
tmp_op = wop * fop
99
tmp_freqs = tmp_op * vec(image)
1010

1111

1212
# Similar to the WeightingOp, the main difference with the product operator provided by LinearOperatorCollection is the dedicated type, which allows for code specialisation.
1313
pop = ProdOp(wop, fop)
14+
typeof(pop)
1415
# and the ability to retrieve the components:
15-
typoef(pop.A)
16+
typeof(pop.A)
1617
# and
1718
typeof(pop.B)
1819

@@ -23,7 +24,7 @@ pop * vec(image) == tmp_op * vec(image)
2324

2425
# We can again visualize our result:
2526
weighted_frequencies = reshape(pop * vec(image), N, N)
26-
image_inverse = reshape(adjoint(pop) * y, N, N)
27+
image_inverse = reshape(adjoint(pop) * vec(weighted_frequencies), N, N)
2728
fig = Figure()
2829
plot_image(fig[1,1], image, title = "Image")
2930
plot_image(fig[1,2], abs.(weighted_frequencies) .+ eps(), title = "Frequency Domain", colorscale = log10)

0 commit comments

Comments
 (0)