I want to make combined measurement on the bell state, actually I don’t know if I implement the measurement correctly.
import pennylane as qml
from pennylane import numpy as np
dev = qml.device('default.qubit', wires = ['wire1', 'wire2'], shots = 1000)
@qml.qnode(dev, interface='autograd')
def circuit(params):
qml.RX(params[0], wires = 'wire1') # Rx is applied with the 1st parameter, on the first qubit
qml.RY(params[1], wires = 'wire1') # Ry is applied with the 2nd parameter, on the first qubit
qml.CNOT(wires = ['wire1', 'wire2']) # CNOT is applied on the first and second qubit
#my_circuit(wires = (1,0))
return qml.sample(qml.PauliZ('wire1')), qml.sample(qml.PauliZ('wire2'))
Then I want to see if it is maximally entangled. I follow the tutorial for finding if the two qubits are maximally entangled and type the below codes:
result = circuit(params)
result.shape
np.all(result['wire1'] == result['wire2'])
It returns the error:
only integers, slices (
:), ellipsis (
…), numpy.newaxis (
None) and integer or boolean arrays are valid indices
Can I keep the naming of the wires as string ?
Also, can I measure .sample(), expval(), var(), probs(wires) at the same time?
Thank you!