NLAlib.newtonSchulzSign
Library · def
The Newton–Schulz sign algorithm \mathsf{newtonSchulzSign}(\mathbf{A}, \varepsilon, \mathbf{b}) with at most N steps, for stored \varepsilon and \mathbf{b}: the loop NLAlib.newtonSchulzLoop at the computed threshold \mathrm{fl}(\varepsilon/\mathrm{fl}(4n)) from the stored Hermitian \mathbf{A}/\mathbf{b} (NLAlib.FloatMachine.hermScale). In pseudo-code, every scalar operation rounded by the machine and the products its black box:
sign(A; ε, b, N): A Hermitian n×n, ‖A‖₂ ≤ b
η ← ε/(4n)
X ← A/b
repeat at most N times:
if every real and imaginary part of every entry of X·X − I lies in [−η, η]:
return X
Y ← X·(3I − X·X)
X ← (Y + Yᴴ)/4 X(3I − X²)/2 in exact arithmetic
return X
[Shah2024, Algorithm 1], there with no step limit. Algorithm: newton-schulz-sign
NLAlib.newtonSchulzSign.{u_1, u_2, u_3} {F : Type u_1} {Su : Type u_2} {Sg : Type u_3} {n : ℕ}
(M : FloatMachine F Su Sg) (ε b : F) (N : ℕ) (A : Matrix (Fin n) (Fin n) (F × F)) :
Matrix (Fin n) (Fin n) (F × F)Import NLAlib.Matrix.FinitePrecision.NewtonSchulzSign.