Created
September 4, 2015 17:57
-
-
Save MikaelSlevinsky/725d8c17ee73bf565c48 to your computer and use it in GitHub Desktop.
woodbury timings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# woodburysolve | |
# | |
using ApproxFun, SingularIntegralEquations, PyPlot | |
d = 8 | |
t1,t2 = Array(Float64,min(d,6)),Array(Float64,d) | |
for i = 1:d | |
dom = cantor(Interval(),i) | |
⨍ = DefiniteLineIntegral(dom) | |
f = Fun(x->logabs(x-5im),dom) | |
if i < 7 | |
G = GreensFun((x,y)->1/2,CauchyWeight(Space(dom)⊗Space(dom),0);method=:Cholesky) | |
gc() | |
gc_disable() | |
tic() | |
u1 = ⨍[G]\transpose(f) | |
t1[i] = toc() | |
gc_enable() | |
gc() | |
println("Adaptive QR forward error norm is: ",norm(⨍[G]*u1-f)) | |
end | |
G1 = GreensFun((x,y)->1/2,CauchyWeight(Space(dom)⊗Space(dom),0);method=:hierarchical) | |
H = ⨍[G1] | |
gc() | |
gc_disable() | |
tic() | |
u2 = H\f | |
t2[i] = toc() | |
gc_enable() | |
gc() | |
gc_disable() | |
tic() | |
u2 = H\f | |
t2[i] = toc() | |
gc_enable() | |
gc() | |
if i < 7 println("The Woodbury forward error norm is: ",norm(⨍[G]*u2-f)) end | |
end | |
d1 = 2.0.^(1:length(t1)) | |
d2 = 2.0.^(1:length(t2)) | |
clf();loglog(d1,t1,"-r",d1,(d1/2).^3.*t1[1],"--b") | |
loglog(d2,t2,"-g",d2,(d2/2).^2*t2[1],"--k") | |
grid() | |
xlabel("Number of domains") | |
ylabel("Execution time") | |
savefig("timingtestsLaplace.png",dpi=300) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment