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
- NLAlib.Ops.MatLayout
- NLAlib.Ops.MatLayout.Valid
- NLAlib.Ops.MatLayout.cell
- NLAlib.Ops.MatLayout.col_fp
- NLAlib.Ops.MatLayout.disj_of_cols
- NLAlib.Ops.MatLayout.fp
- NLAlib.Ops.MatLayout.fp_apply
- NLAlib.Ops.MatLayout.fp_le_inBlock
- NLAlib.Ops.MatLayout.upto
- NLAlib.Ops.MatLayout.upto_apply
- NLAlib.Ops.MatLayout.upto_col
- NLAlib.Ops.MatLayout.upto_cols
- NLAlib.Ops.MatLayout.upto_succ
- NLAlib.Ops.MatLayout.upto_zero
- NLAlib.Ops.Store.HoldsMat
- NLAlib.Ops.Store.HoldsMat.col
- NLAlib.Ops.Store.HoldsMat.readBlock
- NLAlib.Ops.Store.HoldsMatUpto
- NLAlib.Ops.Store.HoldsVec
- NLAlib.Ops.Store.HoldsVec.snoc
- NLAlib.Ops.Store.holdsMatUpto_cols
- NLAlib.Ops.Store.holdsMat_of_cols
- NLAlib.Ops.Store.holdsMat_of_readBlock
- NLAlib.Ops.Store.holdsVec_iff_readBlock
- NLAlib.Ops.Store.holdsVec_of_readBlock
- NLAlib.Ops.Store.readsOnly_holdsMat
- NLAlib.Ops.Store.readsOnly_holdsVec
- NLAlib.Ops.decMat
- NLAlib.Ops.decMat_apply
- NLAlib.Ops.decVec
- NLAlib.Ops.decVec_apply
- NLAlib.Ops.vec_drop_take