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.
The tensor is sampled by averaging outer products of
rankindependent random Hermitian matrices. This gives it the symmetries of a two-body integrals tensor,tensor[p, q, r, s] == tensor[r, s, p, q] == tensor[q, p, s, r].conjugate(), and it also makes the tensor positive semidefinite when viewed as a matrix indexed by the orbital pairs(p, q)and(r, s)- a property that it shares with the electron repulsion integrals of a molecule. The maximum rank is the dimension of the space of matrices being summed over, so at the default rank the tensor spans that space.The outer products are averaged rather than summed so that the scale of the tensor does not depend on the rank. As a matrix indexed by orbital pairs, the tensor is a Wishart matrix in the normalization under which the eigenvalue distribution converges to the Marchenko-Pastur law, so its spectrum, and hence the scale of the tensor, stays bounded as
dimgrows at the default rank, which is proportional to the dimensiondim**2of that matrix.- 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 isdim**2ifdtypeis a complex type, anddim * (dim + 1) // 2if it is a real type.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:
- Returns:
The sampled two-body tensor.
References