Hi @Muhammad_Kashif! Welcome
Could you expand more by what you mean by the following?
using Measurement-based quantum computation in pennylane
Regarding your main question,
For example, I build a circuit with two wires and apply a CNOT gate on it. Now, I want to see output for different inouts (00,01,10,11), how can I do that
To do so, we want to first create a ‘device’. This is a quantum simulator, or quantum hardware, that we want to run our computation on. In this case, we’ll simply use the built in default.qubit
simulator that comes with PennyLane:
dev = qml.device("default.qubit", wires=2)
Next, we can create our quantum function. This quantum function executes the gates on our device, and returns a measurement statistic. In this case, we will return the probability.
@qml.qnode(dev)
def circuit():
qml.Hadamard(wires=0)
qml.CNOT(wires=[0, 1])
return qml.probs(wires=[0, 1])
We now execute this quantum function:
>>> circuit()
tensor([0.5, 0. , 0. , 0.5], requires_grad=True)
So we can see that there is a probability of 0.5 of being in the state |00\rangle and |11\rangle, and a probability of 0 of being in the state |01\rangle and |10\rangle.
Let me know if that helps!