diff --git a/src/Orbit-wise.jl b/src/Orbit-wise.jl index fa131a3..f1d385c 100644 --- a/src/Orbit-wise.jl +++ b/src/Orbit-wise.jl @@ -53,11 +53,10 @@ end include("OrbitDecomposition.jl") -function sparsify{T}(U::Array{T}, eps=eps(T)) - n = rank(U) +function sparsify{T}(U::AbstractArray{T}, eps=eps(T), check=true) W = deepcopy(U) W[abs.(W) .< eps] = zero(T) - if rank(W) != n + if check && rank(W) != rank(U) warn("Sparsification would decrease the rank!") W = U end @@ -66,14 +65,6 @@ function sparsify{T}(U::Array{T}, eps=eps(T)) return W end -function sparsify!{T}(U::SparseMatrixCSC{T}, eps=eps(T)) - U[abs.(U) .< eps] = zero(T) - dropzeros!(U) - return U -end - -sparsify{T}(U::SparseMatrixCSC{T}, eps=eps(T)) = sparsify!(deepcopy(U), eps) - function init_orbit_data(logger, sett::Settings; radius=2) ex(fname) = isfile(joinpath(sett.name, fname))