NLA-lib Explorer

NLAlib.Ops.Store.HoldsEntries.submatrix

Library · theorem

A rectangular view preserves the leading dimension and translates only its word offset. The enclosing matrix supplies its component reads without any copy operation.

NLAlib.Ops.Store.HoldsEntries.submatrix {K E : Type} {s : Ops.Store K} {C : Ops.EntryCodec K E}
  {L : Ops.MatLayout} {A : ℕ → ℕ → E} (h : s.HoldsEntries C L A) {r c rows cols : ℕ}
  (hr : r + rows ≤ L.rows) (hc : c + cols ≤ L.cols) :
  s.HoldsEntries C
    { buf := L.buf, off := L.off + C.width * (c * L.ld + r), rows := rows, cols := cols,
      ld := L.ld }
    fun i j ↦ A (r + i) (c + j)

Full source on GitHub

Import NLAlib.Ops.Logic.EntryLayout.