SupernodalMatrix API
For supernodal Cholesky factorizations, SupernodalMatrix
stores the output of selinv
. This subtype of AbstractMatrix
allows for a more efficient memory access tailored to supernodal representations.
While you can just use it like a regular AbstractMatrix
(i.e. you can get its size and index into it as you would expect), you might be interested in more specialized methods.
Fields and construction
SelectedInversion.SupernodalMatrix
— TypeSupernodalMatrix
Represents a sparse block lower triangular matrix with a supernodal layout. A supernode is a set of contiguous columns with identical sparsity pattern below the triangular block at the top. For each supernode, the corresponding nonzero entries are stored in a dense chunk. This enables us to use BLAS for operations on these chunks, so we combine the strengths of sparse and dense matrices.
Fields
N::Int
: Number of rowsM::Int
: Number of columnsn_super::Int
: Number of supernodessuper_to_col::Vector{Int}
: Start/end column of each supernode. Lengthn_super + 1
.col_to_super::Vector{Int}
: Maps each column to its supernode index. LengthM
.super_to_vals::Vector{Int}
: Start/end indices of each supernode intovals
. Lengthn_super + 1
.super_to_rows::Vector{Int}
: Start/end indices of each supernode intorows
. Lengthn_super + 1
.vals::Vector{Float64}
: Nonzero values.rows::Vector{Int}
: Row indices. CAREFUL: These are zero-indexed!max_super_rows::Int
: Maximum number of rows below the triangular block in a supernode chunk.transposed_chunks::Bool
: Whether to store the transpose of chunks, such that the first axis in the chunk corresponds to the columns in the supernode.symmetric_access::Bool
: Whether to enforce symmetry when accessing entries.invperm::Vector{Int}
: Permutation to apply before accessing entries whendepermuted_access == true
.depermuted_access::Bool
: Whether to apply an inverse permutation before accessing entries.
SelectedInversion.SupernodalMatrix
— MethodSupernodalMatrix(
F::SparseArrays.CHOLMOD.Factor;
transpose_chunks = false,
symmetric_access = false,
depermuted_access = false,
)
Construct a SupernodalMatrix
from a supernodal Cholesky factorization.
Keyword arguments are explained in the SupernodalMatrix
docstring.
Methods
SelectedInversion.val_range
— Functionval_range(S::SupernodalMatrix, sup_idx::Int)
Get the range of indices of supernode sup_idx
into S.vals
.
SelectedInversion.col_range
— Functioncol_range(S::SupernodalMatrix, sup_idx::Int)
Get the range of columns of supernode sup_idx
.
SelectedInversion.get_rows
— Functionget_rows(S::SupernodalMatrix, sup_idx::Int)
Get the row indices corresponding to supernode sup_idx
. CAREFUL: These are zero-indexed!
SelectedInversion.get_row_col_idcs
— Functionget_row_col_idcs(S::SupernodalMatrix, sup_idx::Int)
Get the row and column indices corresponding to supernode sup_idx
. Both sets of indices are one-indexed.
SelectedInversion.get_max_sup_size
— Functionget_max_sup_size(S::SupernodalMatrix)
Get the maximum number of columns of any supernode.
SelectedInversion.get_Sj
— Functionget_Sj(S::SupernodalMatrix, sup_idx::Int)
Get the row indices below the triangular block of supernode sup_idx
. CAREFUL: These are zero-indexed!
SelectedInversion.partition_Sj
— Functionpartition_Sj(S::SupernodalMatrix, Sj)
Partition the output of get_Sj
into contiguous subsets where each subset is fully contained in one supernode.
SelectedInversion.get_chunk
— Functionget_chunk(S::SupernodalMatrix, sup_idx::Int)
Get the dense chunk corresponding to supernode sup_idx
. Includes the triangular block at the top.
SelectedInversion.get_split_chunk
— Functionget_split_chunk(S::SupernodalMatrix, sup_idx::Int)
Get the chunk corresponding to supernode sup_idx
, split into the diagonal / lower triangular block at the top, and the remaining block below it.