pytspl.decomposition.eigendecomposition

Module to perform eigendecomposition and obtain eigenvalues and eigenvectors (eigenpairs).

After eigendecomposition, the components are extracted into gradient, curl and harmonic eigenvalues and eigenvectors (eigenpairs).

Functions

get_total_variance(→ float)

Calculate the total variance.

get_divergence(→ numpy.ndarray)

Calculate the divergence.

get_curl(→ numpy.ndarray)

Calculate the curl.

get_gradient_eigenpair(.eps) → tuple)

Calculate the gradient eigenvectors of the lower Laplacian.

get_curl_eigenpair(.eps) → tuple)

Calculate the curl eigenvectors of the upper Laplacian.

get_harmonic_eigenpair(.eps) → tuple)

Calculate the harmonic eigenvectors of the Hodge Laplacian

get_eigendecomposition(.eps) → tuple)

Calculate the eigenvectors of the Laplacian matrix using

Module Contents

pytspl.decomposition.eigendecomposition.get_total_variance(laplacian_matrix: numpy.ndarray) float[source]

Calculate the total variance.

Args:

laplacian_matrix (np.ndarray): The Laplacian matrix L(k).

Returns:

float: The total variance.

pytspl.decomposition.eigendecomposition.get_divergence(B1: numpy.ndarray, flow: numpy.ndarray) numpy.ndarray[source]

Calculate the divergence.

Args:

B1 (np.ndarray): The incidence matrix B1. flow (np.ndarray): The edge flow.

Returns:

np.ndarray: The divergence of the flow.

pytspl.decomposition.eigendecomposition.get_curl(B2: numpy.ndarray, flow: numpy.ndarray) numpy.ndarray[source]

Calculate the curl.

Args:

B2 (np.ndarray): The incidence matrix B2. flow (np.ndarray): The edge flow.

Returns:

np.ndarray: The curl of the flow.

pytspl.decomposition.eigendecomposition.get_gradient_eigenpair(lower_lap_mat: numpy.ndarray, tolerance: float = np.finfo(float).eps) tuple[source]

Calculate the gradient eigenvectors of the lower Laplacian. e.g. L1L with corresponding eigenvalues.

Args:

lower_lap_mat (np.ndarray): The lower Laplacian matrix L(k, l) tolerance (float): The tolerance for eigenvalues to be considered zero. Defaults to machine limits for floating point types.

Returns:

np.ndarray: The gradient eigenvectors U(G) np.ndarray: The eigenvalues of the lower Laplacian

pytspl.decomposition.eigendecomposition.get_curl_eigenpair(upper_lap_mat: numpy.ndarray, tolerance: float = np.finfo(float).eps) tuple[source]

Calculate the curl eigenvectors of the upper Laplacian. e.g. L1U with corresponding eigenvalues.

Args:

upper_lap_mat (np.ndarray): The upper Laplacian matrix L(k, u). tolerance (float): The tolerance for eigenvalues to be considered zero. Defaults to machine limits for floating point types.

Returns:

np.ndarray: The curl eigenvectors U(C) np.ndarray: The eigenvalues of the upper Laplacian

pytspl.decomposition.eigendecomposition.get_harmonic_eigenpair(hodge_lap_mat: numpy.ndarray, tolerance: float = np.finfo(float).eps) tuple[source]

Calculate the harmonic eigenvectors of the Hodge Laplacian e.g. L1 with corresponding eigenvalues.

Args:

hodge_lap_mat (np.ndarray): The Hodge Laplacian matrix L(k) tolerance (float): The tolerance for eigenvalues to be considered zero. Defaults to machine limits for floating point types.

Returns:

np.ndarray: The harmonic eigenvectors U(H). np.ndarray: The eigenvalues of the Hodge Laplacian.

pytspl.decomposition.eigendecomposition.get_eigendecomposition(lap_mat: numpy.ndarray, tolerance: float = np.finfo(float).eps) tuple[source]

Calculate the eigenvectors of the Laplacian matrix using eigendecomposition.

The eigendecomposition of the Hodge Laplacian is given by: L(k) = U(k) * lambda(k) * U(k).T

Sorts the eigenvectors according to the sorted eigenvalues.

Args:

lap_mat (np.ndarray): The Laplacian matrix L(k). tolerance (float): The tolerance for eigenvalues to be considered zero. Defaults to machine limits for floating point types.

Returns:

np.ndarray: The eigenvectors U(k) np.ndarray: The eigenvalues.