ffsim.random.random_single_factorized_hamiltonian¶
- ffsim.random.random_single_factorized_hamiltonian(norb, *, rank=None, real=False, seed=None)[source]¶
Sample a random single-factorized Hamiltonian.
The two-body part of the Hamiltonian is a sum of
ranksquared one-body operators, each built from an independent random matrix sampled from the Gaussian unitary ensemble (seerandom_hermitian()), or from the Gaussian orthogonal ensemble (seerandom_real_symmetric_matrix()) ifrealis True. These matrices are divided by the square root of the rank, which makes the two-body tensor an average over the terms rather than a sum, so that its scale remains bounded as the rank grows.- Parameters:
norb (
int) – The number of spatial orbitals.rank (
int|None) – The desired number of terms in the two-body part of the Hamiltonian. If not specified, it will be set tonorb * (norb + 1) // 2.real (
bool) – Whether to sample a real-valued object rather than a complex-valued one.seed – A seed to initialize the pseudorandom number generator. Should be a valid input to
np.random.default_rng.
- Return type:
- Returns:
The sampled single-factorized Hamiltonian.