Skip to main content

sites

Method of OperatorNamed.

sites() -> List

Returns the sites of a named operator in definition order. Unlike support(), this preserves the order of sites as they appear in the operator definition. Important: The order returned is the constructor order, not necessarily the order of mathematical application.

Returns

A list of indices representing the qubits the operator acts on, in the order they were specified in the constructor.

Example

var op1 = X(0)
var sites1 = sites(op1) // Returns [0]
var op2 = XX(0, 1)
var sites2 = sites(op2) // Returns [0, 1]