Say I define a circuit using the amazon-braket-sdk, for example:
braket_circuit = braket.circuits.Circuit()
braket_circuit.h(0)
braket_circuit.h(1)
braket_circuit.h(2)
braket_circuit.rx(0, np.pi / 4)
braket_circuit.ry(1, np.pi / 2)
braket_circuit.rz(2, 3 * np.pi / 4)
Are there any built-in functions that allow you to retrieve the matrix representation of the entire circuit? If all else fails, I know that I can go moment-by-moment, gate-by-gate, and use tensor products to iteratively calculate the circuit's unitary. However, I'm hoping for a one-liner similar to cirq.protocols.unitary
or qiskit.quantum_info.Operator.data
. Does such a function exist in braket? The braket.circuits.quantum_operator.QuantumOperator
class contains a to_matrix
method, but it's not clear if or how a braket Circuit
can be converted to a QuantumOperation
without defining a new, custom QuantumOperation
which would of course require its own implementation of the to_matrix
method. Thanks for any help in advance!