Skip to content

Commit

Permalink
Fix density matrix use of Circuit
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric-Arellano committed Nov 22, 2024
1 parent 5ce3542 commit 2a17b94
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions qiskit/quantum_info/states/densitymatrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,19 +305,17 @@ def _multiply(self, other):

def evolve(
self,
other: Operator | QuantumChannel | Instruction | QuantumCircuit,
other: Operator | QuantumChannel | circuit.instruction.Instruction | QuantumCircuit,
qargs: list[int] | None = None,
) -> DensityMatrix:
"""Evolve a quantum state by an operator.
Args:
other (Operator or QuantumChannel
or Instruction or Circuit): The operator to evolve by.
qargs (list): a list of QuantumState subsystem positions to apply
the operator on.
other: The operator to evolve by.
qargs: a list of QuantumState subsystem positions to apply the operator on.
Returns:
DensityMatrix: the output density matrix.
The output density matrix.
Raises:
QiskitError: if the operator dimension does not match the
Expand Down Expand Up @@ -600,18 +598,20 @@ def from_int(i: int, dims: int | tuple | list) -> DensityMatrix:
return DensityMatrix(state, dims=dims)

@classmethod
def from_instruction(cls, instruction: Instruction | QuantumCircuit) -> DensityMatrix:
def from_instruction(
cls, instruction: circuit.instruction.Instruction | QuantumCircuit
) -> DensityMatrix:
"""Return the output density matrix of an instruction.
The statevector is initialized in the state :math:`|{0,\\ldots,0}\\rangle` of
the same number of qubits as the input instruction or circuit, evolved
by the input instruction, and the output statevector returned.
Args:
instruction (qiskit.circuit.Instruction or QuantumCircuit): instruction or circuit
instruction: instruction or circuit
Returns:
DensityMatrix: the final density matrix.
The final density matrix.
Raises:
QiskitError: if the instruction contains invalid instructions for
Expand Down

0 comments on commit 2a17b94

Please sign in to comment.