1
0
mirror of https://github.com/kalmarek/PropertyT.jl.git synced 2024-11-14 22:20:28 +01:00

FIXXX: clamp to 0 only those eps-close to 0, not < eps

This commit is contained in:
kalmar 2017-07-26 12:12:58 +02:00
parent 33b45dd518
commit 3ff649683a

View File

@ -58,7 +58,7 @@ dens(M::AbstractArray) = sum(abs.(M) .!= 0)/length(M)
function sparsify{T}(U::AbstractArray{T}, check=true)
W = deepcopy(U)
W[W .< eps(T)] .= zero(T)
W[abs.(W) .< eps(T)] .= zero(T)
if check && rank(W) != rank(U)
info("Sparsification would decrease the rank!")
W = U