recondition_eigenspaces#

hypercoil.functional.matrix.recondition_eigenspaces(A: Tensor, psi: float, xi: float, key: Tensor) Tensor[source]#

Recondition a positive semidefinite matrix such that it has no zero eigenvalues, and all of its eigenspaces have dimension one.

This reconditioning operation should help stabilise differentiation through singular value decomposition.

This operation modifies the input matrix A following

\(A := A + \left(\psi - \frac{\xi}{2}\right) I + I\mathbf{x}\)

\(x_i \sim \mathrm{Uniform}(0, \xi) \forall x_i\)

\(\psi > \xi\)

Parameters:
Atensor

Matrix or matrix block to be reconditioned.

psifloat

Reconditioning parameter for ensuring nonzero eigenvalues.

xifloat

Reconditioning parameter for ensuring nondegenerate eigenvalues.

Returns:
tensor

Reconditioned matrix or matrix block.