pygsti.tools.matrixtools.is_projector

Contents

pygsti.tools.matrixtools.is_projector#

is_projector(mx, tol=1e-12)#

Test whether mx is an orthogonal projector, i.e. Hermitian and idempotent.

Parameters:
  • mx (numpy array) – Matrix to test.

  • tol (float, optional) – Tolerance for the Hermiticity and idempotency checks. The idempotency check compares mx @ mx to mx with absolute and relative tolerances of sqrt(mx.size) * tol. We use a stringent default tolerance since projectors tend to be computed to high accuracy. Passing tol=np.inf skips all checks and returns True.

Returns:

True if mx is (numerically) an orthogonal projector, otherwise False.

Return type:

bool