cirq.bloch_vector_from_state_vector¶
-
cirq.bloch_vector_from_state_vector(state: Sequence, index: int) → numpy.ndarray[source]¶ Returns the bloch vector of a qubit.
Calculates the bloch vector of the qubit at indexin the wavefunction given by state, assuming state followsthe standard Kronecker convention of numpy.kron.Parameters: - state – A sequence representing a wave function in which the ordering mapping to qubits follows the standard Kronecker convention of numpy.kron.
- index – index of qubit who’s bloch vector we want to find. follows the standard Kronecker convention of numpy.kron.
Returns: A length 3 numpy array representing the qubit’s bloch vector.
Raises: ValueError– if the size of state is not a power of 2.ValueError– if the size of the state represents more than 25 qubits.IndexError– if index is out of range for the number of qubits corresponding to the state.