In a real quantum computer, can the save_statevector
function be used to obtain the state vector of a circuit? I attempted to run the following code on a real quantum computer but encountered a job rejection. I found that save_statevector
performs measurements on all qubits directly when executed on real quantum computer, yet I haven't found in the official documentation a way to specify which particular qubits to measure using this function. How can I configure the save_statevector
function to measure only the qubits I need? Alternatively, is it the case that this function cannot be utilized on a real quantum computer? Or is there someting wrong with my code?
Here is my code:
from qiskit import QuantumCircuit
from qiskit import transpile
from qiskit_ibm_runtime import QiskitRuntimeService
token='*********************************'
service = QiskitRuntimeService(channel="ibm_quantum", token=token)
backend = service.least_busy(simulator=False, operational=True)
n_qubits = 3
# backend = GenericBackendV2(n_qubits)
# Create a simple circuit
circuit = QuantumCircuit(n_qubits)
circuit.h(0)
circuit.cx(0, 1)
circuit.cx(0, 2)
transpiled_circuit = transpile(circuit, backend)
transpiled_circuit.draw()
transpiled_circuit.save_statevector()
# Run the transpiled circuit using the simulated fake backend
job = backend.run(transpiled_circuit)
result = job.result()
outputstate = result.get_statevector(transpiled_circuit, decimals=100)
print(outputstate)
save_statevector
. $\endgroup$