ffsim.random.random_density_matrix¶
- ffsim.random.random_density_matrix(dim, *, seed=None, dtype=<class 'complex'>)[source]¶
Returns a random density matrix distributed with Hilbert-Schmidt measure.
A density matrix is positive semi-definite and has trace equal to one.
- Parameters:
dim (
int) – The width and height of the matrix.seed – A seed to initialize the pseudorandom number generator. Should be a valid input to
np.random.default_rng.
- Return type:
- Returns:
The sampled density matrix.
- Raises:
ValueError – Dimension must be at least one.
References