NLA-lib Explorer

NLAlib.newtonSchulzRounded

Library · def

One rounded Newton–Schulz step on the machine M: with \mathbf{X} = \mathrm{mm}(\mathbf{A}, \mathbf{A}) and \mathbf{B} = -(\mathbf{X} - 3\mathbf{I}) (rounded shift, exact negation), the result is the stored Hermitian (\mathbf{Y} + \mathbf{Y}^{\mathsf{H}})/4 for \mathbf{Y} = \mathrm{mm}(\mathbf{A}, \mathbf{B}) (NLAlib.FloatMachine.hermAvg), which in exact arithmetic is g(\mathbf{A}) = \tfrac12\mathbf{A}(3\mathbf{I} - \mathbf{A}^2). [Shah2024, (2.4)], there without the Hermitian part. Algorithm: newton-schulz-sign

NLAlib.newtonSchulzRounded.{u_1, u_2, u_3} {F : Type u_1} {Su : Type u_2} {Sg : Type u_3} {n : ℕ}
  (M : FloatMachine F Su Sg) (A : Matrix (Fin n) (Fin n) (F × F)) : Matrix (Fin n) (Fin n) (F × F)

Full source on GitHub

Import NLAlib.Matrix.FinitePrecision.NewtonSchulzSign.