Euclidean Sheaves

The EuclideanSheaves module defines the EuclideanSheaf type and the core linear‑algebraic functions used throughout the library. Below are the primary exported symbols.

CellularSheaves.NetworkSheaves.EuclideanSheaves.cycle_sheafMethod
cycle_sheaf(n::Int, stalk_dim::Int, rm_pair_fn::Function) -> EuclideanSheaf{Float64}

Construct an EuclideanSheaf on the n-vertex cycle graph where each vertex stalk has dimension stalk_dim. For edge k (in graph iteration order) the pair of restriction maps (rm_src, rm_dst) is produced by calling rm_pair_fn(n, stalk_dim, k).

source
CellularSheaves.NetworkSheaves.EuclideanSheaves.harmonic_extensionMethod
harmonic_extension(s::EuclideanSheaf, boundary::Dict{Int,<:AbstractVector})
    -> (BlockVector, Matrix)

Compute the harmonic extension of boundary over the interior vertices of s.

boundary maps each boundary vertex index to a vector of length s.vertex_stalks[v].

Returns (x_p, null_basis) where:

  • x_p is the minimum-norm particular solution as a BlockArray over s.vertex_stalks
  • null_basis is a matrix whose columns span the solution's indeterminate directions, embedded in the full cochain space (zero at boundary dofs). Has 0 columns when the boundary conditions uniquely determine the harmonic extension.

The complete solution set is { x_p + null_basis * c : c ∈ Rᵏ } where k = size(null_basis, 2).

Throws ArgumentError if any boundary vector has the wrong length for its stalk.

source
CellularSheaves.NetworkSheaves.EuclideanSheaves.harmonic_extension_ldl_diagnosticsMethod
harmonic_extension_ldl_diagnostics(s::EuclideanSheaf,
                                   boundary::Dict{Int,<:AbstractVector};
                                   tol=nothing)
    -> HarmonicExtensionLDLDiagnostics

Compute LDL-based diagnostics for the restricted Laplacian L_II used by harmonic_extension for the boundary data boundary.

The boundary and interior vertex sets are exactly those induced by the harmonic extension problem: boundary fixes the boundary vertices and the remaining vertices are treated as interior. The diagnostics are computed from the sparse ChordalLDLt factorization of L_II with RowMaximum pivoting, matching the solver path used internally by harmonic_extension.

Returns a HarmonicExtensionLDLDiagnostics struct. Its fields expose the same partition metadata and pivot summary used internally, and its text/plain show method prints a structured diagnostic table.

When L_II is empty (no interior degrees of freedom), the returned arrays are empty and the rank/nullity estimates are both zero.

source
CellularSheaves.NetworkSheaves.EuclideanSheaves.harmonic_extension_svd_diagnosticsMethod
harmonic_extension_svd_diagnostics(s::EuclideanSheaf,
                                   boundary::Dict{Int,<:AbstractVector};
                                   tol=nothing)
    -> HarmonicExtensionSVDDiagnostics

Compute SVD-based diagnostics for the restricted Laplacian L_II used by harmonic_extension for the boundary data boundary.

The interface matches harmonic_extension_ldl_diagnostics. The return value is a HarmonicExtensionSVDDiagnostics struct with the same partition metadata, plus singular-value-specific diagnostics and a formatted show method for interactive inspection.

When L_II is empty (no interior degrees of freedom), the singular-value arrays are empty and the condition numbers are reported as Inf.

source
CellularSheaves.NetworkSheaves.EuclideanSheaves.nullspace_ldltMethod
nullspace_ldlt(X::AbstractMatrix; tol=nothing) -> Matrix

Compute a basis for the nullspace of the symmetric positive-semidefinite matrix X using a sparse LDLt factorisation from CliqueTrees.Multifrontal (ChordalLDLt with RowMaximum pivoting).

The factorisation is $X = P^\mathsf{T} L D L^\mathsf{T} P$. Columns of D whose absolute diagonal value is at or below tol (default: $\sqrt{\varepsilon_\text{Float64}} \times \max(1, \|D\|_\infty)$) identify null directions; the corresponding columns of P^{-1} (L^\mathsf{T})^{-1} form the returned basis matrix.

source
CellularSheaves.NetworkSheaves.EuclideanSheaves.nullspace_ldltMethod
nullspace_ldlt(s::EuclideanSheaf; tol=nothing) -> Matrix

Convenience overload: computes the sheaf Laplacian $L = d^\mathsf{T} d$ (where $d$ is the coboundary map of s) and delegates to nullspace_ldlt(L).

The returned columns form a basis for the space of global sections of s.

source
CellularSheaves.NetworkSheaves.EuclideanSheaves.restricted_laplacian_blocksMethod
restricted_laplacian_blocks(s::EuclideanSheaf,
                            interior::AbstractVector{Int},
                            boundary::AbstractVector{Int})
    -> (L_II::SparseMatrixCSC, L_IB::SparseMatrixCSC)

Compute the interior-interior and interior-boundary blocks of the sheaf Laplacian without assembling the full Laplacian.

interior and boundary are disjoint vectors of vertex indices (any order). Only edges with at least one interior endpoint contribute.

  • L_II is the $(\sum_{v \in I} d_v) \times (\sum_{v \in I} d_v)$ symmetric positive-semidefinite block.
  • L_IB is the $(\sum_{v \in I} d_v) \times (\sum_{v \in B} d_v)$ interior-boundary coupling block.

The DOF ordering within each block follows the order of interior / boundary. Edges entirely within the boundary subgraph are skipped, so assembly cost is $O(|E_I| \cdot d_{\max}^2)$ where $E_I$ is the set of edges with at least one interior endpoint.

source
CellularSheaves.NetworkSheaves.EuclideanSheaves.sheaf_laplacian_matrix_directMethod
sheaf_laplacian_matrix_direct(s::EuclideanSheaf) -> SparseMatrixCSC

Assemble the sheaf Laplacian $L = d^\mathsf{T} d$ directly from the restriction maps of s, without forming the coboundary matrix $d$.

For each edge $e = (u, v)$ the following block contributions are accumulated:

L_{u,u} += ρ_{u→e}^T ρ_{u→e}
L_{v,v} += ρ_{v→e}^T ρ_{v→e}
L_{u,v} += -ρ_{u→e}^T ρ_{v→e}
L_{v,u} += -ρ_{v→e}^T ρ_{u→e}

This avoids constructing the $(\sum d_e) \times (\sum d_v)$ coboundary matrix and the subsequent matrix multiply, saving both time and memory for large sheaves. The result is numerically identical to sheaf_laplacian_matrix.

source
CellularSheaves.NetworkSheaves.SheafInterface.add_sheaf_edge!Method

addsheafedge!(s::EuclideanSheaf, v1::Int, v2::Int, rm1, rm2)

Add an edge between vertices v1 and v2 with restriction maps rm1 and rm2. rm1 is the restriction map from vertex v1 to the edge and rm2 is the restriction map from vertex v2 to the edge.

Both rm1 and rm2 may be any AbstractMatrix (e.g. Matrix, Diagonal, SparseMatrixCSC); they are converted to Matrix{T} when stored.

source