braket.circuits.unitary_calculation module
- braket.circuits.unitary_calculation.calculate_unitary_big_endian(instructions: Iterable[Instruction], qubits: QubitSet) ndarray [source]
Returns the unitary matrix representation for all the
instruction`s on qubits `qubits
.Note
The performance of this method degrades with qubit count. It might be slow for
len(qubits)
> 10.- Parameters:
instructions (Iterable[Instruction]) – The instructions for which the unitary matrix will be calculated.
qubits (QubitSet) – The actual qubits used by the instructions.
- Returns:
np.ndarray – A numpy array with shape (2^qubit_count, 2^qubit_count) representing the
instructions
as a unitary matrix.- Raises:
TypeError – If
instructions
is not composed only ofGate
instances, i.e. a circuit withNoise
operators will raise this error. AnyCompilerDirective
instructions will be ignored, as these should not affect the unitary representation of the circuit.