Function quantum_circuit::statevector()

← Back to Class quantum_circuit



Module quantumClass quantum_circuit → statevector()

Description

Get the statevector \(\ket{\psi}\) of the circuit in little endian order

quantum_circuit::statevector()


Parameters

There are no parameters.


Return Value


Usage Example

import quantum
 
qc = quantum_circuit(2)
 
qc.h(0)
qc.cx(0, 1)
 
state = qc.statevector()
state.print()
 
 
' Output:
' [ 0.707107 + 0i
'          0 + 0i
'          0 + 0i
'   0.707107 + 0i ]