Skip to content

Commit 63c98a8

Browse files
committed
fix: AbstractFloat
1 parent 9716006 commit 63c98a8

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/AlphaStableDistributions.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ skewness parameter, scale parameter (dispersion^1/α) and location parameter res
188188
189189
α, β, c and δ are computed based on McCulloch (1986) fractile.
190190
"""
191-
function Distributions.fit(::Type{<:AlphaStable}, x::AbstractArray{T}, alg=QuickSort) where {T}
191+
function Distributions.fit(::Type{<:AlphaStable}, x::AbstractArray{T}, alg=QuickSort) where {T<:AbstractFloat}
192192
sx = sort(x, alg=alg)
193193
p = quantile.(Ref(sx), (0.05, 0.25, 0.28, 0.5, 0.72, 0.75, 0.95), sorted=true)
194194
να = (p[7]-p[1]) / (p[6]-p[2])
@@ -235,7 +235,7 @@ returns `SymmetricAlphaStable`
235235
scale is computed based on Fama & Roll (1971) fractile.
236236
location is the 50% trimmed mean of the sample.
237237
"""
238-
function Distributions.fit(::Type{<:SymmetricAlphaStable}, x::AbstractArray{T}, alg=QuickSort) where {T}
238+
function Distributions.fit(::Type{<:SymmetricAlphaStable}, x::AbstractArray{T}, alg=QuickSort) where {T<:AbstractFloat}
239239
sx = sort(x, alg=alg)
240240
δ = mean(@view(sx[end÷4:(3*end)÷4]))
241241
p = quantile.(Ref(sx), (0.05, 0.25, 0.28, 0.72, 0.75, 0.95), sorted=true)
@@ -269,7 +269,7 @@ This implementation is based on the method in J.M. Chambers, C.L. Mallows
269269
and B.W. Stuck, "A Method for Simulating Stable Random Variables," JASA 71 (1976): 340-4.
270270
McCulloch's MATLAB implementation (1996) served as a reference in developing this code.
271271
"""
272-
function Base.rand(rng::AbstractRNG, d::AlphaStable{T}) where {T<:Real}
272+
function Base.rand(rng::AbstractRNG, d::AlphaStable{T}) where {T<:AbstractFloat}
273273
α=d.α; β=d.β; scale=d.scale; loc=d.location
274274
< 0.1 || α > 2) && throw(DomainError(α, "α must be in the range 0.1 to 2"))
275275
abs(β) > 1 && throw(DomainError(β, "β must be in the range -1 to 1"))
@@ -370,7 +370,7 @@ function subgausscondprobtabulate(α, x1, x2_ind, invRx1, invR, vjoint, nmin, nm
370370
end
371371

372372

373-
function Random.rand!(rng::AbstractRNG, d::AlphaSubGaussian{T}, x::AbstractArray{T}) where {T<:Real}
373+
function Random.rand!(rng::AbstractRNG, d::AlphaSubGaussian{T}, x::AbstractArray{T}) where {T<:AbstractFloat}
374374
α=d.α; R=d.R; n=d.n
375375
length(x) >= n || throw(ArgumentError("length of x must be at least n"))
376376
α 1.10:0.01:1.98 || throw(DomainError(α, "α must lie within `1.10:0.01:1.98`"))

0 commit comments

Comments
 (0)