qml.pow

pow(base, z=1, lazy=True, do_queue=True, id=None)[source]

Raise an Operator to a power.

Parameters
  • base (Operator) – the operator to be raised to a power

  • z=1 (float) – the exponent

Keyword Arguments
  • lazy=True (bool) – In lazy mode, all operations are wrapped in a Pow class and handled later. If lazy=False, operation-specific simplifications are first attempted.

  • do_queue (bool) – indicates whether the operator should be recorded when created in a tape context

  • id (str) – custom label given to an operator instance, can be useful for some applications where the instance has to be identified

Returns

Operator

See also

Pow, pow().

Example

>>> qml.pow(qml.PauliX(0), 0.5)
PauliX(wires=[0])**0.5
>>> qml.pow(qml.PauliX(0), 0.5, lazy=False)
SX(wires=[0])
>>> qml.pow(qml.PauliX(0), 0.1, lazy=False)
PauliX(wires=[0])**0.1
>>> qml.pow(qml.PauliX(0), 2, lazy=False)
Identity(wires=[0])

Lazy behavior can also be accessed via op ** z.