- qspec.simulate. density_matrix_diagonal ( rho , axis=1 )[source]
-
The diagonal of the density matrix $\operatorname{diag}(\rho)$.
- Parameters:
-
- rhoarray_like
The density matrix $\rho$. Must have the same size in
axisandaxis + 1.- axisint
The axis along which the population is aligned in
rho. The default isaxis = 1, expectingrhoas an array with shape(n, Atom.size, Atom.size, ... ).
- Returns:
-
- rho_diagndarray[floating]
The diagonal of the density matrix as an array with shape
(n, Atom.size, ...).
- Raises:
-
- ValueError
If
rhohas less thanaxis + 2dimensions or different sizes in the axesaxisandaxis + 1.