MathUtils.jl
PopGenCore.jl/src/Utils/MathUtils.jl
📦 not exported | 🟪 exported by PopGenCore.jl | 🔵 exported by PopGen.jl |
---|
🟪 countnonzeros
countnonzeros(x::AbstractVector{T}) where T<:Real
Return the number of non-zero values in a vector
🟪 reciprocal
reciprocal(num::T) where T <: Signed
Returns the reciprocal (1/number) of a number. Will return 0
when
the number is 0
instead of returning Inf
.
🟪 reciprocalsum
reciprocalsum(x::AbstractVector{T}) where T<:Real
Return the sum of the reciprocal values of x
, skipping the Inf
values
resulting from divide-by-zero errors.