NLA-lib Explorer

NLAlib.MGS.normalizeGuard_writes

Library Β· theorem

The guard uses the actual stored squared norm and returns the corresponding normalized vector. Its total execution includes both the zero and nonzero branches. A fragment of NLAlib.MGS.factorRoutine: run only inside its tree, on its operands and the buffers it allocates.

NLAlib.MGS.normalizeGuard_writes {π•œ Op Tst : Type} [RCLike π•œ] [Ops.Has Ops.ScalarOp Op]
  [Ops.Has Ops.Blas1Op Op] [Ops.Has Ops.CmpTst Tst] {I : Ops.Interp Op Tst π•œ} {Ο„ : Ops.Tape π•œ}
  {m : Ops.Mem π•œ} (hS : Ops.IsScalar Ops.RCLikeBlas.machine I) (hB : Ops.RCLikeBlas.IsExact I)
  (hC : Ops.IsCmp (⇑RCLike.re) I) {n : β„•} {v t : β„• Γ— β„•} (w : Fin n β†’ π•œ) (d : π•œ) (hl : m.Live [v, t])
  (hv : m.store.readBlock v.1 v.2 n = some (List.ofFn w))
  (hd : m.store.readBlock t.1 (t.2 + 1) 1 = some [d]) (hzero : m.store.get t.1 t.2 = some 0)
  (htv : Ops.Fp.Disj (Ops.Store.inBlock t.1 t.2 2) (Ops.Store.inBlock v.1 v.2 n))
  (ht : t.2 + 2 ≀ m.store.len t.1) (hz : v.2 + n ≀ m.store.len v.1) :
  Ops.Writes Ops.Mode.total I Ο„ MGS.normalizeGuard (Ops.Env.frame [n] [v, t])
    (Ops.Store.inBlock t.1 t.2 2 βŠ” Ops.Store.inBlock v.1 v.2 n)
    (fun m' ↦
      m'.pos = m.pos ∧
        m'.store.readBlock v.1 v.2 n =
          some (if RCLike.re d = 0 then List.ofFn w else List.ofFn fun i ↦ w i / β†‘βˆš(RCLike.re d)))
    m

Full source on GitHub

Import NLAlib.Matrix.Factorizations.MGS.Normalize.