pygsti.tools.is_valid_density_mx

pygsti.tools.is_valid_density_mx(mx, TOL=1e-09)
Test whether mx is a valid density matrix (hermitian,
positive-definite, and unit trace).
Parameters:
  • mx (numpy array) – Matrix to test.
  • TOL (float, optional) – Tolerance on absolute magitude of elements.
Returns:

True if mx is a valid density matrix, otherwise False.

Return type:

bool