How statement and proof provenance work
The first chip identifies the source of the statement or construction; the second identifies the source of its local proof or verification.
- Literature-sourced: the exact statement appears in a cited source; only wording and notation differ.
- AI-adapted: a semantically identical restatement of literature-sourced material, modulo indexing, notation, and boundary cases adopted by the library.
- AI-generated: a genuinely novel statement formulated by AI, with no source for the claim itself.
These labels describe origin, not correctness: citations and verification chips remain separate evidence.
Sparse matrix models and kernel costs
1 · Prerequisites
- Binary Operations, Monoids, Groups and Subgroups
- Construction of the Natural Numbers
- Construction of the Real Numbers via Cauchy Sequences
- Construction of the Real Numbers via Dedekind Cuts
- Countability and Uncountability
- Finite Counting, Factorials and Binomial Coefficients
- Foundations of the Real Numbers for Analysis
- Matrices, the Matrix of a Linear Map, and Change of Basis
- Relations, Functions, and Quotients
- Rings, Subrings, Integral Domains and Fields
- Roots, Rational Powers, and Classical Inequalities
- The ZFC Axioms and the Basic Set Constructions
- Vector Spaces, Linear Subspaces, Span and Direct Sums
2 · Summary
This page defines a zero-based compressed sparse row (CSR) record, including empty rows, repeated column indices, and explicitly stored zeros. The stored entry count is kept distinct from the mathematical nonzero count until the representation is canonical. It proves the validated exact-arithmetic matrix-vector routine's termination, correctness, storage, and operation counts; it makes no finite-precision or convergence claim.
For sparse direct elimination, the page defines the symmetric structural graph and its ordered clique updates. The Schur-complement argument proves that the filled graph contains each numerical Schur complement's off-diagonal support, while allowing cancellations. The published matrix-free interface The matrix-free access model for Krylov methods and triangular-substitution result Forward and backward substitution are correct, unique, and quadratic in scalar operations remain at their canonical Krylov and direct-factorization pages; neither is used as a CSR cost or general fill bound.
3 · Logical flowchart
4 · Definitions, theorems and proofs
Compressed sparse row matrices with stored-entry semantics
Definition
Let be a field, and let , where includes . A compressed sparse row (CSR) record for an by matrix over consists of integer arrays and , and a value array , satisfying
For each row , its stored entries are the indices with . The row is empty exactly when . Repeated column indices within one row and stored values are permitted; each such entry remains a separate stored entry.
The represented matrix is defined entrywise by
where is when and otherwise, and an empty sum is . Repeated entries in column are therefore added. The number is the stored-entry count; it is not in general the number of nonzero entries of .
A CSR record is canonical when no row repeats a column and no stored value is zero. In that case every nonzero matrix entry is stored exactly once and , where denotes the number of nonzero entries of . If , the endpoint conditions force and the row-pointer array has its single entry . If , the column-index condition forces as well.
Structural graphs and ordered symmetric elimination
Definition
Let be a field, let (including ), and let satisfy for every (that is, is symmetric). Its structural graph is the simple undirected graph with vertex set and edge set
An elimination ordering is a listing in which every vertex of occurs exactly once. Define the current vertex set by , starting with the structural graph . At step , the later neighbors of are
The filled graph is obtained by deleting and its incident edges, retaining all edges between remaining vertices, and adding every edge between two distinct vertices of . An edge added at step that was not already in is a fill edge. Repeating this rule defines the symbolic elimination pattern for the ordering; it is defined from the initial graph and ordering alone, without numerical pivot values.
If is nonempty, the parent of is the later neighbor with least position in the ordering. If is empty, is a root. Each non-root has a unique parent, and positions strictly increase along parent edges, so there is no directed cycle. If the underlying undirected graph had a cycle with vertices, orient its edges from child to parent. Each vertex has at most one outgoing parent edge, so these edges force every cycle vertex to have one outgoing edge along the cycle; following them gives a directed cycle, contradicting strict increase. Thus the parent relation is an elimination forest.
Validated compressed sparse row matrix-vector product
Definition
Fix a field . The validated CSR matrix-vector product takes integer dimension candidates , integer arrays , a value array of elements of , and a vector candidate of elements of . All input arrays are finite; write .
- If , ,
,
, or
, return the status
invalid-dimension. - For , check that ; return
invalid-indexif a check fails. Check and , and for each check ; returninvalid-indexif any check fails. For each , check and returninvalid-indexif a check fails. - Initialize for . For each row , and then each stored index , update
- Return the status
oktogether with .
For valid CSR data, each update uses exact field arithmetic. This procedure makes no floating-point rounding, backward-stability, convergence, runtime, or memory-bandwidth claim.
The filled graph contains every off-diagonal Schur-complement nonzero
Statement
Let be a field, let satisfy for all , and fix an elimination ordering. Let be its symbolic filled graphs from Structural graphs and ordered symmetric elimination. Put . Assume each pivot is nonzero, and for every pair of remaining vertices define the Schur update
Then for every stage , each nonzero off-diagonal entry has . At each elimination step, the later neighbors of the eliminated vertex form a clique in the next filled graph. Thus the symbolic filled graph contains each numerical Schur complement's off-diagonal support; equality of these off-diagonal patterns is not asserted.
Facts & Assumptions
Given: A field , a symmetric matrix in , a fixed elimination ordering, nonzero pivots, and the Schur-complement update in the Statement.
Structural graphs and ordered symmetric elimination: at step , the graph deletes , retains edges between remaining vertices, and adds every edge between distinct vertices of .
Field: division by a nonzero pivot means multiplication by its multiplicative inverse.
Multiplication by zero: : in a field, for every .
A field has no zero divisors: or : in a field, implies or .
For every , and for all .
Proof
At stage , and the initial edge set consists exactly of the unordered off-diagonal pairs with nonzero matrix entry. Hence every nonzero off-diagonal entry of corresponds to an edge of .
Suppose the support inclusion holds at stage . If for distinct , then at least one of and is nonzero. In the first case, the induction hypothesis gives , and the update retains that edge. In the second case, the numerator is nonzero because a zero numerator would give a zero quotient by [L2] and [L3]; then [L4] forces both pivot couplings to be nonzero. The induction hypothesis gives , so and the update adds . Thus every such nonzero is supported by an edge of .
The base case and induction step prove the support inclusion at every stage. For any two distinct later neighbors of , the graph update inserts their pair by definition, so the later-neighbor set is a clique in .
Remarks
The conclusion is a support inclusion, not equality: an arithmetic subtraction can cancel a nonzero entry while the symbolic edge remains. The companion page gives an explicit cancellation calculation in Numerical cancellation can zero an entry while the filled graph retains its edge ↗. No factorization-cost bound follows from this graph statement.
Validated CSR matrix-vector multiplication terminates with a status
Statement
Let be a field, let , let be finite integer arrays,
and let be finite arrays with entries in . The algorithm
Validated compressed sparse row matrix-vector product terminates on every such
input. Its return status is invalid-dimension, invalid-index, or ok with
a vector in .
Facts & Assumptions
Given: A field , integer dimension candidates , finite integer arrays , and finite arrays with entries in .
Validated compressed sparse row matrix-vector product: with , the routine first returns invalid-dimension unless , , , and .
Validated compressed sparse row matrix-vector product: after the dimension checks, finite scans check for , , , for , and for ; any failure returns invalid-index.
Validated compressed sparse row matrix-vector product: after validation, the routine initializes for , traverses in each row, updates , and returns ok with .
Proof
The tests in [L1] are finite and either return invalid-dimension or establish natural dimensions and the required array lengths. Since the arrays are finite, is also a finite natural. The pointer-bound, pointer-monotonicity, and column-index scans in [L2] have respectively , , and iterations, with two additional endpoint tests; every accessed index exists by [L1]. Thus validation finishes, either returning invalid-index or establishing all conditions in [L2].
If validation passes, [L2] gives and . Hence the row ranges partition and have total length . The initialization and outer loop in [L3] each have iterations, and the inner loops have iterations in total. Every and accessed exists; field addition and multiplication keep each accumulator in . The routine therefore returns ok with a vector in . If , validation forces and returns the empty vector; empty row ranges likewise require no updates. Together with step 1.1 this proves the claim.
CSR matrix-vector multiplication returns the represented product
Statement
Let be a field, let , let a valid CSR record represent
, and let . Let
be the column matrix with for , and
define by
using Rectangular matrix multiplication and the identity matrix , including zero-sized shapes. Then the algorithm
Validated compressed sparse row matrix-vector product returns ok with output
in exact field arithmetic.
Facts & Assumptions
Given: A field , , a valid CSR record representing , and .
Compressed sparse row matrices with stored-entry semantics: , with an empty sum equal to .
Validated compressed sparse row matrix-vector product: each row starts at and accumulates once for every .
Rectangular matrix multiplication and the identity matrix , including zero-sized shapes: for the column matrix with , .
A finite sum in a commutative monoid indexed by an arbitrary finite set: a finite sum is independent of its enumeration and an empty sum is its identity element.
Field: multiplication distributes over addition.
The vector space of all functions with pointwise operations, and as the case : is the set of functions ; when it has exactly one element, the empty function.
Multiplication by zero: : in a field, for every .
Field: multiplication is commutative on all of , and for every ; hence .
Proof
Fix a row . Initially its output coordinate is , the empty partial sum. After entries of that row have been visited, induction on gives : the next algorithmic update adds exactly the next summand. Taking yields .
By [L1] and [L3], . Repeated application of [L5], by induction on the finite number of summands, distributes the products over these sums. Re-enumerating the resulting finite sum over pairs as is permitted by [L4]. For each fixed , exactly the term survives, so the result is . By step 1.1 this equals .
If , both and are the unique empty vector by [L6]. If , step 2.1 gives equality in every coordinate , hence .
CSR storage and exact matrix-vector operation counts
Statement
Let be a field, let , and let a valid CSR record have stored entries. Its input arrays use exactly field-value slots, integer column-index slots, and integer row-pointer slots, for a total of data slots. On valid input, the algorithm Validated compressed sparse row matrix-vector product performs exactly field multiplications, field additions, and zero initializations. Its index validation and loop-control work is . Counting the CSR arrays and returned output but excluding the supplied vector and constant-size workspace, it uses exactly data slots, hence slots; for this is . Here means bounded by for a constant independent of the dimensions and input values.
For a square record of order with at least one stored entry in each row, , so the work and storage are . For a canonical record as defined in Compressed sparse row matrices with stored-entry semantics, ; without that convention, the cost is in terms of stored entries, not . These are arithmetic, index, and storage counts, not runtime, memory-bandwidth, convergence, or factorization-cost bounds.
Facts & Assumptions
Given: A valid CSR record with dimensions and stored entries.
Compressed sparse row matrices with stored-entry semantics: the arrays have lengths , , and ; the row pointers satisfy .
Compressed sparse row matrices with stored-entry semantics: a record is canonical when no row repeats a column and no stored value is zero; then .
Validated compressed sparse row matrix-vector product: on a valid record the algorithm initializes outputs and visits each row interval , performing one multiply-add per visited index.
Proof
The value, column-index, and row-pointer arrays have lengths , , and , respectively, so their input representation contains exactly data slots.
The number of visits in row is . Summing these lengths telescopes to ; monotonicity makes the intervals disjoint and their endpoints cover every stored index once. Thus the accumulation loop executes exactly multiply-add updates, and the initialization loop executes exactly times. The two validation scans examine at most pointers and column indices, so validation and loop control take work.
The returned vector occupies additional field slots. Counting it with the CSR arrays, and excluding the supplied and fixed workspace, gives exactly data slots, hence . If , then and the additive constant is absorbed into a fixed multiple of .
For a square record of order with every row storing at least one entry, summing its row lengths gives ; substituting into the preceding bounds yields . By [L2], a canonical record has ; no such equality is asserted when duplicate columns or explicit zeros are stored.
5 · Examples, counterexamples and false statements
None yet.
Sources
- Yousef Saad, Iterative Methods for Sparse Linear Systems, 2nd ed., Chapter 3 §3.4, printed pp. 92–94 (CSR storage)
- Richard Barrett et al., Templates for the Solution of Linear Systems: Building Blocks for Iterative Methods, 2nd ed., Chapter 4 §4.3.1–4.3.2, printed pp. 57–63
- Yousef Saad, Iterative Methods for Sparse Linear Systems, 2nd ed., Chapter 3 §§3.2.1, 3.3.2 and 3.6, printed pp. 77–83 and 96–98
- Prabhakar Poupart and Jingjing Wan, CS475/CS675 Lecture 4: Sparse Gaussian Elimination, Graph Representation, slides 6–10, University of Waterloo, May 12, 2016
- Yousef Saad, Iterative Methods for Sparse Linear Systems, 2nd ed., Chapter 3 §3.5, printed pp. 95–96 (CSR matrix-vector product)
- Yousef Saad, Iterative Methods for Sparse Linear Systems, 2nd ed., Chapter 3 §3.5, printed pp. 95–96
- Yousef Saad, Iterative Methods for Sparse Linear Systems, 2nd ed., Chapter 3 §§3.4–3.5, printed pp. 92–96