Skip to content

Latest commit

 

History

History
41 lines (29 loc) · 2.79 KB

File metadata and controls

41 lines (29 loc) · 2.79 KB

SparseBandedMatrices

Join the chat at https://julialang.zulipchat.com #sciml-bridged Stable Documentation Dev Documentation

CI codecov Package Downloads Aqua QA

ColPrac: Contributor's Guide on Collaborative Practices for Community Packages SciML Code Style

A fast implementation of Sparse Banded Matrices in Julia. Primarily developed for use in a Butterfly LU factorization implemented in RecursiveFactorization.jl and LinearSolve.jl.

Examples

using SparseBandedMatrices

# Create an empty 5×5 sparse banded matrix
A = SparseBandedMatrix{Float64}(undef, 5, 5)
A[1,1] = 5.0

# Set a lower diagonal with the values [3.0, 4.0, 5.0]
setdiagonal!(A, [3.0, 4.0, 5.0], true)

# Create a matrix with pre-specified diagonals
# This creates a 6×6 matrix with diagonals at indices 1 and 8
B = SparseBandedMatrix{Float64}([1, 8], [[3.0], [-2.0, 5.0, 1.0, 3.0]], 6, 6)

Design Considerations

The implementation of SparseBandedMatrices is designed to be fast for matrix-matrix and matrix-vector multiplications. The sparse banded structure provides significant performance advantages when working with matrices that have a limited number of non-zero diagonals, which commonly arise in:

  • Butterfly LU factorizations (see RecursiveFactorization.jl)
  • Linear system solving (see LinearSolve.jl)
  • Finite difference discretizations
  • Other sparse linear algebra problems with banded structure