Skip to content

Commit d7f5b24

Browse files
switch to diffeq
1 parent 6fdccbf commit d7f5b24

File tree

6 files changed

+19
-17
lines changed

6 files changed

+19
-17
lines changed

.travis.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ addons:
66
os:
77
- linux
88
julia:
9-
- 0.4
109
- 0.5
1110
- nightly
1211
sudo: false
@@ -17,4 +16,3 @@ notifications:
1716
# - julia -e 'Pkg.clone(pwd()); Pkg.build("RandomMatrices"); Pkg.test("RandomMatrices"; coverage=true)'
1817
after_success:
1918
- julia -e 'Pkg.add("Coverage"); cd(Pkg.dir("RandomMatrices")); using Coverage; Coveralls.submit(process_folder()); Codecov.submit(process_folder())'
20-

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ RandomMatrices.jl
33

44
Random matrix package for [Julia](http://julialang.org).
55

6-
[![RandomMatrices](http://pkg.julialang.org/badges/RandomMatrices_0.4.svg)](http://pkg.julialang.org/?pkg=RandomMatrices)
6+
[![RandomMatrices](http://pkg.julialang.org/badges/RandomMatrices_0.5.svg)](http://pkg.julialang.org/?pkg=RandomMatrices)
77
[![Build Status](https://travis-ci.org/jiahao/RandomMatrices.jl.png?branch=master)](https://travis-ci.org/jiahao/RandomMatrices.jl)
88
[![Coverage Status](https://coveralls.io/repos/jiahao/RandomMatrices.jl/badge.svg?branch=master&service=github)](https://coveralls.io/github/jiahao/RandomMatrices.jl?branch=master)
99
[![codecov.io](https://codecov.io/github/jiahao/RandomMatrices.jl/coverage.svg?branch=master)](https://codecov.io/github/jiahao/RandomMatrices.jl?branch=master)

REQUIRE

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
julia 0.4
1+
julia 0.5
22
Combinatorics 0.2
33
Distributions 0.8.10
4-
ODE 0.2.1
4+
OrdinaryDiffEq
55
GSL 0.3.1
66
Compat 0.9.2

src/RandomMatrices.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module RandomMatrices
33
using Combinatorics
44
using Compat
55
using GSL
6-
using ODE
6+
using OrdinaryDiffEq
77

88
import Base: isinf, rand
99
import Distributions: ContinuousUnivariateDistribution,

src/densities/TracyWidom.jl

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ function pdf{S<:Real}(d::TracyWidom, t::S, t0::S = convert(S, -8.0))
3838
tt0 && return 0.0
3939
t5 && return 0.0
4040

41-
ts, y = _solve_painleve_ii(t0, t)
41+
sol = _solve_painleve_ii(t0, t)
4242

43-
ΔF2=exp(-y[end-1][3]) - exp(-y[end][3]) # the cumulative distribution
44-
f2=ΔF2/(ts[end]-ts[end-1]) # the density at t
43+
ΔF2=exp(-sol[end-1][3]) - exp(-sol[end][3]) # the cumulative distribution
44+
f2=ΔF2/(sol.t[end]-sol.t[end-1]) # the density at t
4545
end
4646
pdf(d::Type{TracyWidom}, t::Real) = pdf(d(), t)
4747

@@ -56,21 +56,25 @@ See `pdf(::TracyWidom)` for a description of the arguments.
5656
function cdf{S<:Real}(d::TracyWidom, t::S, t0::S = convert(S, -8.0))
5757
tt0 && return 0.0
5858
t5 && return 1.0
59-
60-
ts, y = _solve_painleve_ii(t0, t)
61-
62-
F2=exp(-y[end][3])
59+
sol = _solve_painleve_ii(t0, t)
60+
F2=exp(-sol[end][3])
6361
end
6462
cdf(d::Type{TracyWidom}, t::Real) = cdf(d(), t)
6563

6664
# An internal function which sets up the Painleve II differential equation and
6765
# runs it through the ode23 numerical integrator
6866
function _solve_painleve_ii{S<:Real}(t0::S, t::S)
69-
deq(t, y) = [y[2], t*y[1]+2y[1]^3, y[4], y[1]^2]
67+
function deq(t, y, dy)
68+
dy[1] = y[2]
69+
dy[2] = t*y[1]+2y[1]^3
70+
dy[3] = y[4]
71+
dy[4] = y[1]^2
72+
end
7073
a0 = airy(t0)
71-
T = typeof(a0)
74+
T = typeof(big(a0))
7275
y0=T[a0, airy(1, t0), 0, airy(t0)^2] # Initial conditions
73-
(ts, y)=ode23(deq, y0, [t0, t]) # Solve the ODE
76+
prob = ODEProblem(deq,y0,(t0,t))
77+
solve(prob, Vern8(), abstol=1e-12, reltol=1e-12) # Solve the ODE
7478
end
7579

7680
"""

test/densities/TracyWidom.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ using Base.Test
77
@test cdf(TracyWidom, -10) == 0
88
@test cdf(TracyWidom, 10) == 1
99

10-
if isdefined(:ODE) && isa(ODE, Module)
10+
if isdefined(:OrdinaryDiffEq) && isa(OrdinaryDiffEq, Module)
1111
t = rand()
1212
@test pdf(TracyWidom, t) > 0
1313
@test 0 < cdf(TracyWidom, t) < 1

0 commit comments

Comments
 (0)