qics.quantum.random.density_matrix¶ qics.quantum.random.density_matrix(n, iscomplex=False)[source]¶ Generate a random density matrix, i.e., positive semidefinite matrix \(X\in\mathbb{H}^n\) satisfying \(\text{tr}[X] = 1\), uniformly on the on the Haar measure. Parameters: nintDimension of random density matrix \(X\). iscomplexbool, optionalWhether the matrix is real (False) or complex (True). The default is False. Returns: ndarrayRandom density matrix of dimension (n, n).