Test case: the matrix product in finite precision
Library · Source module
Test case: the matrix product in finite precision
NLAlib.Ops.Examples.gemm computes C = A B by m p calls of dot: A is m × n stored by rows, B is n × p stored by columns (so that a row of A and a column of B are contiguous blocks), C is m × p stored by rows.
Main results
* Mathematics: the postcondition NLAlib.Ops.Examples.GemmRounded is the classical componentwise forward bound |ĉ_ij - Σ_k a_ik b_kj| ≤ ε Σ_k |a_ik| |b_kj|; nothing else is needed. * The certificate (NLAlib.Ops.Examples.gemm_satisfies): for every interpretation meeting the level-1 contracts at ε, gemm satisfies its contract in operand form (NLAlib.Ops.Examples.gemmRel). This is the statement of an implementation of an operation; it is proved in the program logic (NLAlib.Ops.Logic) by the relational 2-D fill rule. * Abstract theorem (NLAlib.Ops.Examples.runs_gemm_rounded), the counted run read off the judgment of the routine (NLAlib.Ops.Routine.Meets.runs_ofRel): m p calls of dot at the length n. * Corollaries, one application of Profile.Refines.runs each (NLAlib.Ops.Examples.runs_gemm_link_seq, NLAlib.Ops.Examples.runs_gemm_link_pairwise): ε = (1 + u) ^ n - 1 under sequential summation and (1 + u) ^ (⌈log₂ n⌉ + 1) - 1 under pairwise summation, with the scalar counts of NLAlib.Ops.Examples.push_seq_gemmCount and NLAlib.Ops.Examples.push_pairwise_gemmCount: m p n multiplications and m p (n - 1) additions in both.
Declarations
- NLAlib.Ops.Examples.GemmForward
- NLAlib.Ops.Examples.GemmOperands
- NLAlib.Ops.Examples.GemmRounded
- NLAlib.Ops.Examples.gemm
- NLAlib.Ops.Examples.gemmCount
- NLAlib.Ops.Examples.gemmRel
- NLAlib.Ops.Examples.gemmRel_dom
- NLAlib.Ops.Examples.gemmRel_inLens
- NLAlib.Ops.Examples.gemmRel_nd
- NLAlib.Ops.Examples.gemmRel_outLens
- NLAlib.Ops.Examples.gemmRel_rel
- NLAlib.Ops.Examples.gemmRel_stream
- NLAlib.Ops.Examples.gemmRel_win
- NLAlib.Ops.Examples.gemmRoutine
- NLAlib.Ops.Examples.gemmRoutine_implements
- NLAlib.Ops.Examples.gemmRoutine_meets
- NLAlib.Ops.Examples.gemm_satisfies
- NLAlib.Ops.Examples.push_pairwise_gemmCount
- NLAlib.Ops.Examples.push_seq_gemmCount
- NLAlib.Ops.Examples.runs_gemm_link_pairwise
- NLAlib.Ops.Examples.runs_gemm_link_seq
- NLAlib.Ops.Examples.runs_gemm_rounded
- NLAlib.Ops.Examples.staticCost_gemm
- NLAlib.Ops.Examples.staticPeak_gemm_le