NLA-lib Explorer

NLAlib.SpectralBisection.downPrepare_writes

Library · theorem

The level preparation writes the actual rounded parameters and both actual tape windows. It draws exactly levelSampleSize n words, including for empty matrices. A fragment of NLAlib.SpectralBisection.bisectionRoutine.

NLAlib.SpectralBisection.downPrepare_writes {K Op Tst : Type} [Ops.Has Ops.ScalarOp Op]
  [Ops.Has Ops.IndexOp Op] [Ops.Has Ops.SampleOp Op] {M : Ops.Machine K} {I : Ops.Interp Op Tst K}
  (hS : Ops.IsScalar M I) (hIndex : Ops.IsIndexLit M I) (hSample : Ops.IsSample I) {τ : Ops.Tape K}
  {n L d : ℕ} {c lv su sg t : ℕ × ℕ} {m : Ops.Mem K} (one two half R eps : K)
  (hl : m.Live [c, lv, su, sg, t])
  (hAP :
    Ops.Fp.Apart [c, (lv.1, lv.2 + 2 * d), (lv.1, lv.2 + 2 * (d + 1)), su, sg, t]
      [3, 2, 2, n, 4 * (n * n), 4])
  (hc : m.store.readBlock c.1 c.2 3 = some [one, two, half])
  (hLv : m.store.readBlock lv.1 (lv.2 + 2 * d) 2 = some [R, eps])
  (hv : lv.2 + 2 * (d + 1) + 2 ≤ m.store.len lv.1) (hu : su.2 + n ≤ m.store.len su.1)
  (hg : sg.2 + 4 * (n * n) ≤ m.store.len sg.1) (ht : t.2 + 4 ≤ m.store.len t.1) :
  Ops.Writes Ops.Mode.total I τ SpectralBisection.downPrepare
    (Ops.Env.frame [n, L, d] [c, lv, su, sg, t])
    (Ops.Store.inBlock lv.1 (lv.2 + 2 * (d + 1)) 2 ⊔ Ops.Store.inBlock t.1 t.2 4 ⊔
      (Ops.Store.inBlock su.1 su.2 n ⊔ Ops.Store.inBlock sg.1 sg.2 (4 * (n * n))))
    (fun μ ↦
      μ.pos = m.pos + SpectralBisection.levelSampleSize n ∧
        μ.store.readBlock lv.1 (lv.2 + 2 * (d + 1)) 2 =
            some
              [M.mul (M.add half (M.div two (M.lit ↑(L + d)))) R,
                M.mul (M.sub one (M.div one (M.lit ↑(L + d)))) eps] ∧
          μ.store.readBlock su.1 su.2 n = some (τ.window Ops.Stream.unif m.pos n) ∧
            μ.store.readBlock sg.1 sg.2 (4 * (n * n)) =
              some (τ.window Ops.Stream.gauss (m.pos + n) (4 * (n * n))))
    m

Full source on GitHub

Import NLAlib.Eigensolvers.SpectralBisection.DownPrepare.