Skip to content

Commit 3222471

Browse files
committed
fix: scale -> sc to avoid naming conflicts
1 parent ee9c057 commit 3222471

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/AlphaStableDistributions.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -467,10 +467,10 @@ with memory", Signal Processing, Volume 131, Pages 271-279, 2017.
467467
"""
468468
function Distributions.fit(d::Type{<:AlphaSubGaussian}, x::AbstractVector{T}, m::Integer; p=one(T)) where T
469469
d1 = fit(AlphaStable, x)
470-
α = d1.α; scale=d1.scale
470+
α = d1.α; sc=d1.scale
471471
cov = zeros(T, m+1, m+1)
472472
xlen = length(x)
473-
c = ((sum(x->abs(x)^p, x)/xlen)^(1/p))/scale
473+
c = ((sum(x->abs(x)^p, x)/xlen)^(1/p))/sc
474474
for i in 1:m
475475
tempxlen = xlen-mod(xlen, i)
476476
xtemp = reshape(x[1:end-mod(xlen, i)], i, tempxlen÷i)
@@ -479,11 +479,11 @@ function Distributions.fit(d::Type{<:AlphaSubGaussian}, x::AbstractVector{T}, m:
479479
tempxlen = size(xtemp, 1)*size(xtemp, 2)
480480
end
481481
xtemp = reshape(xtemp', 2, tempxlen÷2)
482-
@views r = (2/(c^p))*(scale^(2-p))*(xtemp[1, :]'*((sign.(xtemp[2, :]).*(abs.(xtemp[2, :]).^(p-1)))))/(tempxlen/2)
482+
@views r = (2/(c^p))*(sc^(2-p))*(xtemp[1, :]'*((sign.(xtemp[2, :]).*(abs.(xtemp[2, :]).^(p-1)))))/(tempxlen/2)
483483
cov[diagind(cov, i)] .+= r
484484
end
485-
cov = (cov+cov')+2*(scale^2)*I(m+1)
486-
cov ./= 2*scale^2
485+
cov = (cov+cov')+2*(sc^2)*I(m+1)
486+
cov ./= 2*sc^2
487487
AlphaSubGaussian=α, R=cov, n=length(x))
488488
end
489489

0 commit comments

Comments
 (0)