Hello, I have a simple question. The single qubit rotation gate, like RX,RY,RZ only accepts one parameter,see qml.RX.
But we can still pass multiple parameters in Pennylane. see the code below.
dev = qml.device("default.qubit", wires=2)
@qml.qnode(dev)
def my_quantum_function(x, y):
qml.RX(x, wires=0)
qml.CNOT(wires=[0, 1])
qml.RY(y, wires=1)
return qml.state()
my_quantum_function([0.1,0.2,0.3], 0.2)
# below is the output:
tensor([[0.99376067+0.j , 0.09970865+0.j ,
0. +0.00498959j, 0. -0.04972948j],
[0.99003329+0.j , 0.09933467+0.j ,
0. +0.00996671j, 0. -0.09933467j],
[0.98383134+0.j , 0.09871239+0.j ,
0. +0.01491892j, 0. -0.14869156j]], requires_grad=True)
Here we only used two qubits, but got 12 statevectors since RX gate is given three parameters, i.e., [0.1,0.2,0.3]. I’m wondering what is the detailed computation behind the three parameters or say why we get 12 statevectors.
One more question is that how to print out the statevector with computational basis,
dev = qml.device("default.qubit", wires=2)
@qml.qnode(dev)
def circuit():
qml.Hadamard(wires=1)
return qml.state()
circuit()
#below is the output:
tensor([0.70710678+0.j, 0.70710678+0.j, 0. +0.j, 0. +0.j])
can we give a printout like 1/ \sqrt{2} |00> + 1/ \sqrt{2} |01> ? Thank you