Skip to content

Commit

Permalink
fix wigner ensemble
Browse files Browse the repository at this point in the history
  • Loading branch information
lpawela committed Aug 22, 2019
1 parent ec081e8 commit e52d5aa
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions randommatrices/src/wigner.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,18 @@ export WignerEnsemble

struct WignerEnsemble{β} <: QIContinuousMatrixDistribution
d::Int
g::GinibreEnsemble{β}

function WignerEnsemble{β}(d::Int) where β
β == 4 && mod(d, 2) == 1 ? throw(ArgumentError("Dim must even")) : ()
new(d)
g = GinibreEnsemble{β}(d)
new(d, g)
end
end

WignerEnsemble(d::Int) = WignerEnsemble{2}(d)

function rand(rng::AbstractRNG, w::WignerEnsemble{β}) where β
z = rand(rng, GinibreEnsemble{β}(w.d))
z = rand(rng, w.g)
(z + z') / 2sqrt(2β * w.d)
end

0 comments on commit e52d5aa

Please sign in to comment.