Skip to content

Commit 6ae03d8

Browse files
committed
fix zero allocations in diagnostics
1 parent 109a142 commit 6ae03d8

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/diagnostics.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ Computational Statistics & Data Analysis 43.4 (2003): 541-552.
4545
function euclideanDistances(dataMatrix::AbstractMatrix{Float64})::AbstractMatrix{Float64}
4646
n = size(dataMatrix, 1)
4747
d = Array{Float64, 2}(undef, n, n)
48+
fill!(d, 0.0)
4849
for i 1:n
4950
for j i:n
5051
if i != j
@@ -60,7 +61,7 @@ end
6061

6162
function mahalanobisSquaredBetweenPairs(pairs::AbstractMatrix{Float64}; covmatrix = nothing)::Union{Nothing, AbstractMatrix}
6263
n = size(pairs, 1)
63-
newmat = Array{Float64, 2}(undef, n, n)
64+
newmat = zeros(n, n)
6465
if isnothing(covmatrix)
6566
covmatrix = cov(pairs)
6667
end

0 commit comments

Comments
 (0)