Skip to content

Commit e6d555e

Browse files
committed
add GaussianJacobi fixes and tests
1 parent e74bdd6 commit e6d555e

2 files changed

Lines changed: 12 additions & 3 deletions

File tree

src/GaussianEnsembles.jl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,7 @@ struct GaussianJacobi{β} <: ContinuousMatrixDistribution
320320
a::Real
321321
b::Real
322322
end
323+
GaussianJacobi::Real, a::Real, b::Real) = GaussianJacobi{β}(a, b)
323324
const MANOVA{β} = GaussianJacobi{β}
324325

325326
"""
@@ -328,9 +329,9 @@ const MANOVA{β} = GaussianJacobi{β}
328329
Generate an `n × n` random matrix sampled from the Gaussian-Jacobi ensemble (also known as the MANOVA ensemble)
329330
with parameters defined in `d`.
330331
"""
331-
function rand(d::GaussianJacobi{β}, m::Integer) where {β}
332-
w1 = Wishart(m, int(2.0*d.a/β), β)
333-
w2 = Wishart(m, int(2.0*d.b/β), β)
332+
function rand(d::GaussianJacobi{β}, n::Int) where {β}
333+
w1 = rand(Wishart(β, d.a), n)
334+
w2 = rand(Wishart(β, d.b), n)
334335
return (w1 + w2) \ w1
335336
end
336337

test/GaussianEnsembles.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,14 @@ for (β, T, N) in [(1, Real, n), (2, Complex, n), (4, Complex, 2n)]
5050
ed = eigvaljpdf(d, rand(3))
5151
@test isa(ed, Real)
5252
end
53+
@testset "MANOVA (β = $(β))" begin
54+
a = 2.0 * (rand(1:5) + β * n)
55+
b = a * 3.5
56+
d = MANOVA(β, a, b)
57+
A = rand(d, n)
58+
@test eltype(A) <: T
59+
@test size(A) == (N, N)
60+
end
5361
end
5462

5563
end # testset

0 commit comments

Comments
 (0)