@@ -9,10 +9,10 @@ matrix with iid Gaussian matrix elements of variance 1/2 and mean 0.
99The cdf of Tracy-Widom is given by
1010
1111``
12- F_beta (s) = lim_{n→∞} Pr(√2 n^{1/6} (λ_max - √(2n) ≤ s)
12+ F_β (s) = lim_{n→∞} Pr(√2 n^{1/6} (λ_max - √(2n) ≤ s)
1313``
1414
15- where beta = 1, 2, or 4 for the orthogonal, unitary, or symplectic ensembles.
15+ where β = 1, 2, or 4 for the orthogonal, unitary, or symplectic ensembles.
1616
1717References:
1818
@@ -23,7 +23,9 @@ References:
2323Numerical routines adapted from Alan Edelman's course notes for MIT 18.338,
2424Random Matrix Theory, 2016.
2525"""
26- struct TracyWidom <: ContinuousUnivariateDistribution end
26+ struct TracyWidom{T} <: ContinuousUnivariateDistribution
27+ β:: T
28+ end
2729
2830
2931"""
@@ -37,27 +39,26 @@ doi.org/10.1090/S0025-5718-09-02280-7
3739# Arguments
3840* `d::TracyWidom` or `Type{TracyWidom}`: an instance of `TracyWidom` or the type itself
3941* `s::Real`: The point at which to evaluate the cdf
40- * `beta::Integer = 2`: The Dyson index defining the distribution. Takes values 1, 2, or 4
4142* `num_points::Integer = 25`: The number of points in the quadrature
4243"""
43- function cdf (d:: TracyWidom , s:: T ; beta :: Integer = 2 , num_points:: Integer = 25 ) where {T<: Real }
44- beta ∈ (1 ,2 ,4 ) || throw (ArgumentError (" Beta must be 1, 2, or 4" ))
44+ function cdf (d:: TracyWidom , s:: T ; num_points:: Integer = 25 ) where {T<: Real }
45+ d . β ∈ (1 ,2 ,4 ) || throw (ArgumentError (" β must be 1, 2, or 4" ))
4546 quad = gausslegendre (num_points)
46- _TWcdf (s, beta , quad)
47+ _TWcdf (s, d . β , quad)
4748end
4849
4950function cdf (d:: Type{TracyWidom} , s:: T ; beta:: Integer = 2 , num_points:: Integer = 25 ) where {T<: Real }
50- cdf (d (), s, beta = beta , num_points= num_points)
51+ cdf (d (beta ), s, num_points= num_points)
5152end
5253
53- function cdf (d:: TracyWidom , s_vals:: AbstractArray{T} ; beta :: Integer = 2 , num_points:: Integer = 25 ) where {T<: Real }
54- beta ∈ (1 ,2 ,4 ) || throw (ArgumentError (" Beta must be 1, 2, or 4" ))
54+ function cdf (d:: TracyWidom , s_vals:: AbstractArray{T} ; num_points:: Integer = 25 ) where {T<: Real }
55+ d . β ∈ (1 ,2 ,4 ) || throw (ArgumentError (" β must be 1, 2, or 4" ))
5556 quad = gausslegendre (num_points)
56- [_TWcdf (s, beta , quad) for s in s_vals]
57+ [_TWcdf (s, d . β , quad) for s in s_vals]
5758end
5859
5960function cdf (d:: Type{TracyWidom} , s_vals:: AbstractArray{T} ; beta:: Integer = 2 , num_points:: Integer = 25 ) where {T<: Real }
60- cdf (d (), s_vals, beta = beta , num_points= num_points)
61+ cdf (d (beta ), s_vals, num_points= num_points)
6162end
6263
6364function _TWcdf (s:: T , beta:: Integer , quad:: Tuple{Array{Float64,1},Array{Float64,1}} ) where {T<: Real }
@@ -117,4 +118,4 @@ function rand(d::TracyWidom, n::Int)
117118 b= [χ (i) for i= (n- 1 ): - 1 : k]
118119 v= eigmax (SymTridiagonal (a, b))
119120end
120- rand (d:: Type{TracyWidom} , t:: Integer ) = rand (d (), t)
121+ rand (d:: Type{TracyWidom} , t:: Integer ) = rand (d (2 ), t)
0 commit comments