QPanda3  0.1.0
Supported by OriginQ
Loading...
Searching...
No Matches
pyqpanda3.quantum_info.DensityMatrix Class Reference

Public Member Functions

None __init__ (self)
 init(*args, **kwargs) Overloaded function.
 
None __init__ (self, DensityMatrix other)
 init(*args, **kwargs) Overloaded function.
 
None __init__ (self, list[list[complex]] data)
 init(*args, **kwargs) Overloaded function.
 
None __init__ (self, numpy.ndarray[numpy.complex128[m, n]] data)
 init(*args, **kwargs) Overloaded function.
 
None __init__ (self, int qbit_total)
 init(*args, **kwargs) Overloaded function.
 
None __init__ (self, other)
 init(*args, **kwargs) Overloaded function.
 
complex at (self, int row_idx, int col_idx)
 at(self: quantum_info.DensityMatrix, row_idx: int, col_idx: int) -> complex
 
int dim (self)
 dim(self: quantum_info.DensityMatrix) -> int
 
DensityMatrix evolve (self, circuit)
 evolve(self: quantum_info.DensityMatrix, circuit: QPanda::QCircuit) -> quantum_info.DensityMatrix
 
bool is_valid (self)
 is_valid(self: quantum_info.DensityMatrix) -> bool
 
numpy.ndarray[numpy.complex128] ndarray (self)
 ndarray(self: quantum_info.DensityMatrix) -> numpy.ndarray[numpy.complex128]
 
complex purity (self)
 purity(self: quantum_info.DensityMatrix) -> complex
 
list[complex] to_statevector (self)
 to_statevector(self: quantum_info.DensityMatrix) -> list[complex]
 
DensityMatrix update_by_evolve (self, circuit)
 update_by_evolve(self: quantum_info.DensityMatrix, circuit: QPanda::QCircuit) -> quantum_info.DensityMatrix
 
bool __eq__ (self, DensityMatrix other)
 eq(self: quantum_info.DensityMatrix, other: quantum_info.DensityMatrix) -> bool
 

Constructor & Destructor Documentation

◆ __init__() [1/6]

None pyqpanda3.quantum_info.DensityMatrix.__init__ ( self)

init(*args, **kwargs) Overloaded function.

  1. init(self: quantum_info.DensityMatrix) -> None

Default constructor, which by default constructs a density matrix for a quantum system with only one qubit and its current state being all zeros.

  1. init(self: quantum_info.DensityMatrix, other: quantum_info.DensityMatrix) -> None

Generate a DensityMatrix object from another DensityMatrix

Parameters
otheranother DensityMatrix
  1. init(self: quantum_info.DensityMatrix, data: list[list[complex]]) -> None

Construct a density matrix based on the input 2D complex number array.

Parameters
dataa 2D complex number array
  1. init(self: quantum_info.DensityMatrix, data: numpy.ndarray[numpy.complex128[m, n]]) -> None

Construct a density matrix based on the input 2D complex number array.

Parameters
dataa 2D complex number array
  1. init(self: quantum_info.DensityMatrix, qbit_total: int) -> None

Specify the total number of qubits in the quantum system and generate a density matrix where the state of each qubit is currently 0.

Parameters
qbit_totalthe total number of qubits in the quantum system
  1. init(self: quantum_info.DensityMatrix, other: QPanda::QuantumInformation::StateVector) -> None

Construct a new DensityMatrix object based on an existing StateVector object.

Parameters
otheran existing StateVector object.

◆ __init__() [2/6]

None pyqpanda3.quantum_info.DensityMatrix.__init__ ( self,
DensityMatrix other )

init(*args, **kwargs) Overloaded function.

  1. init(self: quantum_info.DensityMatrix) -> None

Default constructor, which by default constructs a density matrix for a quantum system with only one qubit and its current state being all zeros.

  1. init(self: quantum_info.DensityMatrix, other: quantum_info.DensityMatrix) -> None

Generate a DensityMatrix object from another DensityMatrix

Parameters
otheranother DensityMatrix
  1. init(self: quantum_info.DensityMatrix, data: list[list[complex]]) -> None

Construct a density matrix based on the input 2D complex number array.

Parameters
dataa 2D complex number array
  1. init(self: quantum_info.DensityMatrix, data: numpy.ndarray[numpy.complex128[m, n]]) -> None

Construct a density matrix based on the input 2D complex number array.

Parameters
dataa 2D complex number array
  1. init(self: quantum_info.DensityMatrix, qbit_total: int) -> None

Specify the total number of qubits in the quantum system and generate a density matrix where the state of each qubit is currently 0.

Parameters
qbit_totalthe total number of qubits in the quantum system
  1. init(self: quantum_info.DensityMatrix, other: QPanda::QuantumInformation::StateVector) -> None

Construct a new DensityMatrix object based on an existing StateVector object.

Parameters
otheran existing StateVector object.

◆ __init__() [3/6]

None pyqpanda3.quantum_info.DensityMatrix.__init__ ( self,
list[list[complex]] data )

init(*args, **kwargs) Overloaded function.

  1. init(self: quantum_info.DensityMatrix) -> None

Default constructor, which by default constructs a density matrix for a quantum system with only one qubit and its current state being all zeros.

  1. init(self: quantum_info.DensityMatrix, other: quantum_info.DensityMatrix) -> None

Generate a DensityMatrix object from another DensityMatrix

Parameters
otheranother DensityMatrix
  1. init(self: quantum_info.DensityMatrix, data: list[list[complex]]) -> None

Construct a density matrix based on the input 2D complex number array.

Parameters
dataa 2D complex number array
  1. init(self: quantum_info.DensityMatrix, data: numpy.ndarray[numpy.complex128[m, n]]) -> None

Construct a density matrix based on the input 2D complex number array.

Parameters
dataa 2D complex number array
  1. init(self: quantum_info.DensityMatrix, qbit_total: int) -> None

Specify the total number of qubits in the quantum system and generate a density matrix where the state of each qubit is currently 0.

Parameters
qbit_totalthe total number of qubits in the quantum system
  1. init(self: quantum_info.DensityMatrix, other: QPanda::QuantumInformation::StateVector) -> None

Construct a new DensityMatrix object based on an existing StateVector object.

Parameters
otheran existing StateVector object.

◆ __init__() [4/6]

None pyqpanda3.quantum_info.DensityMatrix.__init__ ( self,
numpy.ndarray[numpy.complex128[m, n]] data )

init(*args, **kwargs) Overloaded function.

  1. init(self: quantum_info.DensityMatrix) -> None

Default constructor, which by default constructs a density matrix for a quantum system with only one qubit and its current state being all zeros.

  1. init(self: quantum_info.DensityMatrix, other: quantum_info.DensityMatrix) -> None

Generate a DensityMatrix object from another DensityMatrix

Parameters
otheranother DensityMatrix
  1. init(self: quantum_info.DensityMatrix, data: list[list[complex]]) -> None

Construct a density matrix based on the input 2D complex number array.

Parameters
dataa 2D complex number array
  1. init(self: quantum_info.DensityMatrix, data: numpy.ndarray[numpy.complex128[m, n]]) -> None

Construct a density matrix based on the input 2D complex number array.

Parameters
dataa 2D complex number array
  1. init(self: quantum_info.DensityMatrix, qbit_total: int) -> None

Specify the total number of qubits in the quantum system and generate a density matrix where the state of each qubit is currently 0.

Parameters
qbit_totalthe total number of qubits in the quantum system
  1. init(self: quantum_info.DensityMatrix, other: QPanda::QuantumInformation::StateVector) -> None

Construct a new DensityMatrix object based on an existing StateVector object.

Parameters
otheran existing StateVector object.

◆ __init__() [5/6]

None pyqpanda3.quantum_info.DensityMatrix.__init__ ( self,
int qbit_total )

init(*args, **kwargs) Overloaded function.

  1. init(self: quantum_info.DensityMatrix) -> None

Default constructor, which by default constructs a density matrix for a quantum system with only one qubit and its current state being all zeros.

  1. init(self: quantum_info.DensityMatrix, other: quantum_info.DensityMatrix) -> None

Generate a DensityMatrix object from another DensityMatrix

Parameters
otheranother DensityMatrix
  1. init(self: quantum_info.DensityMatrix, data: list[list[complex]]) -> None

Construct a density matrix based on the input 2D complex number array.

Parameters
dataa 2D complex number array
  1. init(self: quantum_info.DensityMatrix, data: numpy.ndarray[numpy.complex128[m, n]]) -> None

Construct a density matrix based on the input 2D complex number array.

Parameters
dataa 2D complex number array
  1. init(self: quantum_info.DensityMatrix, qbit_total: int) -> None

Specify the total number of qubits in the quantum system and generate a density matrix where the state of each qubit is currently 0.

Parameters
qbit_totalthe total number of qubits in the quantum system
  1. init(self: quantum_info.DensityMatrix, other: QPanda::QuantumInformation::StateVector) -> None

Construct a new DensityMatrix object based on an existing StateVector object.

