# One Qubit Unitary Rotation

I am confused as to how to implement one_qubit_unitary function that enacts a rotation of the bloch sphere depending on the value in symbols using pennylane. Right now is my code.

def one_qubit_unitary(bit, symbols):

"""Make a circuit enacting a rotation of the bloch sphere about the X,

Y and Z axis, that depends on the values in `symbols`.

"""

qml.X(bit) ** symbols[0]

qml.Y(bit) ** symbols[1]

qml.Z(bit) ** symbols[2]

return qml.expval(qml.X(0))

The implementation in Cirq is like this and it should create a circuit like this:

def one_qubit_unitary(bit, symbols):

return cirq.Circuit(        cirq.X(bit)**symbols[0],        cirq.Y(bit)**symbols[1],        cirq.Z(bit)**symbols[2])

I just need a bit of help in getting an equivalent circuit to work as right now I am getting type error: unsupported operand type(s) for ** or pow(): ‘X’ and ‘Symbol’.

Thanks

Hi @qjcTpy, welcome to the forum!

qml.ops.op_math.Pow represents an operator raised to a power.
When decomposition() is called, a list of new operators equal to this one raised to the given power is given:

op = qml.ops.op_math.Pow(qml.PauliX(0), 0.5)
op.decomposition()
qml.matrix(op)

Please let me know if this helps!