```
@qml.qnode(dev)
def construct_circuit(theta):
qubits=5
wl=[[0, 4, 1.32307045],
[1, 3, 1.3663254999999999],
[1, 4, 1.3517296749999999],
[2, 3, 1.30759795],
[1, 0, 1.325773325],
[2, 4, 1.3012902],
[2, 0, 1.273531925],
[3, 4, 1.390962075],
[2, 1, 1.2958350749999998],
[3, 0, 1.324304475]]
ws=[-0.6845224999999999,
-2.3958211,
-0.49777962500000017,
-0.9059359499999997,
-1.2217257499999996]
n= len(theta)
#print("len",n)
# apply Hadamards to get the n qubit |+> state
for i in range(qubits):
qml.Hadamard(wires=int(i))
j=0
while j<n:
for l in range(len(wl)):
qubit1 = wl[l][0]
qubit2 = wl[l][1]
w = wl[l][2]
qml.CNOT(wires=[qubit1, qubit2])
qml.RZ(-2.0*theta[j]*w, wires=qubit2)
qml.CNOT(wires=[qubit1, qubit2])
for id in range(qubits):
qml.RZ(-2.0*theta[j]*ws[id], wires=id)
j+=1
if (j<n):
for id in range(qubits):
qml.RX(2.0*theta[j], wires=id)
j+=1
return qml.expval(qml.PauliZ(0))
dev = qml.device('qiskit.aer', wires=5, backend='statevector_simulator')
theta=[0.25 0.25]
def f_statevector(theta):
construct_circuit(theta)
statevector=dev._state
print("s[0]",statevector[0])
print("s[1]",statevector[1])
print("s[2]",statevector[2])
print("s[3]",statevector[3])
```

In Qiskit

```
theta=[0.25 0.25]
def construct_circuit(theta,measurement):
global qubits, wl, ws
#print("weightlist", wl)
#print("WS", ws)
if measurement==1:
qc=QuantumCircuit(qubits,qubits)
else:
qc=QuantumCircuit(qubits)
n= len(theta)
for i in range(qubits):
qc.h(i)
j=0
while j<n:
for l in range(len(wlist)):
qc.cx(wl[l][0],wl[l][1])
qc.rz(-2.0*theta[j]*wl[l][2],wl[l][1])
qc.cx(wl[l][0],wl[l][1])
for i in range(qubits):
qc.rz(-2.0*theta[j]*ws[i],i)
j+=1
if (j<n):
for i in range(qubits):
qc.rx(2.0*theta[j],i)
j+=1
return qc
backend_statevector = Aer.get_backend('statevector_simulator')
theta=[0.25 0.25]
def f_statevector(theta):
qc=construct_circuit(theta,0)
statevector=execute(qc,backend_statevector).result().get_statevector(qc)
print("s[0]",statevector[0])
print("s[1]",statevector[1])
print("s[2]",statevector[2])
print("s[3]",statevector[3])
```

Pennylane output…

```
s[0] (-0.12770500535333973+0.06192660660446593j)
s[1] (-0.012925467925004692-0.06881639484412187j)
s[2] (-0.028443830841366216-0.07524954579321873j)
s[3] (-0.004259676780593769-0.2712211586908369j)
```

Qiskit output…

```
s[0] (-0.12770500535333973+0.06192660660446593j)
s[1] (-0.0349974104403304-0.0685326298203696j)
s[2] (0.014842605839478005-0.04481278734342238j)
s[3] (0.10069490106478653-0.24025068613592362j)
```

Although, I am getting the state vector similar to qiskit, but there are at different positions in statevector array using dev.state. Is it possible that statevector should be in same order as qiskit