In [1]:
include("approxfun.jl")
x = [0.0, 0.5, 1.0]
y = [1//4, 2//4, 3//4]
ftest = approxfun_constant(x, y, 0//1, 1//1)
println(typeof(ftest(-0.25)))
println(typeof(ftest(0.25)))
println(typeof(ftest(1.25)))
println([ftest(x2) for x2 in -0.25:0.25:1.25])
x = [0.0, 0.5, 1.0]
y = [-1.0, -0.5, 0.0]
ftest = approxfun_constant(x, y, -2.0, 1.0)
[ftest(x2) for x2 in -0.25:0.25:1.25] ### Any???
#code_llvm(ftest, (Float64,))
Out[1]:
In [4]:
include("ecdf.jl")
Out[4]:
In [6]:
using Winston
f = ecdf([1,1,2,5,1,3,2,4])
x = 0:0.01:6
y = convert(Array{Float64,1}, [f(xx) for xx in x]) # why the conversion is necessary??
#println([f(x) for x in 0:1:6])
#show(typeof(x))
#show(typeof(y))
plot(x, y)
#code_lowered(f, (Float64,))
Out[6]:
In [10]:
x = rand(100000)*100
xp = 0:0.0001:100
f = ecdf(x)
f(1.0)
f(2.0)
f(3.0)
@time [f(x)::Float64 for x in xp]
nothing