qbraid.interface.rev_qubits_unitary
- rev_qubits_unitary(matrix)[source]
Peforms Kronecker (tensor) product factor permutation of given matrix. Returns a matrix equivalent to that computed from a quantum circuit if its qubit indicies were reversed.
- Parameters
matrix (np.ndarray) – The input matrix, assumed to be a 2^N x 2^N square matrix where N is an integer.
- Returns
The matrix with permuted Kronecker product factors.
- Return type
np.ndarray
- Raises
ValueError – If the input matrix is not square or its size is not a power of 2.