NLA-lib Explorer

NLAlib.SpectralBisection.split_writes_storesStep

Library · theorem

An interior split stores the complete existing mathematical branch outcome, with its two bases, compressions, child sizes and parent metadata in one tuple. A fragment of NLAlib.SpectralBisection.bisectionRoutine.

NLAlib.SpectralBisection.split_writes_storesStep {K Op Tst : Type} [Inhabited K]
  [Ops.Has Ops.ScalarOp Op] [Ops.Has Ops.IndexOp Op] [Ops.Has Ops.MatrixOp Op] {M : Ops.Machine K}
  (dec : K → ℝ) (mm : MatMulMap (K × K)) (qr : QRMap (K × K)) {I : Ops.Interp Op Tst K}
  (hS : Ops.IsScalar M I) (hL : Ops.IsIndexLit M I)
  (hMM : Ops.IsMatrixMul (Ops.EntryCodec.pair K) (fun {l m n} ↦ mm) I)
  (hQR : Ops.IsMatrixQR (Ops.EntryCodec.pair K) (fun {m n} ↦ qr) I) {τ : Ops.Tape K} {μ : Ops.Mem K}
  {n d lo k kp : ℕ} {sg pp pm ma ua qa ea sz kd ks c t : ℕ × ℕ} (S : ℕ → ℕ → K × K)
  (Pp Pm A : Matrix (Fin k) (Fin k) (K × K)) (R : K) (hInterior : 0 < kp ∧ kp < k)
  (hslot : lo + k ≤ n) (hl : μ.Live [sg, pp, pm, ma, qa, sz, kd, ks, c, t])
  (hread :
    μ.readBlocks (SpectralBisection.splitInputs n d lo sg pp pm ma c t)
        (SpectralBisection.splitInputLengths n k) =
      some
        [(Ops.EntryCodec.pair K).packMatrix n (2 * n) S, (Ops.EntryCodec.pair K).packFinMatrix Pp,
          (Ops.EntryCodec.pair K).packFinMatrix Pm, (Ops.EntryCodec.pair K).packFinMatrix A,
          [M.lit 2], [M.sqrtHalf], [M.div R (M.lit 2)], [M.neg (M.div R (M.lit 2))]])
  (hroom :
    μ.Room (SpectralBisection.splitOutputs n d lo k kp ma qa sz kd ks)
      (SpectralBisection.splitOutputLengths k kp))
  (hap :
    Ops.Fp.Apart (SpectralBisection.splitOutputs n d lo k kp ma qa sz kd ks)
      (SpectralBisection.splitOutputLengths k kp))
  (hprotect :
    (Ops.Fp.blocks (SpectralBisection.splitOutputs n d lo k kp ma qa sz kd ks)
          (SpectralBisection.splitOutputLengths k kp)).Disj
      (Ops.Fp.blocks (SpectralBisection.splitInputs n d lo sg pp pm ma c t)
        (SpectralBisection.splitInputLengths n k))) :
  have step :=
    SpectralBisection.branchOutcome M dec (fun {l m n} ↦ mm) (fun {m n} ↦ qr) lo R S A Pp Pm kp ⋯;
  Ops.Writes Ops.Mode.total I τ SpectralBisection.split
    (Ops.Env.frame [n, d, lo, k, kp] [sg, pp, pm, ma, qa, sz, kd, ks, c, t])
    (Ops.Fp.blocks (SpectralBisection.stepOutputs n d lo ma ua qa ea sz kd ks step)
      (SpectralBisection.stepOutputLengths step))
    (fun μ' ↦ μ'.pos = μ.pos ∧ SpectralBisection.StoresStep M R n d lo ma ua qa ea sz kd ks step μ')
    μ

Full source on GitHub

Import NLAlib.Eigensolvers.SpectralBisection.NodeOutput.