Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ NFFT = "efe261a4-0d2b-5849-be55-fc731d526b0d"
PaddedViews = "5432bcbf-9aad-5242-b902-cca2824c8663"
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
ShiftedArrays = "1277b4bf-5013-50f5-be3d-901d8477a67a"
SnoopPrecompile = "66db9d55-30c0-4569-8b51-7e840670fc0c"

[compat]

ChainRulesCore = "1, 1.0, 1.1"
FFTW = "1.5"
ImageTransformations = "0.9"
Expand All @@ -25,6 +25,7 @@ NFFT = "0.11, 0.12, 0.13"
PaddedViews = "0.5"
Reexport = "1"
ShiftedArrays = "2"
SnoopPrecompile = "1"
Zygote = "0.6"
julia = "1, 1.6, 1.7, 1.8"

Expand Down
7 changes: 7 additions & 0 deletions src/FourierTools.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ using LinearAlgebra
using IndexFunArrays
using ChainRulesCore
using NDTools

using SnoopPrecompile


@reexport using NFFT
FFTW.set_num_threads(4)

Expand All @@ -31,4 +35,7 @@ include("damping.jl")
include("czt.jl")
include("fractional_fourier_transform.jl")


include("precompilation.jl")

end # module
28 changes: 28 additions & 0 deletions src/precompilation.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# doesn't save too much but a little
@precompile_setup begin
img64 = abs.(randn(Float32, (4,4)))
img32 = abs.(randn(Float64, (4,4)))
imgCF64 = abs.(randn(ComplexF64, (4,4)))
imgCF32 = abs.(randn(ComplexF32, (4,4)))

function f(img)
resample(img, (5,5))
resample(img, (2,2))
shift(img, (2,2))
shift(img, (2,2))
ft(img)
ffts(img)
ift(img)
iffts(img)
rotate(img, 1.1)
conv(img, img)
end

@precompile_all_calls begin
f(img64)
f(img32)
f(imgCF64)
f(imgCF32)
end

end