A map from the Qubits in the Circuit to the index
of this qubit for a canonical ordering. This canonical ordering
is used to define the state (see the state_vector() method).
*args
Passed on to the class that this is mixed in with.
**kwargs
Passed on to the class that this is mixed in with.
Calculates the bloch vector of the given qubit
in the state given by self.state_vector(), given that
self.state_vector() follows the standard Kronecker convention of
numpy.kron.
Args
qubit
qubit whose bloch vector we want to find.
Returns
A length 3 numpy array representing the qubit's bloch vector.
Raises
ValueError
if the size of the state represents more than 25 qubits.
KeyError
if the specified qubit is not in the quantum state.
Calculate the density matrix for the system on the qubits provided.
Any qubits not in the list that are present in self.state_vector() will
be traced out. If qubits is None, the full density matrix for
self.state_vector() is returned, given self.state_vector() follows
standard Kronecker convention of numpy.kron.
For example, if self.state_vector() returns
np.array([1/np.sqrt(2), 1/np.sqrt(2)], dtype=np.complex64),
then density_matrix_of(qubits = None) gives us
Return the state vector at the end of the computation.
The state is returned in the computational basis with these basis
states defined by the qubit_map. In particular the value in the
qubit_map is the index of the qubit, and these are translated into
binary vectors where the last qubit is the 1s bit of the index, the
second-to-last is the 2s bit of the index, and so forth (i.e. big
endian ordering).
Example
qubit_map
{QubitA: 0, QubitB: 1, QubitC: 2}
Then the returned vector will have indices mapped to qubit basis
states like the following table
If True, the returned state vector will be a copy of that
stored by the object. This is potentially expensive for large
state vectors, but prevents mutation of the object state, e.g. for
operating on intermediate states of a circuit.
Defaults to False.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2026-10-08 UTC."],[],[]]