Skip to content

Commit 99966d5

Browse files
committed
robustify types
1 parent 451ee92 commit 99966d5

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/AlphaStableDistributions.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ export AlphaStable, AlphaSubGaussian, fit
99

1010
Base.@kwdef struct AlphaStable{T} <: Distributions.ContinuousUnivariateDistribution
1111
α::T = 1.5
12-
β::T = 0.0
13-
scale::T = 1.0
14-
location::T = 0.0
12+
β::T = zero(α)
13+
scale::T = one(α)
14+
location::T = zero(α)
1515
end
1616

1717

@@ -84,7 +84,7 @@ function Distributions.fit(d::Type{<:AlphaStable}, x)
8484
if α < 0.5
8585
α = 0.5
8686
end
87-
return AlphaStable=α, scale=c, location=δ)
87+
return AlphaStable=α, β=zero(α), scale=c, location=oftype(α, δ))
8888
end
8989

9090
"""
@@ -167,7 +167,7 @@ function subgausscondprobtabulate(α, x1, x2_ind, invRx1, invR, vjoint, nmin, nm
167167
r1 = sqrt(x1'*invRx1*x1)
168168
x = SVector{length(x1)+1, Float64}(x1..., x2_ind)
169169
r = sqrt(x'*invR*x)
170-
170+
171171
if r1<nmin
172172
grad = (vjoint[m, 1]-k2[1])/nmin
173173
cons = k2[1]
@@ -181,7 +181,7 @@ function subgausscondprobtabulate(α, x1, x2_ind, invRx1, invR, vjoint, nmin, nm
181181
cons = vjoint[m, tempind[1]]-grad*rind[tempind[1]]
182182
vjointR1 = grad*r1+cons
183183
end
184-
184+
185185
if r<nmin
186186
grad = (vjoint[m+1, 1]-k2[2])/nmin
187187
cons = k2[2]

0 commit comments

Comments
 (0)