SparseExtra
SparseExtra.jl is a a series of helper function useful for dealing with sparse matrix, random walk, and shortest path on sparse graphs and some more. Most of this was developed for an unpublished paper which would help explain some of the design choises.
SparseExtra
SparseExtra.par_solve_f! — Functionlike par_solve but use f and g to create the column (and then destroy it).
SparseExtra.skip_row_to — Functionskip_row_to(::IterateNZ, ::S, i) -> SMove the cursor to the bottom of the i-1th element. Does nothing by default and only makes sense for matrices.
SparseExtra.extract_path — Functionextract_path(::DijkstraState{T, U}, d) -> U[]return the path found to d.
SparseExtra.skip_col — Functionskip_col(::IterateNZ, ::S) -> SMove the cursor to the bottom of the current column. Does nothing by default and only makes sense for matrices.
SparseExtra.IterateNZ — TypeHelper structure for iternz, all methods. iternz just returns this wrapper and the Base.iterate method is overloaded.
SparseExtra.path_cost — Functionpath_cost(::AbstractSparseMatrixCSC, r, n)return the total weight of the path r[1:n]
path_cost(f::Function, ::AbstractSparseMatrixCSC, r, n)return the total weight of the path r[1:n], with f applied to each weight before summation
SparseExtra.GenericSparseMatrixCSC — TypeLike SparseMatrixCSC but allows any container for the vectors tho they should all be Dense 1-indexed Vectors
SparseExtra.path_cost_nt — Functionpath_cost_nt(::AbstractSparseMatrixCSC, r, n)like path_cost, but for matrices that are transposed
path_cost_nt(f::Function, ::AbstractSparseMatrixCSC, r, n)like path_cost, but for matrices that are transposed
SparseExtra.DijkstraState — TypeWork structure for `dijkstra`SparseExtra.Path2Edge — TypePath2Edge(x, [e=length(x)])[Unbenchmarked] faster version of zip(view(x, 1:e), view(x, 2:e)). Only works on 1-index based arrays with unit strides
SparseExtra.par_solve! — Functionldiv! but in parallel. use colsto skip columns andf(col, index)` to apply a thread safe function to that column.
SparseExtra.dijkstra — Functiondijkstra(distmx::AbstractSparseMatrixCSC, state::DijkstraState, [target]) -> NothingGiven a distmx such that distmx[j, i] is the distance of the arc i→j and strucutral zeros mean no arc, run the dijkstra algorithm until termination or reaching target (whichever happens first).
SparseExtra.iternz — Function`iternz(x)`shortcut for IterateNZ.
SparseExtra.par_inv! — Functionreturn lu \ I