Q-Distance Matrix Compression

Documentation for QDistanceMatrixCompression.

\[\begin{aligned} L_{n-1} &= C C^\top \\ L_{n-1}^{-1} &= C^{-\top} C^{-1} \\ L_{n-1}^{-1} b_q &= C^{-\top} C^{-1} b_q \\ \end{aligned}\]

This is why we do C \ b_q.

QDistanceMatrixCompression.GraphicalDistanceMatrixType
GraphicalDistanceMatrix{T<:Real}

A structure representing a graphical distance matrix computed from a graph. This specialized matrix type allows efficient storage and computation of resistance distances, similar to how ToeplitzMatrices.jl defines specialized matrices.

Fields

  • graph::SimpleGraph: The underlying graph
  • matrix::Matrix{T}: The precomputed resistance distance matrix (can be lazily evaluated)
  • algorithm::Symbol: The algorithm used to compute resistance distances (:naive, :vectorized, :backsolve, :sparse, :compact)
  • computed::Bool: Whether the matrix has been computed

Examples

using GraphicalDistance, Graphs
g = barabasi_albert(100, 5)
R = GraphicalDistanceMatrix(g)
# Access as a standard matrix
R[1, 2]
# Or compute on demand using a specific algorithm
R = GraphicalDistanceMatrix(g, :compact)
source
QDistanceMatrixCompression.spsolveFunction
spsolve(A::SparseMatrixCSC, B::SparseMatrixCSC) -> SparseMatrixCSC

Solve the system AX = B where A is a lower triangular sparse matrix (SparseMatrixCSC) and B is a sparse matrix (SparseMatrixCSC) representing the right-hand side.

Arguments

  • A::SparseMatrixCSC: A lower triangular sparse matrix.
  • B::SparseMatrixCSC: A sparse matrix representing the right-hand side.

Returns

  • X::SparseMatrixCSC: The solution matrix in sparse format.

Notes

  • Assumes that A is lower triangular and non-singular.
source