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 rank squared one-body operators, each built from an independent random matrix sampled from the Gaussian unitary ensemble (see random_hermitian()), or from the Gaussian orthogonal ensemble (see random_real_symmetric_matrix()) if real is 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 to norb * (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:

SingleFactorizedHamiltonian

Returns:

The sampled single-factorized Hamiltonian.