Infer the qid shape of a set of states.
cirq.qis.infer_qid_shape(
*states
) -> Tuple[int, ...]
This is a heuristic to determine a qid shape compatible with all of the
given states. It works by attempting to find the intersection of the sets
of potential qid shapes for each given state. It may fail (raising an
error) even if there is a unique compatible qid shape. If the dimension of
a state vector or density matrix (but not state tensor) is a power of 2,
then the state space is assumed to be composed of qubits; otherwise, it is
assumed to be composed of a single qudit. If the qid shape is ambiguous,
an error is raised.
Args |
states
|
The states for which to infer the qid shape.
|
Returns |
The inferred qid shape.
|
Raises |
ValueError
|
The qid shape of the given states is ambiguous.
|
ValueError
|
Failed to infer the qid shape of the given states.
|