NLA-lib Explorer

NLAlib.coefficients_writes_word

Library · theorem

Scoped coefficient computation on any machine stores NLAlib.roundedGivensCoeffs and releases all scratch. Input and output views may overlap; the two output views are apart. The actual radius test covers the zero pair without a division by zero. [GolubVanLoan2013, Algorithm 5.1.3]. Shared by the trees of NLAlib.ShiftedQR.deflationRoutine, NLAlib.hessenbergReduceLast, NLAlib.ShiftedQR.scalarDecouple, NLAlib.ShiftedQR.shiftedStepRoutine, NLAlib.ShiftedQR.shqrSmallEigRoutine and NLAlib.SmallEig.smallEigRoutine, on their scratch. The run stated on cells, for inputs and outputs that may overlap: a step in the proof of NLAlib.coefficientsRoutine_meets (outputs apart from the inputs), and the form in which the trees above, which read the pair from two entries of a matrix, use it.

NLAlib.coefficients_writes_word {Op Tst : Type} [Ops.Has Ops.ScalarOp Op] [Ops.Has Ops.CmpTst Tst]
  {M : Ops.Machine ℝ} {I : Ops.Interp Op Tst ℝ} (hS : Ops.IsScalar M I) (hCmp : Ops.IsCmp id I)
  {τ : Ops.Tape ℝ} {m : Ops.Mem ℝ} {a b c s : ℕ × ℕ} {u v : ℂ}
  (hcs : Ops.Fp.Disj (Ops.Store.inBlock c.1 c.2 2) (Ops.Store.inBlock s.1 s.2 2))
  (hu0 : m.store.get a.1 a.2 = some u.re) (hu1 : m.store.get a.1 (a.2 + 1) = some u.im)
  (hv0 : m.store.get b.1 b.2 = some v.re) (hv1 : m.store.get b.1 (b.2 + 1) = some v.im)
  (hc : c.2 + 2 ≤ m.store.len c.1) (hs : s.2 + 2 ≤ m.store.len s.1) :
  Ops.Writes Ops.Mode.total I τ coefficients (Ops.Env.frame [] [a, b, c, s])
    (Ops.Fp.blocks [c, s] [2, 2])
    (fun m' ↦
      m'.pos = m.pos ∧
        m'.readBlocks [c, s] [2, 2] =
          some
            [[(roundedGivensCoeffs M u v).1.re, (roundedGivensCoeffs M u v).1.im],
              [(roundedGivensCoeffs M u v).2.re, (roundedGivensCoeffs M u v).2.im]])
    m

Full source on GitHub

Import NLAlib.Matrix.FinitePrecision.GivensCoefficients.