I have a quantum circuit illustrated in the provided image, where I perform a series of quantum operations followed by a projective measurement..
Using Qiskit, I've already written the code for this circuit. Now, I'm interested in using the stim library to obtain the final state after the measurement. How can I accomplish this?
Qiskit code is
import numpy as np
from qiskit import QuantumCircuit, transpile, Aer, assemble
qubits = 4
qc = QuantumCircuit(qubits,1)
hx = 1
hz = 1
qc.rx(2*hx,np.arange(qubits))
qc.rz(2*hz,np.arange(qubits))
#even evolution
qc.cx(np.arange(0,qubits-1,2),np.arange(1,qubits,2))
qc.rz(2,np.arange(1,qubits,2))
qc.cx(np.arange(0,qubits-1,2),np.arange(1,qubits,2))
#odd evolution
qc.cx(np.arange(1,qubits-1,2),np.arange(2,qubits,2))
qc.rz(2,np.arange(2,qubits,2))
qc.cx(np.arange(1,qubits-1,2),np.arange(2,qubits,2))
qc.measure(2, 0)
# Transpile the circuit for simulation
simulator = Aer.get_backend('statevector_simulator')
compiled_circuit = transpile(qc, simulator)
# Simulate the circuit and get the final state vector
result = simulator.run(compiled_circuit).result()
final_state_vector = result.get_statevector()
# Print the final state vector
print(final_state_vector)