Skip to content

Commit 251d8dc

Browse files
committed
Update for 0.5
1 parent 6c7f38c commit 251d8dc

File tree

4 files changed

+19
-15
lines changed

4 files changed

+19
-15
lines changed

src/HaarMeasure.jl

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,18 +65,22 @@ end
6565
#Zyczkowski and Kus, Random unitary matrices, J. Phys. A: Math. Gen. 27,
6666
#4235–4245 (1994).
6767

68+
69+
if VERSION < v"0.5.0-dev"
70+
macro blasfunc(x)
71+
return :( $(BLAS.blasfunc(x) ))
72+
end
73+
else
74+
import Base.BLAS.@blasfunc
75+
end
76+
77+
6878
using Base.LinAlg: BlasInt
6979
for (s, elty) in (("dlarfg_", Float64),
7080
("zlarfg_", Complex128))
71-
72-
if Base.VERSION < v"0.5-"
73-
blass = Base.blasfunc(s)
74-
else
75-
blass = eval(Base, :(@blasfunc($s)))
76-
end
7781
@eval begin
7882
function larfg!(n::Int, α::Ptr{$elty}, x::Ptr{$elty}, incx::Int, τ::Ptr{$elty})
79-
ccall(($blass, Base.liblapack_name), Void,
83+
ccall((@blasfunc($s), LAPACK.liblapack), Void,
8084
(Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}),
8185
&n, α, x, &incx, τ)
8286
end
@@ -124,4 +128,3 @@ function randfast(W::Haar, n::Int)
124128
error("beta = $beta not implemented")
125129
end
126130
end
127-

src/InvariantEnsembles.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ function legendrepolynomials(n)
5050
orthonormalpolynomials(1./sqrt(2),k->0,k->sqrt(k^2./(4k^2-1)),[-1.,1.],n)
5151
end
5252
function scaledhermitepolynomials(n)
53-
orthonormalpolynomials(n^(1/4)/(1.π)^(1/4),k->0,k->sqrt((k)/(2n)),[-3.,3.],n)
53+
orthonormalpolynomials(n^(1/4)/(1.0π)^(1/4),k->0,k->sqrt((k)/(2n)),[-3.,3.],n)
5454
end
5555

5656

@@ -179,11 +179,11 @@ function InvariantEnsemble(str::AbstractString,n::Integer)
179179
error("Legendre not implemented")
180180
#InvariantEnsembles(map(f->pad(f,2n),legendrepolynomials(n)))
181181
elseif(str == "CoshUnscaled")
182-
InvariantEnsembleUnscaled("Cosh",x->cosh(x),[-2acosh(1.n),2acosh(1.n)],n)
182+
InvariantEnsembleUnscaled("Cosh",x->cosh(x),[-2acosh(1.0n),2acosh(1.0n)],n)
183183
elseif(str == "EightUnscaled")
184-
InvariantEnsembleUnscaled("Eight",x->x.^8,[-3.n^(1/8),3.n^(1/8)],n)
184+
InvariantEnsembleUnscaled("Eight",x->x.^8,[-3.0n^(1/8),3.0n^(1/8)],n)
185185
elseif(str == "QuarticUnscaled")
186-
InvariantEnsembleUnscaled("Quartic",x->x.^4,[-3.n^(1/4),3.n^(1/4)],n)
186+
InvariantEnsembleUnscaled("Quartic",x->x.^4,[-3.0n^(1/4),3.0n^(1/4)],n)
187187
end
188188
end
189189

src/densities/Semicircle.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ with mean 0 and variance 1 (radius 2)
99
immutable Semicircle{T<:Real} <: ContinuousUnivariateDistribution
1010
mean::T
1111
radius::T
12+
Semicircle::T,r::T) = new(μ,r)
1213
end
1314
Semicircle{T<:Real}::T=0.0, r::T=2.0) = r > 0 ? Semicircle{T}(μ, r) :
1415
throw(ArgumentError("radius r must be positive, got $r"))

src/densities/TracyWidom.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Hermitian matrix.
99
The cdf of Tracy-Widom is given by
1010
1111
``
12-
F_2 (s) = lim_{n→∞} Pr(√2 n^{1/6} (λₙ - √(2n) ≤ s)
12+
F_2 (s) = lim_{n→∞} Pr(√2 n^{1/6} (λₙ - √(2n) ≤ s)
1313
``
1414
1515
References:
@@ -76,13 +76,13 @@ end
7676
"""
7777
Samples the largest eigenvalue of the n × n GUE matrix
7878
"""
79-
function rand(d::TracyWidom, n::Integer)
79+
function rand(d::TracyWidom, n::Int)
8080
n > 1 || error("Cannot construct $n × $n matrix")
8181
if n < 100
8282
k = n
8383
else #Exploit the fact that the eigenvector is concentrated in the top left corner
8484
k = round(Int, n-10*n^(1/3)-1)
85-
end
85+
end
8686
a=randn(n-k+1)
8787
b=[χ(i) for i=(n-1):-1:k]
8888
v=eigmax(SymTridiagonal(a, b))

0 commit comments

Comments
 (0)