qml.labs.dla.check_orthonormal

check_orthonormal(g, inner_product)[source]

Utility function to check if operators in g are orthonormal with respect to the provided inner_product.

Parameters:
  • g (Iterable[Union[PauliSentence, Operator]]) – List of operators

  • inner_product (callable) – Inner product function to check orthonormality

Returns:

True if the operators are orthonormal, False otherwise.

Return type:

bool

See also

trace_inner_product(), orthonormalize()

Example

>>> from pennylane.labs.dla import orthonormalize, check_orthonormal
>>> ops = [qml.X(0), qml.X(0) + qml.Y(0), qml.Y(0) + qml.Z(0)]
>>> check_orthonormal(ops, qml.pauli.trace_inner_product)
False
>>> ops_orth = orthonormalize(ops)
>>> check_orthonormal(ops_orth, trace_inner_product)
True