We're celebrating World Quantum Day 2022! Join us

Module: cirq.qis.states

Classes and methods for quantum states.


class QuantumState: A quantum state.


bloch_vector_from_state_vector(...): Returns the bloch vector of a qubit.

density_matrix(...): Create a QuantumState object from a density matrix.

density_matrix_from_state_vector(...): Returns the density matrix of the state vector.

dirac_notation(...): Returns the state vector as a string in Dirac notation.

eye_tensor(...): Returns an identity matrix reshaped into a tensor.

infer_qid_shape(...): Infer the qid shape of a set of states.

one_hot(...): Returns a numpy array with all 0s and a single non-zero entry(default 1).

quantum_state(...): Create a QuantumState object from a state-like object.

to_valid_density_matrix(...): Verifies the density_matrix_rep is valid and converts it to ndarray form.

to_valid_state_vector(...): Verifies the state_rep is valid and converts it to ndarray form.

validate_density_matrix(...): Checks that the given density matrix is valid.

validate_indices(...): Validates that the indices have values within range of num_qubits.

validate_normalized_state_vector(...): Checks that the given state vector is valid.

validate_qid_shape(...): Validates the size of the given state_vector against the given shape.

Type Aliases