pablosanjose / Elsa.jl

Efficient lattice simulation algorithms - a Julia library
Other
18 stars 2 forks source link

Column sorting in SparseMatrixBuilder #8

Closed pablosanjose closed 5 years ago

pablosanjose commented 5 years ago

Addresses #7 by sorting columns as they are added in the grow algorithm. This is done by leveraging the quicksort algorithm of sort!(::Vector{<:Number}), which makes no allocations, but applied to the joint rowval, nzval of SparseMatrixBuilder through a custom type CoSort. It's all rather clever and elegant, but it still introduces a 7% performance penalty of column sorting in grow. The advantage in linear algebra operations of sorted sparse columns seems non-existant.