NLA-lib Explorer

NLAlib.Ops.copyStrided_writes

Library · theorem

Scalar copies fill exactly the actual pair-codec destination entries. The input is readable, the destination has capacity, and their actual entry regions are disjoint; source and destination may belong to the same underlying buffer. Shared by the trees of NLAlib.ShiftedQR.copyToWork, NLAlib.ShiftedQR.copyToGlobal, NLAlib.ShiftedQR.roundedLeafUpdate.

NLAlib.Ops.copyStrided_writes {K Op Tst : Type} [Inhabited K] [Ops.Has Ops.ScalarOp Op]
  {M : Ops.Machine K} {I : Ops.Interp Op Tst K} (hS : Ops.IsScalar M I) {τ : Ops.Tape K}
  {m : Ops.Mem K} {rows cols srcLd dstLd : ℕ} {x y : ℕ × ℕ} (A : ℕ → ℕ → K × K) (hl : m.Live [x, y])
  (hX :
    m.store.HoldsEntries (Ops.EntryCodec.pair K)
      { buf := x.1, off := x.2, rows := rows, cols := cols, ld := srcLd } A)
  (hyL : rows ≤ dstLd)
  (hy : ∀ j < cols, ∀ i < rows, y.2 + 2 * (j * dstLd + i) + 2 ≤ m.store.len y.1)
  (hxy :
    ((Ops.EntryCodec.pair K).regionFp x.1 x.2 cols (fun i j ↦ j * srcLd + i) fun x ↦ rows).Disj
      ((Ops.EntryCodec.pair K).regionFp y.1 y.2 cols (fun i j ↦ j * dstLd + i) fun x ↦ rows)) :
  Ops.Writes Ops.Mode.total I τ Ops.copyStrided (Ops.Env.frame [rows, cols, srcLd, dstLd] [x, y])
    ((Ops.EntryCodec.pair K).regionFp y.1 y.2 cols (fun i j ↦ j * dstLd + i) fun x ↦ rows)
    (fun m' ↦
      m'.store.HoldsEntries (Ops.EntryCodec.pair K)
          { buf := y.1, off := y.2, rows := rows, cols := cols, ld := dstLd } A ∧
        m'.pos = m.pos)
    m

Full source on GitHub

Import NLAlib.Ops.Blas.BlockCopy.