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
1 changed files with 1 additions and 1 deletions

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