Skip to content

Commit 2701a9c

Browse files
Add docstrings
1 parent d2c019a commit 2701a9c

File tree

1 file changed

+108
-0
lines changed

1 file changed

+108
-0
lines changed

src/vstats.jl

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,35 +224,143 @@ end
224224
################
225225
# Deviations
226226

227+
"""
228+
vcounteq(x::AbstractArray, y::AbstractArray; dims=:)
229+
230+
Count the number of elements for which `xᵢ == yᵢ` returns `true` on the vectors
231+
corresponding to the slices along the dimension `dims`.
232+
233+
See also: [`vcountne`](@ref)
234+
"""
227235
vcounteq(x, y; dims=:) = vvmapreduce(==, +, x, y, dims=dims)
236+
237+
"""
238+
vtcounteq(x::AbstractArray, y::AbstractArray; dims=:)
239+
240+
Count the number of elements for which `xᵢ == yᵢ` returns `true` on the vectors
241+
corresponding to the slices along the dimension `dims`. Threaded.
242+
243+
See also: [`vtcountne`](@ref)
244+
"""
228245
vtcounteq(x, y; dims=:) = vtmapreduce(==, +, x, y, dims=dims)
246+
247+
"""
248+
vcountne(x::AbstractArray, y::AbstractArray; dims=:)
249+
250+
Count the number of elements for which `xᵢ != yᵢ` returns `true` on the vectors
251+
corresponding to the slices along the dimension `dims`.
252+
253+
See also: [`vcounteq`](@ref)
254+
"""
229255
vcountne(x, y; dims=:) = vvmapreduce(!=, +, x, y, dims=dims)
256+
257+
"""
258+
vtcountne(x::AbstractArray, y::AbstractArray; dims=:)
259+
260+
Count the number of elements for which `xᵢ != yᵢ` returns `true` on the vectors
261+
corresponding to the slices along the dimension `dims`. Threaded.
262+
263+
See also: [`vtcounteq`](@ref)
264+
"""
230265
vtcountne(x, y; dims=:) = vtmapreduce(!=, +, x, y, dims=dims)
231266

267+
"""
268+
vmeanad(x::AbstractArray, y::AbstractArray; dims=:)
269+
270+
Compute the mean absolute deviation between the vectors corresponding to the slices along
271+
the dimension `dims`.
272+
273+
See also: [`vmaxad`](@ref)
274+
"""
232275
function vmeanad(x, y; dims=:)
233276
c = 1 / _denom(x, dims)
234277
vmapreducethen((xᵢ, yᵢ) -> abs(xᵢ - yᵢ) , +, z -> c * z, x, y, dims=dims)
235278
end
279+
280+
"""
281+
vtmeanad(x::AbstractArray, y::AbstractArray; dims=:)
282+
283+
Compute the mean absolute deviation between the vectors corresponding to the slices along
284+
the dimension `dims`. Threaded.
285+
286+
See also: [`vtmaxad`](@ref)
287+
"""
236288
function vtmeanad(x, y; dims=:)
237289
c = 1 / _denom(x, dims)
238290
vtmapreducethen((xᵢ, yᵢ) -> abs(xᵢ - yᵢ) , +, z -> c * z, x, y, dims=dims)
239291
end
240292

293+
"""
294+
vmaxad(x::AbstractArray, y::AbstractArray; dims=:)
295+
296+
Compute the maximum absolute deviation between the vectors corresponding to the slices along
297+
the dimension `dims`.
298+
299+
See also: [`vmeanad`](@ref)
300+
"""
241301
vmaxad(x, y; dims=:) = vvmapreduce((xᵢ, yᵢ) -> abs(xᵢ - yᵢ) , max, x, y, dims=dims)
302+
303+
"""
304+
vtmaxad(x::AbstractArray, y::AbstractArray; dims=:)
305+
306+
Compute the maximum absolute deviation between the vectors corresponding to the slices along
307+
the dimension `dims`. Threaded.
308+
309+
See also: [`vtmeanad`](@ref)
310+
"""
242311
vtmaxad(x, y; dims=:) = vtmapreduce((xᵢ, yᵢ) -> abs(xᵢ - yᵢ) , max, x, y, dims=dims)
243312

313+
"""
314+
vmse(x::AbstractArray, y::AbstractArray; dims=:)
315+
316+
Compute the mean squared error between the vectors corresponding to the slices along
317+
the dimension `dims`.
318+
319+
See also: [`vrmse`](@ref)
320+
"""
244321
function vmse(x, y; dims=:)
245322
c = 1 / _denom(x, dims)
246323
vmapreducethen((xᵢ, yᵢ) -> abs2(xᵢ - yᵢ) , +, z -> c * z, x, y, dims=dims)
247324
end
325+
326+
"""
327+
vtmse(x::AbstractArray, y::AbstractArray; dims=:)
328+
329+
Compute the mean squared error between the vectors corresponding to the slices along
330+
the dimension `dims`. Threaded.
331+
332+
See also: [`vtrmse`](@ref)
333+
"""
248334
function vtmse(x, y; dims=:)
249335
c = 1 / _denom(x, dims)
250336
vtmapreducethen((xᵢ, yᵢ) -> abs2(xᵢ - yᵢ) , +, z -> c * z, x, y, dims=dims)
251337
end
338+
339+
"""
340+
vrmse(x::AbstractArray, y::AbstractArray; dims=:)
341+
342+
Compute the square root of the mean squared error between the vectors corresponding
343+
to the slices along the dimension `dims`. More efficient than `sqrt.(vmse(...))`
344+
as the `sqrt` operation is performed at the point of generation, thereby eliminating the
345+
full traversal which would otherwise occur.
346+
347+
See also: [`vmse`](@ref)
348+
"""
252349
function vrmse(x, y; dims=:)
253350
c = 1 / _denom(x, dims)
254351
vmapreducethen((xᵢ, yᵢ) -> abs2(xᵢ - yᵢ) , +, z -> (c * z), x, y, dims=dims)
255352
end
353+
354+
"""
355+
vtrmse(x::AbstractArray, y::AbstractArray; dims=:)
356+
357+
Compute the square root of the mean squared error between the vectors corresponding
358+
to the slices along the dimension `dims`. More efficient than `sqrt.(vmse(...))`
359+
as the `sqrt` operation is performed at the point of generation, thereby eliminating the
360+
full traversal which would otherwise occur. Threaded.
361+
362+
See also: [`vtmse`](@ref)
363+
"""
256364
function vtrmse(x, y; dims=:)
257365
c = 1 / _denom(x, dims)
258366
vtmapreducethen((xᵢ, yᵢ) -> abs2(xᵢ - yᵢ) , +, z -> (c * z), x, y, dims=dims)

0 commit comments

Comments
 (0)