mirror of
https://github.com/kalmarek/PropertyT.jl.git
synced 2024-09-18 09:38:00 +02:00
FIXXX: clamp to 0 only those eps-close to 0, not < eps
This commit is contained in:
parent
33b45dd518
commit
3ff649683a
@ -58,7 +58,7 @@ dens(M::AbstractArray) = sum(abs.(M) .!= 0)/length(M)
|
|||||||
|
|
||||||
function sparsify{T}(U::AbstractArray{T}, check=true)
|
function sparsify{T}(U::AbstractArray{T}, check=true)
|
||||||
W = deepcopy(U)
|
W = deepcopy(U)
|
||||||
W[W .< eps(T)] .= zero(T)
|
W[abs.(W) .< eps(T)] .= zero(T)
|
||||||
if check && rank(W) != rank(U)
|
if check && rank(W) != rank(U)
|
||||||
info("Sparsification would decrease the rank!")
|
info("Sparsification would decrease the rank!")
|
||||||
W = U
|
W = U
|
||||||
|
Loading…
Reference in New Issue
Block a user