ffsim.linalg.double_factorized¶
- ffsim.linalg.double_factorized(two_body_tensor, *, tol=1e-08, max_vecs=None, cholesky=True)[source]¶
Double-factorized decomposition of a two-body tensor.
The double-factorized decomposition is a representation of a two-body tensor \(h_{pqrs}\) as
\[h_{pqrs} = \sum_{t=0}^{L - 1} \sum_{k\ell} Z^{(t)}_{k\ell} U^{(t)}_{pk} U^{(t)}_{qk} U^{(t)}_{r\ell} U^{(t)}_{s\ell},\]where each \(Z^{(t)}\) is a real symmetric matrix representing a diagonal Coulomb operator and each \(U^{(t)}\) is a unitary matrix representing an orbital rotation.
The number of terms \(L\) in the decomposition depends on the allowed error threshold. A larger error threshold may yield a smaller number of terms. Furthermore, the
max_vecsparameter specifies an optional upper bound on \(L\). Themax_vecsparameter is always respected, so if it is too small, then the error of the decomposition may exceed the specified error threshold.This routine performs a straightforward “exact” factorization of the two-body tensor based on a nested eigenvalue decomposition, and then truncates the terms based on the values of
tolandmax_vecs. To further optimize the resulting tensors to reduce the error in the factorization, pass them todouble_factorized_compressed().References
Note: Currently, only real-valued two-body tensors are supported.
- Parameters:
two_body_tensor (
ndarray) – The two-body tensor to decompose.tol (
float) – Tolerance for error in the decomposition. The error is defined as the maximum absolute difference between an element of the original tensor and the corresponding element of the reconstructed tensor.max_vecs (
int|None) – An optional limit on the number of terms to keep in the decomposition of the two-body tensor. This argument overridestol.cholesky (
bool) – Whether to perform the factorization using a modified Cholesky decomposition. If False, a full eigenvalue decomposition is used instead, which can be much more expensive.
- Return type:
- Returns:
The diagonal Coulomb matrices and the orbital rotations. Each list of matrices is collected into a Numpy array, so this method returns a tuple of two Numpy arrays, the first containing the diagonal Coulomb matrices and the second containing the orbital rotations. Each Numpy array will have shape (L, n, n) where L is the number of terms in the decomposition and n is the number of orbitals.
- Raises:
ValueError – The two-body tensor is complex-valued.