graphdot.linalg.spectral module

graphdot.linalg.spectral.pinvh(H, rcond=1e-10, mode='truncate', return_nlogdet=False)[source]

Compute the pseudoinverse of a Hermitian matrix using its eigenvalue decomposition. Only eigenvalues larger than a certain threshold will be included to construct the pseudoinverse. This method differs from :py:method:`np.linalg.pinv` in that it uses eigendecomposition instead singular decomposition. It also differs from :py:method:`scipy.linalg.pinvh` in that it includes only positive eigenvalues. This design choice was made to prevent some nearly singular matrices, that contains elementwise error of relative magnitude 1e-7, to give rise to large negative log-likelihood values in Gaussian process regression.

Parameters:
  • H (matrix) – H must be symmetric/self-conjugate, a.k.a. Hermitian.
  • rcond (float) – Cutoff for small eigenvalues. Eigenvalues less than or equal to rcond * largest_eigenvalue and associated eigenvators are discarded in forming the pseudoinverse.
  • mode (str) – Determines how small eigenvalues of the original matrix are handled. For ‘truncate’, small eigenvalues are discarded; for ‘clamp’, they are fixed to be the product of the largest eigenvalue and rcond.
  • return_nlogdet (bool) – Whether or not to return the negative log determinant of the pseudoinverse.
Returns:

graphdot.linalg.spectral.powerh(H, p, rcond=None, mode='truncate', return_symmetric=True, return_eigvals=False)[source]

Compute the fractional power of a Hermitian matrix as defined through eigendecomposition.

Parameters:
  • H (matrix) – H must be symmetric/self-conjugate, a.k.a. Hermitian.
  • p (float) – The power to be raised.
  • rcond (float) – Cutoff for small eigenvalues. Eigenvalues less than or equal to rcond * largest_eigenvalue are discarded.
  • mode (str) – Determines how small eigenvalues of the original matrix are handled. For ‘truncate’, small eigenvalues are discarded; for ‘clamp’, they are fixed to be the product of the largest eigenvalue and rcond.
  • return_symmetric (bool) – Whether or not to make the returned matrix symmetric by multiplying it with the transposed eigenvectors on the right hand side.
Returns:

L:py:math:`H^p`.

Return type:

matrix