NLA-lib Explorer

Layouts: vectors and matrices in the store, and their decoding

Library · Source module

Layouts: vectors and matrices in the store, and their decoding

A program stores a vector as a block and a matrix as columns (or rows) with a leading dimension. The predicates here say what the store holds as a function of the logical indices, so that invariants and contracts are stated on ℕ → K or ℕ → ℕ → K and decoded to the Fin n → ℝ and Matrix of layer 1 by one lemma (decode), instead of vec (xs.drop a |>.take n) i rewritten by hand in every proof.

* NLAlib.Ops.Store.HoldsVec s b o n v: the cells o, …, o + n - 1 of b hold v 0, …. * NLAlib.Ops.MatLayout: a matrix of rows × cols at (buf, off) with leading dimension ld, stored by columns: entry (i, j) is the cell off + j * ld + i. A matrix stored by rows is the layout of its transpose. * NLAlib.Ops.Store.HoldsMat s L A: the store holds A in the layout L. * NLAlib.Ops.MatLayout.fp: the cells of the layout (its footprint); MatLayout.upto: the cells of the columns before j and of column j before row i (the footprint of a fill).

Main results

* NLAlib.Ops.Store.holdsVec_iff_readBlock: a vector is a block read. * NLAlib.Ops.Store.HoldsMat.col: a column of a matrix is a vector. * NLAlib.Ops.Store.readsOnly_holdsVec, NLAlib.Ops.Store.readsOnly_holdsMat: kept facts. * NLAlib.Ops.MatLayout.disj_of_cols: two column ranges of one layout are disjoint (block-level disjointness in one buffer, for a kernel that reads and writes one arena). * NLAlib.Ops.vec_drop_take, NLAlib.Ops.decVec, NLAlib.Ops.decMat: decoding.

Declarations