mirror of
https://github.com/kalmarek/PropertyT.jl.git
synced 2025-02-17 02:30:54 +01:00
another sparsify
This commit is contained in:
parent
c0e2577684
commit
e648d2c370
@ -140,6 +140,19 @@ function Cstar_repr(x::GroupRingElem, mreps)
|
|||||||
return res
|
return res
|
||||||
end
|
end
|
||||||
|
|
||||||
|
dens(M::SparseMatrixCSC) = length(M.nzval)/length(M)
|
||||||
|
dens(M::AbstractArray) = sum(abs.(M) .!= 0)/length(M)
|
||||||
|
|
||||||
|
function sparsify2(M::AbstractArray)
|
||||||
|
println("Density before sparsification: \t$(dens(M))")
|
||||||
|
M = deepcopy(M)
|
||||||
|
M[M .< eps(eltype(M))] .= zero(eltype(M))
|
||||||
|
M = sparse(M)
|
||||||
|
dropzeros!(M)
|
||||||
|
println("Density after sparsification: \t$(dens(M))")
|
||||||
|
return M
|
||||||
|
end
|
||||||
|
|
||||||
function orthSVD(M::AbstractMatrix)
|
function orthSVD(M::AbstractMatrix)
|
||||||
M = full(M)
|
M = full(M)
|
||||||
fact = svdfact(M)
|
fact = svdfact(M)
|
||||||
|
Loading…
Reference in New Issue
Block a user