- class DensityMatrix(data, dims=None)¶
Initialize a density matrix object.
or (data (np.ndarray or list or matrix_like or QuantumCircuit) – qiskit.circuit.Instruction): A statevector, quantum instruction or an object with a
to_matrixmethod from which the density matrix can be constructed. If a vector the density matrix is constructed as the projector of that vector. If a quantum instruction, the density matrix is constructed by assuming all qubits are initialized in the zero state.
dims (int or tuple or list) – Optional. The subsystem dimension of the state (See additional information).
QiskitError – if input data is not valid.
- Additional Information:
dimskwarg can be None, an integer, or an iterable of integers.
Iterable– the subsystem dimensions are the values in the list with the total number of subsystems given by the length of the list.
None– the leading dimension of the input matrix specifies the total dimension of the density matrix. If it is a power of two the state will be initialized as an N-qubit state. If it is not a power of two the state will have a single d-dimensional subsystem.
Return the conjugate of the density matrix.
Make a copy of current operator.
Return tuple of input dimension for specified subsystems.
Return a visualization of the Statevector.
Evolve a quantum state by an operator.
Return the tensor product state other ⊗ self.
Compute the expectation value of an operator.
Return the output density matrix of an instruction.
Return a computational basis state density matrix.
Return a tensor product of Pauli X,Y,Z eigenstates.
Return True if trace 1 and positive semidefinite.
Measure subsystems and return outcome and post-measure state.
Return partially transposed density matrix.
Return the subsystem measurement probability vector.
Return the subsystem measurement probability dictionary.
Return the purity of the quantum state.
Reset state or subsystems to the 0-state.
Return a DensityMatrix with reversed subsystem ordering.
Sample a dict of qubit measurement outcomes in the computational basis.
Sample a list of qubit measurement outcomes in the computational basis.
Set the seed for the quantum state RNG.
Return the tensor product state self ⊗ other.
Convert the density matrix to dictionary form.
Convert to Operator
Return a statevector from a pure density matrix.
Return the trace of the density matrix.
- atol = 1e-08¶
Return total state dimension.
Return the number of qubits if a N-qubit state or None otherwise.
- rtol = 1e-05¶