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

Public Member Functions

None __init__ (self)
 init(*args, **kwargs) Overloaded function.
 
None __init__ (self, StateVector other)
 init(*args, **kwargs) Overloaded function.
 
None __init__ (self, dict[int, complex] data)
 init(*args, **kwargs) Overloaded function.
 
None __init__ (self, list[complex] data)
 init(*args, **kwargs) Overloaded function.
 
None __init__ (self, numpy.ndarray[numpy.complex128[m, 1]] data)
 init(*args, **kwargs) Overloaded function.
 
None __init__ (self, int qbit_total)
 init(*args, **kwargs) Overloaded function.
 
complex at (self, int idx)
 at(self: quantum_info.StateVector, idx: int) -> complex
 
int dim (self)
 dim(self: quantum_info.StateVector) -> int
 
StateVector evolve (self, circuit)
 evolve(self: quantum_info.StateVector, circuit: QPanda::QCircuit) -> quantum_info.StateVector
 
Matrix get_density_matrix (self)
 get_density_matrix(self: quantum_info.StateVector) -> quantum_info.Matrix
 
bool is_valid (self)
 is_valid(self: quantum_info.StateVector) -> bool
 
numpy.ndarray[numpy.complex128] ndarray (self)
 ndarray(self: quantum_info.StateVector) -> numpy.ndarray[numpy.complex128]
 
complex purity (self)
 purity(self: quantum_info.StateVector) -> complex
 
StateVector update_by_evolve (self, circuit)
 update_by_evolve(self: quantum_info.StateVector, circuit: QPanda::QCircuit) -> quantum_info.StateVector
 
bool __eq__ (self, StateVector other)
 eq(self: quantum_info.StateVector, other: quantum_info.StateVector) -> bool
 

Constructor & Destructor Documentation

◆ __init__() [1/6]

None pyqpanda3.quantum_info.StateVector.__init__ ( self)

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

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

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

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

Generate a StateVector object from another StateVector object

Parameters
otheranother StateVector object
  1. init(self: quantum_info.StateVector, data: dict[int, complex]) -> None

Construct a state vector based on the input dictionary

Parameters
dataa dictionary
  1. init(self: quantum_info.StateVector, data: list[complex]) -> None

Construct a state vector based on a given complex number array

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

Construct a state vector based on a given complex number array

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

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

Parameters
qbit_totalthe total number of qubits in the quantum system

◆ __init__() [2/6]

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

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

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

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

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

Generate a StateVector object from another StateVector object

Parameters
otheranother StateVector object
  1. init(self: quantum_info.StateVector, data: dict[int, complex]) -> None

Construct a state vector based on the input dictionary

Parameters
dataa dictionary
  1. init(self: quantum_info.StateVector, data: list[complex]) -> None

Construct a state vector based on a given complex number array

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

Construct a state vector based on a given complex number array

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

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

Parameters
qbit_totalthe total number of qubits in the quantum system

◆ __init__() [3/6]

None pyqpanda3.quantum_info.StateVector.__init__ ( self,
dict[int, complex] data )

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

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

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

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

Generate a StateVector object from another StateVector object

Parameters
otheranother StateVector object
  1. init(self: quantum_info.StateVector, data: dict[int, complex]) -> None

Construct a state vector based on the input dictionary

Parameters
dataa dictionary
  1. init(self: quantum_info.StateVector, data: list[complex]) -> None

Construct a state vector based on a given complex number array

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

Construct a state vector based on a given complex number array

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

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

Parameters
qbit_totalthe total number of qubits in the quantum system

◆ __init__() [4/6]

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

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

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

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

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

Generate a StateVector object from another StateVector object

Parameters
otheranother StateVector object
  1. init(self: quantum_info.StateVector, data: dict[int, complex]) -> None

Construct a state vector based on the input dictionary

Parameters
dataa dictionary
  1. init(self: quantum_info.StateVector, data: list[complex]) -> None

Construct a state vector based on a given complex number array

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

Construct a state vector based on a given complex number array

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

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

Parameters
qbit_totalthe total number of qubits in the quantum system

◆ __init__() [5/6]

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

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

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

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

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

Generate a StateVector object from another StateVector object

Parameters
otheranother StateVector object
  1. init(self: quantum_info.StateVector, data: dict[int, complex]) -> None

Construct a state vector based on the input dictionary

Parameters
dataa dictionary
  1. init(self: quantum_info.StateVector, data: list[complex]) -> None

Construct a state vector based on a given complex number array

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

Construct a state vector based on a given complex number array

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

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

Parameters
qbit_totalthe total number of qubits in the quantum system

◆ __init__() [6/6]

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

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

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

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

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

Generate a StateVector object from another StateVector object

Parameters
otheranother StateVector object
  1. init(self: quantum_info.StateVector, data: dict[int, complex]) -> None

Construct a state vector based on the input dictionary

Parameters
dataa dictionary
  1. init(self: quantum_info.StateVector, data: list[complex]) -> None

Construct a state vector based on a given complex number array

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

Construct a state vector based on a given complex number array

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

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

Parameters
qbit_totalthe total number of qubits in the quantum system

Member Function Documentation

◆ __eq__()

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

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

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

Parameters
StateVectoranother StateVector object
Returns
Bool if they are same, return true.

◆ at()

complex pyqpanda3.quantum_info.StateVector.at ( self,
int idx )

at(self: quantum_info.StateVector, idx: int) -> complex

Retrieve the element with index

Parameters
idx,theindex of the element
Returns
the element with index

◆ dim()

int pyqpanda3.quantum_info.StateVector.dim ( self)

dim(self: quantum_info.StateVector) -> int

Retrieve the number of ground states corresponding to the state vector

Returns
the number of ground states corresponding to the state vector.

◆ evolve()

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

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

Evolve the quantum state using the quantum circuit QCircuit without updating the internal data of the original StateVector object, and return the result as a new StateVector object

Parameters
circuita quantum circuit QCircuit
Returns
a new StateVector object

◆ get_density_matrix()

Matrix pyqpanda3.quantum_info.StateVector.get_density_matrix ( self)

get_density_matrix(self: quantum_info.StateVector) -> quantum_info.Matrix

Retrieve the density matrix corresponding to the state vector.

Returns
the density matrix corresponding to the state vector.

◆ is_valid()

bool pyqpanda3.quantum_info.StateVector.is_valid ( self)

is_valid(self: quantum_info.StateVector) -> bool

Check if the internal data of the state vector is valid.

Returns
return true if is valid

◆ ndarray()

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

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

Generate a numpy.ndarray object using data in self

Returns
a numpy.ndarray object

◆ purity()

complex pyqpanda3.quantum_info.StateVector.purity ( self)

purity(self: quantum_info.StateVector) -> complex

Retrieve the purity of the state vector.

Returns
the purity of the state vector

◆ update_by_evolve()

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

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

Evolve the quantum state using the quantum circuit QCircuit and update the internal data of the original StateVector object

Parameters
circuita quantum circuit QCircuit
Returns
a new StateVector object

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