View source on GitHub |
Compute the KAK vectors of one or more two qubit unitaries.
cirq.kak_vector(
unitary: Union[Iterable[np.ndarray], np.ndarray],
*,
rtol: float = 1e-05,
atol: float = 1e-08,
check_preconditions: bool = True
) -> np.ndarray
Any 2 qubit unitary may be expressed as
\[ U = k_l A k_r \]
where \(k_l, k_r\) are single qubit (local) unitaries and
\[ A= \exp \left(i \sum_{s=x,y,z} k_s \sigma_{s}^{(0)} \sigma_{s}^{(1)} \right) \]
The vector entries are ordered such that
$$ 0 ≤ |k_z| ≤ k_y ≤ k_x ≤ π/4 $$
if \(k_x\) = π/4, \(k_z \geq 0\).
References | |
---|---|
The appendix section of "Lower bounds on the complexity of simulating quantum gates". http://arxiv.org/abs/quant-ph/0307190v1 |
Examples | |
---|---|
|
Returns | |
---|---|
The KAK vector of the given unitary or unitaries. The output shape is
the same as the input shape, except the two unitary matrix axes are
replaced by the kak vector axis (i.e. the output has shape
unitary.shape[:-2] + (3,) ).
|
Raises | |
---|---|
ValueError
|
If atol is negative or if the unitary has the wrong shape.
|