qml.noise.wires_eq

wires_eq(wires)[source]

Builds a conditional as a BooleanFn for evaluating if a given wire is equal to specified set of wires.

Parameters

wires (Union(Iterable[int, str], Wires, Operation, int, str)) – Object to be used for building the wire set.

Returns

A callable object with signature Union(Iterable[int, str], Wires, Operation, int, str). It evaluates to True if the wire set constructed from the input to the callable is equal to the one built from the specified wires set.

Return type

WiresEq

Raises

ValueError – If the wire set cannot be computed from wires.

Example

One may use wires_eq with a given sequence of wires which are used as a wire set:

>>> cond_func = qml.noise.wires_eq(0)
>>> cond_func(qml.X(0))
True
>>> cond_func(qml.RY(1.23, wires=[3]))
False

Additionally, if an Operation is provided, its wires are extracted and used to build the wire set:

>>> cond_func = qml.noise.wires_eq(qml.RX(1.0, "dino"))
>>> cond_func(qml.RZ(1.23, wires="dino"))
True
>>> cond_func("eve")
False