3.1. tnpy.linalg#

Functions

eigh(matrix[, k, backend])

param matrix

Hermitian or real symmetric matrices whose eigenvalues and eigenvectors

eigshmv(linear_operator, v0[, k, which, tol])

param linear_operator

qr(matrix, cutoff)

param matrix

Input Matrix.

svd(matrix, cutoff)

param matrix

Input Matrix.

tnpy.linalg.svd(matrix, cutoff)[source]#
Parameters
  • matrix (numpy.ndarray) – Input Matrix.

  • cutoff (int) – Truncation dimensions.

Return type

Tuple[numpy.ndarray, numpy.ndarray, numpy.ndarray]

Returns:

tnpy.linalg.qr(matrix, cutoff)[source]#
Parameters
  • matrix (numpy.ndarray) – Input Matrix.

  • cutoff (int) – Truncation dimensions.

Return type

Tuple[numpy.ndarray, numpy.ndarray]

Returns:

tnpy.linalg.eigh(matrix, k=1, backend='numpy', **kwargs)[source]#
Parameters
  • matrix (numpy.ndarray) – Hermitian or real symmetric matrices whose eigenvalues and eigenvectors are to be computed.

  • k (int) – The number of eigenpairs to be computed.

  • backend (str) – (‘numpy’ or ‘scipy’).

  • **kwargs – Keyword arguments for scipy solver.

Return type

Tuple[float | numpy.ndarray, numpy.ndarray]

Returns:

tnpy.linalg.eigshmv(linear_operator, v0, k=1, which='SA', tol=0, **kwargs)[source]#
Parameters
  • linear_operator (scipy.sparse.linalg._interface.LinearOperator) –

  • v0 (numpy.ndarray) – Initial guesses to the eigenvectors.

  • k (int) – The number of eigenpairs to be computed.

  • which (str) – Which k eigenvectors and eigenvalues to find.

  • tol (float) – Tolerance for eigenpairs (stopping criterion). The default value is sqrt of machine precision.

  • **kwargs – Keyword arguments for primme solver.

Return type

Tuple[float | numpy.ndarray, numpy.ndarray]

Returns: