cirq.qis.infer_qid_shape

Infer the qid shape of a set of states.

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.

states The states for which to infer the qid shape.

The inferred qid shape.

ValueError The qid shape of the given states is ambiguous.
ValueError Failed to infer the qid shape of the given states.