NLA-lib Explorer

The matrix sign function by the Newton–Schulz iteration on a floating-point machine

Library · Source module

The matrix sign function by the Newton–Schulz iteration on a floating-point machine

NLAlib.newtonSchulzSign M ε b N A approximates the sign \operatorname{sign}(\mathbf{A}) of a stored nonsingular Hermitian \mathbf{A} with \|\mathbf{A}\|_2 \le \mathbf{b} by the inverse-free iteration \mathbf{A}_{k+1} = \tfrac12\mathbf{A}_k(3\mathbf{I} - \mathbf{A}_k^2) from \mathbf{A}_0 = \mathbf{A}/\mathbf{b} ([Shah2024, Algorithm 1]), written over a NLAlib.FloatMachine: two black-box products per step and the entrywise operations of NLAlib/Matrix/Computation/EntrywiseRounding.lean. Each step stores the rounded Hermitian part of the computed product, which [Shah2024] leaves implicit; the threshold \varepsilon/(4n) of the stopping test is computed by the machine; the iteration stops when every part of every entry of the computed \mathrm{mm}(\mathbf{A}_k, \mathbf{A}_k) - \mathbf{I} is at most the threshold in absolute value, or after N steps. The definitions are computable: they use the machine and ℕ only.

Main definitions

* NLAlib.newtonSchulzRounded: one step. * NLAlib.newtonSchulzTest: the stopping test. * NLAlib.newtonSchulzLoop, NLAlib.newtonSchulzSign: the iteration and the algorithm.

Main results

* NLAlib.FloatMachine.IsArithAccurate.isHermitian_decodeMatrix_newtonSchulzRounded, NLAlib.FloatMachine.IsArithAccurate.isHermitian_decodeMatrix_newtonSchulzSign. * NLAlib.FloatMachine.IsArithAccurate.specNorm_sub_decodeMatrix_newtonSchulzRounded_le, NLAlib.FloatMachine.IsArithAccurate.specNorm_sub_decodeMatrix_newtonSchulzRounded_le_add: one step (Lemma 2.1), with the factor \sqrt n on the whole error or on the rounding only. * FloatMachine.IsArithAccurate.forall_isNewtonSchulzChain_and_specNorm_cfc_sign_sub_cfc_sign_le: the eigenvalues of the rounded iterates lie on perturbed scalar chains (NLAlib.IsNewtonSchulzChain).

The accuracy of the algorithm (Theorem 2.6) and its stopping test are in NLAlib/Matrix/Computation/NewtonSchulzSign/Accuracy.lean.

Declarations