Skip to content

Commit 8748b98

Browse files
committed
Allow specification of sorting alg
Using ThreadsX.QuickSort gives about 2x performance improvement using 4 threads
1 parent 6112a12 commit 8748b98

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/AlphaStableDistributions.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ Fit a symmetric α stable distribution to data.
6666
c is computed based on Fama & Roll (1971) fractile.
6767
δ is the 50% trimmed mean of the sample.
6868
"""
69-
function Distributions.fit(d::Type{<:AlphaStable}, x)
70-
sx = sort(x)
69+
function Distributions.fit(d::Type{<:AlphaStable}, x, alg=QuickSort)
70+
sx = sort(x, alg=alg)
7171
δ = mean(@view(sx[end÷4:(3*end)÷4]))
7272
p = quantile.(Ref(sx), (0.05, 0.25, 0.28, 0.72, 0.75, 0.95), sorted=true)
7373
c = (p[4]-p[3])/1.654

0 commit comments

Comments
 (0)