Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix uses of sumabs2, abs2 and abs in docstrings #801

Merged
merged 1 commit into from
Jun 21, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/deviation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ end
sqL2dist(a, b)

Compute the squared L2 distance between two arrays: ``\\sum_{i=1}^n |a_i - b_i|^2``.
Efficient equivalent of `sumabs2(a - b)`.
Efficient equivalent of `sum(abs2, a - b)`.
"""
function sqL2dist(a::AbstractArray{T}, b::AbstractArray{T}) where T<:Number
n = length(a)
Expand All @@ -62,7 +62,7 @@ end
L2dist(a, b)

Compute the L2 distance between two arrays: ``\\sqrt{\\sum_{i=1}^n |a_i - b_i|^2}``.
Efficient equivalent of `sqrt(sumabs2(a - b))`.
Efficient equivalent of `sqrt(sum(abs2, a - b))`.
"""
L2dist(a::AbstractArray{T}, b::AbstractArray{T}) where {T<:Number} = sqrt(sqL2dist(a, b))

Expand Down Expand Up @@ -135,7 +135,7 @@ end
"""
meanad(a, b)

Return the mean absolute deviation between two arrays: `mean(abs(a - b))`.
Return the mean absolute deviation between two arrays: `mean(abs, a - b)`.
"""
meanad(a::AbstractArray{T}, b::AbstractArray{T}) where {T<:Number} =
L1dist(a, b) / length(a)
Expand All @@ -154,7 +154,7 @@ maxad(a::AbstractArray{T}, b::AbstractArray{T}) where {T<:Number} = Linfdist(a,
"""
msd(a, b)

Return the mean squared deviation between two arrays: `mean(abs2(a - b))`.
Return the mean squared deviation between two arrays: `mean(abs2, a - b)`.
"""
msd(a::AbstractArray{T}, b::AbstractArray{T}) where {T<:Number} =
sqL2dist(a, b) / length(a)
Expand Down