eigenvalue_decomposition¶
-
menpo.math.
eigenvalue_decomposition
(C, is_inverse=False, eps=1e-10)[source]¶ Eigenvalue decomposition of a given covariance (or scatter) matrix.
- Parameters
C (
(N, N)
ndarray or scipy.sparse) – The Covariance/Scatter matrix. If it is a numpy.array, then numpy.linalg.eigh is used. If it is an instance of scipy.sparse, then scipy.sparse.linalg.eigsh is used. If it is a precision matrix (inverse covariance), then set is_inverse=True.is_inverse (bool, optional) – It
True
, then it is assumed that C is a precision matrix ( inverse covariance). Thus, the eigenvalues will be inverted. IfFalse
, then it is assumed that C is a covariance matrix.eps (float, optional) –
Tolerance value for positive eigenvalue. Those eigenvalues smaller than the specified eps value, together with their corresponding eigenvectors, will be automatically discarded. The final limit is computed as
limit = np.max(np.abs(eigenvalues)) * eps
- Returns
pos_eigenvectors (
(N, p)
ndarray) – The matrix with the eigenvectors corresponding to positive eigenvalues.pos_eigenvalues (
(p,)
ndarray) – The array of positive eigenvalues.