Skip to content

Commit

Permalink
compat with v1.1.4 EKP
Browse files Browse the repository at this point in the history
  • Loading branch information
odunbar committed Nov 3, 2023
1 parent 1709d21 commit 100eba3
Showing 1 changed file with 0 additions and 28 deletions.
28 changes: 0 additions & 28 deletions src/Utilities.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export get_training_points
export get_obs_sample
export orig2zscore
export zscore2orig
export posdef_correct
"""
$(DocStringExtensions.TYPEDSIGNATURES)
Expand Down Expand Up @@ -120,31 +119,4 @@ function zscore2orig(Z::AbstractMatrix{FT}, mean::AbstractVector{FT}, std::Abstr
return X
end


"""
$(DocStringExtensions.TYPEDSIGNATURES)
Makes square matrix `mat` positive definite, by symmetrizing and bounding the minimum eigenvalue below by `tol`
"""
function posdef_correct(mat::AbstractMatrix; tol::Real = 1e8 * eps())
if !issymmetric(mat)
out = 0.5 * (mat + permutedims(mat, (2, 1))) #symmetrize
if isposdef(out)
# very often, small numerical errors cause asymmetry, so cheaper to add this branch
return out
end
else
out = mat
end

nugget = abs(minimum(eigvals(out)))
for i in 1:size(out, 1)
out[i, i] += nugget + tol #add to diag
end
return out
end




end # module

0 comments on commit 100eba3

Please sign in to comment.