Spanish
Idiomas
English
Bengali
French
German
Japanese
Korean
Portuguese
Spanish
Tamil

DensityMatrix¶

class DensityMatrix(data, dims=None)[fuente]

Bases: `QuantumState`, `TolerancesMixin`

DensityMatrix class

Initialize a density matrix object.

Parámetros
• or (data (np.ndarray or list or matrix_like or QuantumCircuit) – qiskit.circuit.Instruction): A statevector, quantum instruction or an object with a `to_operator` or `to_matrix` method 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).

Muestra

QiskitError – if input data is not valid.

The `dims` kwarg 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.

• `Int` or `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.

Methods

 `conjugate` Return the conjugate of the density matrix. `copy` Make a copy of current operator. `dims` Return tuple of input dimension for specified subsystems. `draw` Return a visualization of the Statevector. `evolve` Evolve a quantum state by an operator. `expand` Return the tensor product state other ⊗ self. `expectation_value` Compute the expectation value of an operator. `from_instruction` Return the output density matrix of an instruction. `from_int` Return a computational basis state density matrix. `from_label` Return a tensor product of Pauli X,Y,Z eigenstates. `is_valid` Return True if trace 1 and positive semidefinite. `measure` Measure subsystems and return outcome and post-measure state. `partial_transpose` Return partially transposed density matrix. `probabilities` Return the subsystem measurement probability vector. `probabilities_dict` Return the subsystem measurement probability dictionary. `purity` Return the purity of the quantum state. `reset` Reset state or subsystems to the 0-state. `reverse_qargs` Return a DensityMatrix with reversed subsystem ordering. `sample_counts` Sample a dict of qubit measurement outcomes in the computational basis. `sample_memory` Sample a list of qubit measurement outcomes in the computational basis. `seed` Set the seed for the quantum state RNG. `tensor` Return the tensor product state self ⊗ other. `to_dict` Convert the density matrix to dictionary form. `to_operator` Convert to Operator `to_statevector` Return a statevector from a pure density matrix. `trace` Return the trace of the density matrix.

Attributes

atol = 1e-08
data

Return data.

dim