@@ -32,20 +32,20 @@ Example of usage:
3232
3333 β = 2 #β = 1, 2, 4 generates real, complex and quaternionic matrices respectively.
3434 d = Wigner{β} #same as GaussianHermite{β}
35-
35+
3636 n = 20 #Generate square matrices of this size
3737
3838 S = rand(d, n) #Generate a 20x20 symmetric Wigner matrix
3939 T = tridrand(d, n) #Generate the symmetric tridiagonal form
4040 v = eigvalrand(d, n) #Generate a sample of eigenvalues
4141"""
42- immutable GaussianHermite{β} <: ContinuousMatrixDistribution end
42+ struct GaussianHermite{β} <: ContinuousMatrixDistribution end
4343GaussianHermite (β) = GaussianHermite {β} ()
4444
4545"""
4646Synonym for GaussianHermite{β}
4747"""
48- typealias Wigner{β} GaussianHermite{β}
48+ const Wigner{β} = GaussianHermite{β}
4949
5050rand {β} (d:: Type{Wigner{β}} , dims... ) = rand (d (), dims... )
5151
@@ -70,7 +70,7 @@ function rand(d::Wigner{4}, n::Int)
7070 return Hermitian ((A + A' ) / normalization)
7171end
7272
73- rand {β} (d:: Wigner{β} , n:: Int ) =
73+ rand {β} (d:: Wigner{β} , n:: Int ) =
7474 throw (ValueError (" Cannot sample random matrix of size $n x $n for β=$β " ))
7575
7676function rand {β} (d:: Wigner{β} , dims... )
8585Generates a nxn symmetric tridiagonal Wigner matrix
8686
8787Unlike for `rand(Wigner{β}, n)`, which is restricted to β=1,2 or 4,
88- `trirand(Wigner{β}, n)` will generate a
88+ `trirand(Wigner{β}, n)` will generate a
8989
9090The β=∞ case is defined in Edelman, Persson and Sutton, 2012
9191"""
@@ -143,13 +143,13 @@ end
143143# Laguerre ensemble #
144144# ####################
145145
146- type GaussianLaguerre <: ContinuousMatrixDistribution
146+ mutable struct GaussianLaguerre <: ContinuousMatrixDistribution
147147 beta:: Real
148148 a:: Real
149149end
150- typealias Wishart GaussianLaguerre
150+ const Wishart = GaussianLaguerre
151+
151152
152-
153153# Generates a NxN Hermitian Wishart matrix
154154# TODO Check - the eigenvalue distribution looks funky
155155# TODO The appropriate matrix size should be calculated from a and one matrix dimension
@@ -215,13 +215,13 @@ end
215215# Jacobi ensemble #
216216# ##################
217217
218- # Generates a NxN self-dual MANOVA matrix
219- type GaussianJacobi <: ContinuousMatrixDistribution
218+ # Generates a NxN self-dual MANOVA matrix
219+ mutable struct GaussianJacobi <: ContinuousMatrixDistribution
220220 beta:: Real
221221 a:: Real
222222 b:: Real
223223end
224- typealias MANOVA GaussianJacobi
224+ const MANOVA = GaussianJacobi
225225
226226function rand (d:: GaussianJacobi , m:: Integer )
227227 w1 = Wishart (m, int (2.0 * d. a/ d. beta), d. beta)
@@ -267,7 +267,7 @@ function sprand(d::GaussianJacobi, n::Integer, a::Real, b::Real)
267267 for i= 1 : n
268268 CoordI[i], CoordJ[i] = i, i
269269 Values[i] = i== 1 ? c[n] : c[n+ 1 - i] * sp[n+ 1 - i]
270- end
270+ end
271271 for i= 1 : n
272272 CoordI[n+ i], CoordJ[n+ i] = i, n+ i
273273 Values[n+ i] = i== n ? s[1 ] : s[n+ 1 - i] * sp[n- i]
@@ -297,7 +297,7 @@ function sprand(d::GaussianJacobi, n::Integer, a::Real, b::Real)
297297 CoordI[7 n- 3 + i], CoordJ[7 n- 3 + i] = n+ i,i+ 1
298298 Values[7 n- 3 + i] = - s[n- i]* cp[n- i]
299299 end
300-
300+
301301 return sparse (CoordI, CoordJ, Values)
302302end
303303
@@ -307,7 +307,7 @@ function eigvalrand(d::GaussianJacobi, n::Integer)
307307 c, s, cp, sp = SampleCSValues (n, d. a, d. b, d. beta)
308308 dv = [i== 1 ? c[n] : c[n+ 1 - i] * sp[n+ 1 - i] for i= 1 : n]
309309 ev = [- s[n+ 1 - i]* cp[n- i] for i= 1 : n- 1 ]
310-
310+
311311 # #TODO : understand why dv and ev are returned as Array{Any,1}
312312 M = Bidiagonal (convert (Array{Float64,1 },dv), convert (Array{Float64,1 },ev), false )
313313 return svdvals (M)
@@ -339,4 +339,3 @@ function eigvaljpdf{Eigenvalue<:Number}(d::GaussianJacobi, lambda::Vector{Eigenv
339339
340340 return c * VandermondeDeterminant (lambda, beta) * Prod * exp (- Energy)
341341end
342-
0 commit comments