Skip to content

Commit ff66063

Browse files
authored
Fix ambiguity error in rand for Hermite, ValueError -> ArgumentError (#71)
1 parent ac6652b commit ff66063

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/GaussianEnsembles.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,13 @@ function rand(d::Wigner{4}, n::Int)
7171
end
7272

7373
rand(d::Wigner{β}, n::Int) where {β} =
74-
throw(ValueError("Cannot sample random matrix of size $n x $n for β="))
74+
throw(ArgumentError("Cannot sample random matrix of size $n x $n for β="))
7575

76-
function rand(d::Wigner{β}, dims...) where {β}
76+
function rand(d::Wigner{β}, dims::Int...) where {β}
7777
if length(dims)==2 && dims[1] == dims[2]
7878
return rand(d, dims[1])
7979
else
80-
throw(ValueError("Cannot sample random matrix of size $dims for β="))
80+
throw(ArgumentError("Cannot sample random matrix of size $dims for β="))
8181
end
8282
end
8383

@@ -92,7 +92,7 @@ The β=∞ case is defined in Edelman, Persson and Sutton, 2012
9292
function tridrand(d::Wigner{β}, n::Int) where {β}
9393
χ(df::Real) = rand(Distributions.Chi(df))
9494
if β0
95-
throw(ValueError("β = cannot be nonpositive"))
95+
throw(ArgumentError("β = cannot be nonpositive"))
9696
elseif isinf(β)
9797
return tridrand(Wigner{Inf}, n)
9898
else
@@ -107,7 +107,7 @@ function tridrand(d::Wigner{β}, dims...) where {β}
107107
if length(dims)==2 && dims[1] == dims[2]
108108
return rand(d, dims[1])
109109
else
110-
throw(ValueError("Cannot sample random matrix of size $dims for β="))
110+
throw(ArgumentError("Cannot sample random matrix of size $dims for β="))
111111
end
112112
end
113113

0 commit comments

Comments
 (0)