ffsim.random.random_two_body_tensor

ffsim.random.random_two_body_tensor(dim, *, rank=None, seed=None, dtype=<class 'complex'>)[source]

Sample a random two-body tensor.

Parameters:
  • dim (int) – The dimension of the tensor. The shape of the returned tensor will be (dim, dim, dim, dim).

  • rank (int | None) – Rank of the sampled tensor. The default behavior is to use the maximum rank, which is norb * (norb + 1) // 2.

  • seed – A seed to initialize the pseudorandom number generator. Should be a valid input to np.random.default_rng.

  • dtype – The data type to use for the result.

Return type:

ndarray

Returns:

The sampled two-body tensor.