utils
Various utilities used by the rest of the library.
Hermitian conjugate of the input array. |
|
Number of elements returned by a slice, assuming a very long array. |
|
Completes a block singular-value decomposition. |
|
Normalises the input array and prints the norm in the logs. |
- temfpy.utils.n_slice(x)[source]
Number of elements returned by a slice, assuming a very long array.
- Return type:
- temfpy.utils.block_svd(CLR, vL, vR, e, degeneracy_tol=1e-12, overwrite=True)[source]
Completes a block singular-value decomposition.
Assuming the matrix \(v_L^\dagger C_{LR} v_R\) is block diagonal, performs the SVD of each block to obtain singular vectors of
CLR.Blocks are delineated by approximately-equal values of
e.- Parameters:
CLR (
ndarray(N, M)) – The matrix whose SVD is sought.vL (
ndarray(N, K)) – The left almost-singular vectors ofCLR.vR (
ndarray(M, K)) – The right almost-singular vectors ofCLR.e (
ndarray(K,)) – Eigenvalues used to delineate blocks.degeneracy_tol (
float) –Threshold for considering consecutive entries of
eequal.Rows/columns
iandi+1are assumed to be in different blocks ifabs(e[i] - e[i+1]) > degeneracy_tol.overwrite (
bool) – OverwritevLandvRwith the signular vectors (default:True).
- Return type:
- Returns:
The singular vectors of
CLR.