NLA-lib Explorer

NLAlib.rotateLeftWithScratch_writes_word

Library · theorem

The actual left scalar rotation on any machine always terminates and stores the two computed versions of c \mathbf{x} + s y and -\bar s \mathbf{x} + \bar c y. Conjugations use the machine's negation operation. Input/output views are exactly aliased. [GolubVanLoan2013, §5.1.8]. 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.

NLAlib.rotateLeftWithScratch_writes_word {Op Tst : Type} [Ops.Has Ops.ScalarOp Op]
  {M : Ops.Machine ℝ} {I : Ops.Interp Op Tst ℝ} (hI : Ops.IsScalar M I) {τ : Ops.Tape ℝ}
  {m : Ops.Mem ℝ} {c s x y t : ℕ × ℕ} {cv sv xv yv : ℂ} (htc : t.1 ≠ c.1) (hts : t.1 ≠ s.1)
  (htx : t.1 ≠ x.1) (hty : t.1 ≠ y.1)
  (hxy : Ops.Fp.Disj (Ops.Store.inBlock x.1 x.2 2) (Ops.Store.inBlock y.1 y.2 2))
  (hc0 : m.store.get c.1 c.2 = some cv.re) (hc1 : m.store.get c.1 (c.2 + 1) = some cv.im)
  (hs0 : m.store.get s.1 s.2 = some sv.re) (hs1 : m.store.get s.1 (s.2 + 1) = some sv.im)
  (hx0 : m.store.get x.1 x.2 = some xv.re) (hx1 : m.store.get x.1 (x.2 + 1) = some xv.im)
  (hy0 : m.store.get y.1 y.2 = some yv.re) (hy1 : m.store.get y.1 (y.2 + 1) = some yv.im)
  (ht : t.2 + 10 ≤ m.store.len t.1) (hx : x.2 + 2 ≤ m.store.len x.1)
  (hy : y.2 + 2 ≤ m.store.len y.1) :
  Ops.Writes Ops.Mode.total I τ rotateLeftWithScratch (Ops.Env.frame [] [c, s, x, y, t, x, y])
    (Ops.Fp.blocks [t, x, y] [10, 2, 2])
    (fun μ ↦
      μ.pos = m.pos ∧
        μ.readBlocks [x, y] [2, 2] =
          some
            [[(linearComplex M cv sv xv yv).re, (linearComplex M cv sv xv yv).im],
              [(linearComplex M { re := M.neg sv.re, im := sv.im }
                    { re := cv.re, im := M.neg cv.im } xv yv).re,
                (linearComplex M { re := M.neg sv.re, im := sv.im }
                    { re := cv.re, im := M.neg cv.im } xv yv).im]])
    m

Full source on GitHub

Import NLAlib.Matrix.FinitePrecision.GivensRotation.