# Problem with Qiskit statevector simulator

I encounter a sign problem in implementing the Qiskit Statevector simulator.

Here is my code:

from qiskit_aer import AerSimulator, StatevectorSimulator
from qiskit import QuantumCircuit, BasicAer, execute
import numpy as np

circuit = QuantumCircuit(1)
circuit.save_statevector('psi0')
circuit.rz(2*math.pi, 0)
circuit.save_statevector('psi1')

simulator = StatevectorSimulator()
result = execute(circuit, simulator_aerlegacy).result()

data = result.data()

psi0 = data['psi0']
psi1 = data['psi1']

np.inner(psi0, psi1)


I expect the inner product to be "-1" as the "rz(2*math.pi, 0)" is [[-1,0],[0,-1]]. However, the result turns out to be "+1".

I checked the state vectors of "psi0" and "psi1". I have

psi0


to be

Statevector([-1.+1.2246468e-16j, -0.+0.0000000e+00j],
dims=(2,))


and

psi1


to be

Statevector([-1.+1.2246468e-16j, -0.+0.0000000e+00j],
dims=(2,)).


There is an unexpected negative sign for the state vector "psi0".

Does anyone know why this sign problem happens and how to address this "sign problem" in implementing the Qiskit Statevector simulator?

Thanks a lot!

job = execute(circuit, simulator)

The RZ gate is functionally and physically the identity matrix since it is equivalent to the identity matrix multiplied by -1, so the transpiler turned it into a global phase of $$\pi$$ (which is a multiplication by $$e^{i \pi} = -1$$) applied to the statevector from the beginning. If the RZ gate were, say, split up into two RZ gates each with a rotations of $$\pi$$, and then a barrier were placed between the two, the transpiler wouldn't extract the global phase and move it to the front, and you would get -1 as the final inner product answer, among other potential changes that could be made to either the circuit or the configuration to avoid this behavior.