Skip to content

qttools.kernels.linalg.eig#

source module qttools.kernels.linalg.eig

Functions

  • eig Computes the eigenvalues and eigenvectors of matrices on a given location.

source eig(A: NDArray | list[NDArray], compute_module: str = 'numpy', output_module: str | None = None, use_pinned_memory: bool = True)tuple[NDArray, NDArray] | tuple[list[NDArray], list[NDArray]]

Computes the eigenvalues and eigenvectors of matrices on a given location.

To compute the eigenvalues and eigenvectors on the device with cupy is only possible if the cupy.linalg.eig function is available.

A list of matrices is beneficial if not all the matrices have the same shape. Then the host numba implementation will still parallelize, but not the cupy implementation. Only over the list will be parallelized, further extra dimensions are not allowed.

Assumes that all the input matrices are at the same location.

Parameters

  • A : NDArray | list[NDArray] The matrices.

  • compute_module : str, optional The location where to compute the eigenvalues and eigenvectors. Can be either "numpy" or "cupy".

  • output_module : str, optional The location where to store the eigenvalues and eigenvectors. Can be either "numpy" or "cupy". If None, the output location is the same as the input location

  • use_pinned_memory : bool, optional Whether to use pinnend memory if cupy is used. Default is True.

Returns

  • NDArray | list[NDArray] The eigenvalues.

  • NDArray | list[NDArray] The eigenvectors.

Raises

  • ValueError