# qml.is_unitary¶

is_unitary(op: pennylane.operation.Operator)[source]

Check if the operation is unitary.

A matrix is unitary if its adjoint is also its inverse, that is, if

$O^\dagger O = OO^\dagger = I$
Parameters

op (Operator) – the operator to check against

Returns

True if the operation is unitary, False otherwise

Return type

bool

Note

This check might be expensive for large operators.

Example

>>> op = qml.RX(0.54, wires=0)
>>> qml.is_unitary(op)
True
>>> op2 = op + op
>>> qml.is_unitary(op2)
False