Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Precompile common workflows #99

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
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
2 changes: 2 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ FastTransforms = "057dd010-8810-581a-b7be-e3fc3b93f78c"
FillArrays = "1a297f60-69ca-5386-bcde-b61e274b549b"
IntervalSets = "8197267c-284f-5f27-9208-e0e47529a953"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"
Static = "aedffcd0-7271-4cad-89d0-dc628f76c6d3"
Expand All @@ -32,6 +33,7 @@ FastTransforms = "0.12, 0.13, 0.14, 0.15.1"
FillArrays = "0.11, 0.12, 0.13, 1"
IntervalSets = "0.5, 0.6, 0.7"
LazyArrays = "0.22, 1"
PrecompileTools = "1"
Reexport = "0.2, 1"
SpecialFunctions = "0.10, 1.0, 2"
Static = "0.8"
Expand Down
1 change: 1 addition & 0 deletions src/ApproxFunOrthogonalPolynomials.jl
Original file line number Diff line number Diff line change
Expand Up @@ -142,5 +142,6 @@ include("specialfunctions.jl")
include("fastops.jl")
include("symeigen.jl")
include("show.jl")
include("precompile.jl")

end
41 changes: 41 additions & 0 deletions src/precompile.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
using PrecompileTools

@setup_workload begin
splist = Any[Jacobi(1, 1), Chebyshev(), Ultraspherical(1)]
append!(splist, Any[Jacobi(1, 1, 0..1), Chebyshev(0..1), Ultraspherical(1, 0..1)])
spreal = copy(splist)
push!(splist, Chebyshev(Segment(1.0+im,2.0+2im)))
# special functions
spfns = (sin, cos, exp)
v = ones(2)
m = ones(2,2)
a = ones(2,2,2)
@compile_workload begin
for S in splist
f = Fun(S,v)
f(0.1)
1/(f^2+1)
abs(DefiniteIntegral()*f - sum(f))
norm(Derivative()*f-f')
norm(first(cumsum(f)))
for spfn in spfns
spfn(f)
end
end
for S in spreal
transform(S, v)
itransform(S, v)
transform!(S, v)
itransform!(S, v)
transform(S * S, m)
itransform(S * S, m)

[Derivative(S)^2 + 1; Dirichlet(S)] \ [1,0]

f2 = Fun((x,y) -> x*y, S^2); f2(0.1, 0.1)
P = ProductFun((x,y) -> x*y, S^2); P(0.1, 0.1)
L = LowRankFun((x,y) -> x*y, S^2); L(0.1, 0.1)
end
roots(Fun(sin,Interval(big"0.0", big"1.0")))
end
end