# qml.probs¶

probs(wires)[source]

Probability of each computational basis state.

This measurement function accepts no observables, and instead instructs the QNode to return a flat array containing the probabilities of each quantum state.

Marginal probabilities may also be requested by restricting the wires to a subset of the full system; the size of the returned array will be [2**len(wires)].

Example:

dev = qml.device("default.qubit", wires=2)

@qml.qnode(dev)
def circuit():
return qml.probs(wires=[0, 1])


Executing this QNode:

>>> circuit()
array([0.5, 0.5, 0. , 0. ])


The returned array is in lexicographic order, so corresponds to a $$50\%$$ chance of measuring either $$|00\rangle$$ or $$|01\rangle$$.

Parameters

wires (Sequence[int] or int) – the wire the operation acts on