A unitary matrix, or a multi-dimensional array of unitary
matrices. Must have shape (..., 4, 4), where the last two axes are
for the unitary matrix and other axes are for broadcasting the kak
vector computation.
rtol
Per-matrix-entry relative tolerance on equality. Used in unitarity
check of input.
atol
Per-matrix-entry absolute tolerance on equality. Used in unitarity
check of input. This also determines how close \(k_x\) must be to π/4
to guarantee \(k_z\) ≥ 0. Must be non-negative.
check_preconditions
When set to False, skips verifying that the input
is unitary in order to increase performance.
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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2026-10-08 UTC."],[],[]]