@@ -9,10 +9,10 @@ matrix with iid Gaussian matrix elements of variance 1/2 and mean 0.
9
9
The cdf of Tracy-Widom is given by
10
10
11
11
``
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)
13
13
``
14
14
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.
16
16
17
17
References:
18
18
@@ -23,7 +23,9 @@ References:
23
23
Numerical routines adapted from Alan Edelman's course notes for MIT 18.338,
24
24
Random Matrix Theory, 2016.
25
25
"""
26
- struct TracyWidom <: ContinuousUnivariateDistribution end
26
+ struct TracyWidom{T} <: ContinuousUnivariateDistribution
27
+ β:: T
28
+ end
27
29
28
30
29
31
"""
@@ -37,27 +39,26 @@ doi.org/10.1090/S0025-5718-09-02280-7
37
39
# Arguments
38
40
* `d::TracyWidom` or `Type{TracyWidom}`: an instance of `TracyWidom` or the type itself
39
41
* `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
41
42
* `num_points::Integer = 25`: The number of points in the quadrature
42
43
"""
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" ))
45
46
quad = gausslegendre (num_points)
46
- _TWcdf (s, beta , quad)
47
+ _TWcdf (s, d . β , quad)
47
48
end
48
49
49
50
function 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)
51
52
end
52
53
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" ))
55
56
quad = gausslegendre (num_points)
56
- [_TWcdf (s, beta , quad) for s in s_vals]
57
+ [_TWcdf (s, d . β , quad) for s in s_vals]
57
58
end
58
59
59
60
function 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)
61
62
end
62
63
63
64
function _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)
117
118
b= [χ (i) for i= (n- 1 ): - 1 : k]
118
119
v= eigmax (SymTridiagonal (a, b))
119
120
end
120
- rand (d:: Type{TracyWidom} , t:: Integer ) = rand (d (), t)
121
+ rand (d:: Type{TracyWidom} , t:: Integer ) = rand (d (2 ), t)
0 commit comments