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_vectorto describe a pure state. Do not usewavefunction,wave_function, orstatefor this object (stateis too overloaded). - If the object is an array or possibly a computational basis state
(given by an
int), usestate_repor, 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_LIKEand you should usecirq.to_valid_state_vectorto canonicalize as a NumPy array of amplitudes. If a function expects a NumPy array of amplitudes, its type annotation should benp.ndarray. - Use
density_matrixto describe a mixed state that is passed in as a NumPy matrix or NumPy tensor. Do not usedmixed_state,density_operator, orstate.