NLAlib.Ops.writes_matrixQR
Library · theorem
A full QR call writes both factors of the same routine on its actual stored matrix. Only the two output blocks must be disjoint; either may overlap the input.
NLAlib.Ops.writes_matrixQR {K E Op Tst : Type} [Inhabited K] [Ops.Has Ops.MatrixOp Op]
{I : Ops.Interp Op Tst K} {τ : Ops.Tape K} {ρ : Ops.Env} {μ : Ops.Mem K} {C : Ops.EntryCodec K E}
{qr : {m n : ℕ} → Matrix (Fin m) (Fin n) E → Matrix (Fin m) (Fin m) E × Matrix (Fin m) (Fin n) E}
(hI : Ops.IsMatrixQR C (fun {m n} ↦ qr) I) {ds : List Ops.IExp} {ins outs : List Ops.Operand}
{m n : ℕ} {a q r : ℕ × ℕ} {as : List K} (hd : Ops.IExp.evalList ρ.idx ds = some [m, n])
(ha : Ops.Operand.evalList ρ ins = some [a]) (hb : Ops.Operand.evalList ρ outs = some [q, r])
(hl : μ.Live [a, q, r]) (hA : μ.store.readBlock a.1 a.2 (n * m * C.width) = some as)
(hQR :
Ops.Fp.Disj (Ops.Store.inBlock q.1 q.2 (m * m * C.width))
(Ops.Store.inBlock r.1 r.2 (n * m * C.width)))
(hQ : q.2 + m * m * C.width ≤ μ.store.len q.1) (hR : r.2 + n * m * C.width ≤ μ.store.len r.1) :
Ops.Writes Ops.Mode.total I τ (Ops.Stmt.call (Ops.Has.inj Ops.MatrixOp.qr) ds ins outs) ρ
(Ops.Store.inBlock q.1 q.2 (m * m * C.width) ⊔ Ops.Store.inBlock r.1 r.2 (n * m * C.width))
(fun μ' ↦
μ'.pos = μ.pos ∧
μ'.store.readBlock q.1 q.2 (m * m * C.width) =
some (C.packFinMatrix (qr (C.matrix m n as)).1) ∧
μ'.store.readBlock r.1 r.2 (n * m * C.width) =
some (C.packFinMatrix (qr (C.matrix m n as)).2))
μImport NLAlib.Ops.Logic.Matrix.