Home

Awesome

BlockBandedMatrices.jl

A Julia package for representing block-banded matrices and banded-block-banded matrices

Build Status codecov Aqua QA version deps pkgeval

This package supports representing block-banded and banded-block-banded matrices by only storing the entries in the non-zero bands.

A BlockBandedMatrix is a subtype of BlockMatrix of BlockArrays.jl whose layout of non-zero blocks is banded. We can construct a BlockBandedMatrix as follows:

using FillArrays, LinearAlgebra
l,u = 2,1          # block bandwidths
N = M = 4          # number of row/column blocks
cols = rows = 1:N  # block sizes

BlockBandedMatrix(Zeros(sum(rows),sum(cols)), rows,cols, (l,u)) # creates a block-banded matrix of zeros
BlockBandedMatrix(Ones(sum(rows),sum(cols)), rows,cols, (l,u)) # creates a block-banded matrix with ones in the non-zero entries
BlockBandedMatrix(I, rows,cols, (l,u))                          # creates a block-banded  identity matrix

A BandedBlockBandedMatrix has the added structure that the blocks themselves are banded, and conform to the banded matrix interface of BandedMatrices.jl. We can construct a BandedBlockBandedMatrix as follows:

using FillArrays, LinearAlgebra
l,u = 2,1          # block bandwidths
λ,μ = 1,2          # sub-block bandwidths: the bandwidths of each block
N = M = 4          # number of row/column blocks
cols = rows = 1:N  # block sizes

BandedBlockBandedMatrix(Zeros(sum(rows),sum(cols)), rows,cols, (l,u), (λ,μ)) # creates a banded-block-banded matrix of zeros
BandedBlockBandedMatrix(Ones(sum(rows),sum(cols)), rows,cols, (l,u), (λ,μ))  # creates a banded-block-banded matrix with ones in the non-zero entries
BandedBlockBandedMatrix(I, rows,cols, (l,u), (λ,μ))                          # creates a banded-block-banded identity matrix