Parameters
otheran existing StateVector object.

◆ __init__() [6/6]

None pyqpanda3.quantum_info.DensityMatrix.__init__ ( self,
other )

init(*args, **kwargs) Overloaded function.

  1. init(self: quantum_info.DensityMatrix) -> None

Default constructor, which by default constructs a density matrix for a quantum system with only one qubit and its current state being all zeros.

  1. init(self: quantum_info.DensityMatrix, other: quantum_info.DensityMatrix) -> None

Generate a DensityMatrix object from another DensityMatrix

Parameters
otheranother DensityMatrix
  1. init(self: quantum_info.DensityMatrix, data: list[list[complex]]) -> None

Construct a density matrix based on the input 2D complex number array.

Parameters
dataa 2D complex number array
  1. init(self: quantum_info.DensityMatrix, data: numpy.ndarray[numpy.complex128[m, n]]) -> None

Construct a density matrix based on the input 2D complex number array.

Parameters
dataa 2D complex number array
  1. init(self: quantum_info.DensityMatrix, qbit_total: int) -> None

Specify the total number of qubits in the quantum system and generate a density matrix where the state of each qubit is currently 0.

Parameters
qbit_totalthe total number of qubits in the quantum system
  1. init(self: quantum_info.DensityMatrix, other: QPanda::QuantumInformation::StateVector) -> None

Construct a new DensityMatrix object based on an existing StateVector object.

Parameters
otheran existing StateVector object.

Member Function Documentation

◆ __eq__()

bool pyqpanda3.quantum_info.DensityMatrix.__eq__ ( self,
DensityMatrix other )

eq(self: quantum_info.DensityMatrix, other: quantum_info.DensityMatrix) -> bool

Equality check. Determine if the internal data of two DensityMatrix objects are equal.

Parameters
DensityMatrixanother DensityMatrix object
Returns
Bool if they are same, return true.

◆ at()

complex pyqpanda3.quantum_info.DensityMatrix.at ( self,
int row_idx,
int col_idx )

at(self: quantum_info.DensityMatrix, row_idx: int, col_idx: int) -> complex

Retrieve a specific element of the internal data using matrix row and column indices

Parameters
row_idxrow indices
col_idxcol indices
Returns
a specific element of the internal data

◆ dim()

int pyqpanda3.quantum_info.DensityMatrix.dim ( self)

dim(self: quantum_info.DensityMatrix) -> int

Retrieve the number of ground states corresponding to the density matrix

Returns
the number of ground states corresponding to the density matrix.

◆ evolve()

DensityMatrix pyqpanda3.quantum_info.DensityMatrix.evolve ( self,
circuit )

evolve(self: quantum_info.DensityMatrix, circuit: QPanda::QCircuit) -> quantum_info.DensityMatrix

Evolve the density matrix using the quantum circuit QCircuit without updating the internal data of the original DensityMatrix object; the evolution result is returned as a new DensityMatrix object

Parameters
circuita quantum circuit QCircuit
Returns
a new DensityMatrix object

◆ is_valid()

bool pyqpanda3.quantum_info.DensityMatrix.is_valid ( self)

is_valid(self: quantum_info.DensityMatrix) -> bool

Validate the internal data of the density matrix.

Returns
if is valid, return true

◆ ndarray()

numpy.ndarray[numpy.complex128] pyqpanda3.quantum_info.DensityMatrix.ndarray ( self)

ndarray(self: quantum_info.DensityMatrix) -> numpy.ndarray[numpy.complex128]

Generate a numpy.ndarray object using data in self

Returns
a numpy.ndarray object

◆ purity()

complex pyqpanda3.quantum_info.DensityMatrix.purity ( self)

purity(self: quantum_info.DensityMatrix) -> complex

Retrieve the purity of the density matrix.

Returns
the purity of the density matrix

◆ to_statevector()

list[complex] pyqpanda3.quantum_info.DensityMatrix.to_statevector ( self)

to_statevector(self: quantum_info.DensityMatrix) -> list[complex]

Retrieve the corresponding state vector..

Returns
the corresponding state vector

◆ update_by_evolve()

DensityMatrix pyqpanda3.quantum_info.DensityMatrix.update_by_evolve ( self,
circuit )

update_by_evolve(self: quantum_info.DensityMatrix, circuit: QPanda::QCircuit) -> quantum_info.DensityMatrix

Evolve the density matrix using the quantum circuit QCircuit and update the internal data of the original DensityMatrix object

Parameters
circuita quantum circuit QCircuit
Returns
a new DensityMatrix object

The documentation for this class was generated from the following file: