cirq.unitary¶
-
cirq.unitary(val: Any, default: TDefault = array([], dtype=float64)) → Union[numpy.ndarray, TDefault][source]¶ Returns a unitary matrix describing the given value.
Parameters: - val – The value to describe with a unitary matrix.
- default – Determines the fallback behavior when val doesn’t have a unitary matrix. If default is not set, a TypeError is raised. If default is set to a value, that value is returned.
Returns: If val has a _unitary_ method and its result is not NotImplemented, that result is returned. Otherwise, if a default value was specified, the default value is returned.
Raises: TypeError– val doesn’t have a _unitary_ method (or that method returned NotImplemented) and also no default value was specified.