qml.math.convert_to_su2

convert_to_su2(U, return_global_phase=False)[source]

Convert a 2x2 unitary matrix to \(SU(2)\). (batched operation)

Parameters:
  • U (array[complex]) – A matrix with a batch dimension, presumed to be of shape \(n \times 2 \times 2\) and unitary for any positive integer n.

  • return_global_phase (bool) – If True, the return will include the global phase. If False, only the \(SU(2)\) representation is returned.

Returns:

A \(n \times 2 \times 2\) matrix in \(SU(2)\) that is equivalent to U up to a global phase. If return_global_phase=True, a 2-element tuple is returned, with the first element being the \(SU(2)\) equivalent and the second, the global phase.

Return type:

array[complex]