Skip to content

Instantly share code, notes, and snippets.

View MikaelSlevinsky's full-sized avatar

Mikael Slevinsky MikaelSlevinsky

View GitHub Profile
@MikaelSlevinsky
MikaelSlevinsky / multtest.jl
Last active August 29, 2015 14:21
Test coefficient- and value-based multiplication
using PyCall
pygui(:tk)
using PyPlot
using ApproxFun
gc()
gc_disable()
N = 36
#
# woodburysolve
#
using ApproxFun, SingularIntegralEquations, PyPlot
d = 8
t1,t2 = Array(Float64,min(d,6)),Array(Float64,d)
for i = 1:d
@MikaelSlevinsky
MikaelSlevinsky / myFun.jl
Last active March 24, 2016 21:42
An axiomatically-designed constructor
using ApproxFun
import ApproxFun: Fun, domain, Space, checkpoints, ArraySpace, zerocfsFun, defaultFun, real
function myFun(f, d::Space)
#TODO: reuse function values?
T = eltype(domain(d))
if T <: Complex
T = T.parameters[1] #get underlying real representation
end
r=checkpoints(d)
using FastTransforms, PyPlot
errASY1,errASY2,errCXN1,errCXN2 = Float64[],Float64[],Float64[],Float64[]
n = round(Int,logspace(1,5,30))
for k in n
println("This is k: ",k)
srand(0)
c = randn(k)
push!(errASY1,norm(icjt(cjt(c,0.,0.),0.,0.)-c,Inf))
push!(errASY2,norm(cjt(icjt(c,0.,0.),0.,0.)-c,Inf))
@MikaelSlevinsky
MikaelSlevinsky / ThreeMethodsComparison.jl
Created March 19, 2017 01:07
Timings and errors between hierarchical, Toeplitz-dot-Hankel, and asymptotic methods for converting Legendre expansions to Chebyshev expansions
using FastTransforms, PyPlot
N = 40
t = Matrix{Float64}(N,6)
err = Matrix{Float64}(N,3)
for i in 1:N
n = round(Int64, 10.0^(1 + 5*((i-1)/(N-1))))
v = rand(n)
@MikaelSlevinsky
MikaelSlevinsky / test_slowplan_openmp.jl
Last active February 26, 2018 21:21
Test the experimental use of multithreading for spherical harmonic transforms in FastTransforms.jl
Pkg.build("FastTransforms")
using FastTransforms
N = 2.^(7:12)
tSP = zeros(length(N), 3)
Nr = 3
j = 1
for n in N
A = sphrandn(Float64, n+1, n+1)
SlowSphericalHarmonicPlan(A)