NLA-lib Explorer

NLAlib.MGS.reduce_writes

Library ยท theorem

A reduction writes the projection subtraction and its negated coefficient, preserving all other cells. Input/output vector overlap is allowed by the local block contracts. A fragment of NLAlib.MGS.sweepRoutine: run only inside its tree, on its operands and the buffers it allocates.

NLAlib.MGS.reduce_writes {๐•œ Op Tst : Type} [RCLike ๐•œ] [Ops.Has Ops.ScalarOp Op]
  [Ops.Has Ops.Blas1Op Op] {I : Ops.Interp Op Tst ๐•œ} {ฯ„ : Ops.Tape ๐•œ} {m : Ops.Mem ๐•œ}
  (hS : Ops.IsScalar Ops.RCLikeBlas.machine I) (hB : Ops.RCLikeBlas.IsExact I) {n : โ„•}
  {q v r : โ„• ร— โ„•} (qs vs : List ๐•œ) (hl : m.Live [q, v, r])
  (hq : m.store.readBlock q.1 q.2 n = some qs) (hv : m.store.readBlock v.1 v.2 n = some vs)
  (hrq : Ops.Fp.Disj (Ops.Store.inBlock r.1 r.2 1) (Ops.Store.inBlock q.1 q.2 n))
  (hrv : Ops.Fp.Disj (Ops.Store.inBlock r.1 r.2 1) (Ops.Store.inBlock v.1 v.2 n))
  (hqv : Ops.Fp.Disj (Ops.Store.inBlock q.1 q.2 n) (Ops.Store.inBlock v.1 v.2 n) โˆจ q = v)
  (hroom : r.2 + 1 โ‰ค m.store.len r.1) (hvroom : v.2 + n โ‰ค m.store.len v.1) :
  Ops.Writes Ops.Mode.total I ฯ„ MGS.reduce (Ops.Env.frame [n] [q, v, r])
    (Ops.Store.inBlock r.1 r.2 1 โŠ” Ops.Store.inBlock v.1 v.2 n)
    (fun m' โ†ฆ
      m'.pos = m.pos โˆง
        m'.store.readBlock v.1 v.2 n =
          some (List.ofFn fun i โ†ฆ vs.getD (โ†‘i) 0 - Ops.RCLikeBlas.dot n qs vs * qs.getD (โ†‘i) 0))
    m

Full source on GitHub

Import NLAlib.Matrix.Factorizations.MGS.Reduce.