This page describes naming rules and conventions that exist throughout Cirq. These rules are important in order to maintain a consistent interface that is easy to use. By using consistent naming, we can reduce cognitive load on users and developers. Please try to use these terms when writing code.
If you have suggestions for improvements or changes, please create a PR to modify this list or open an issue.
Quantum computing terms
- Use
state_vector
to describe a pure state. Do not usewavefunction
,wave_function
, orstate
for this object (state
is too overloaded). - If the object is an array or possibly a computational basis state
(given by an
int
), usestate_rep
or, if it is the initial state of a systeminitial_state
. - A function argument (
state_vector
,state_rep
, orinitial_state
) should permit any of the possible representations of a state: A numpy array, a numpy tensor, an integer representing a qubit-system's computational basis state, a sequence of n integers representing a qudit's basis state, or acirq.ProductState
. The type annotation should becirq.STATE_VECTOR_LIKE
and you should usecirq.to_valid_state_vector
to canonicalize as a numpy array of amplitudes. If a function expects a numpy array of amplitudes, its type annotation should benp.ndarray
. - Use
density_matrix
to describe a mixed state that is passed in as a numpy matrix or numpy tensor. Do not usedmixed_state
,density_operator
, orstate
.