SparseSparse
SparseSparse is a Julia package for inverting sparse matrices with sparse inverses, or solving sparse linear problems with sparse right-hand-sides.
Installation
using Pkg; Pkg.add("SparseSparse")Overview
A matrix $A$ is doubly sparse if both $A$ and $A^{-1}$ are sparse. The class of doubly sparse matrices includes all matrices of the form $P(\prod B_k) Q$ where $P,Q$ are permutations and $B_k$ are block diagonal.
With stock Julia, inverting a sparse matrix throws an error. SparseSparse provides functionality to invert sparse matrices and produce sparse inverses.
Basic Usage
using LinearAlgebra, SparseArrays, SparseSparse
A = sparse([2.0 3.0 0.0 0.0
4.0 5.0 0.0 0.0
0.0 0.0 6.0 7.0
0.0 0.0 8.0 9.0])
inv(A)Module reference
Types reference
SparseSparse.Factorization — Method
function Factorization(A::SparseMatrixCSC)Compute a sparse factorization of the sparse matrix A. This returns a Factorization object F with fields F.L, F.U, F.p, F.q. The fields L and U are sparse lower and upper triangular matrices, and p and q are permutation vectors. Any of these fields can be replaced by the value missing.
Functions reference
SparseSparse.solve — Method
function solve(L::SparseMatrixCSC{Tv,Ti},B::SparseMatrixCSC{Tv,Ti};solvemode=detect,numthreads=min(B.n,nthreads())) where {Tv,Ti<:Integer}Solve L*X=B for the unknown X, where L and B are sparse matrices. L should be either lower or upper triangular. If numthreads>1 then multithreading is used. solvemode should be either lower, upper or detect.