QPanda3  0.1.0
Supported by OriginQ
Loading...
Searching...
No Matches
pyqpanda3.vqcircuit.VQCircuit Class Reference

Public Member Functions

None __init__ (self)
 init(self: vqcircuit.VQCircuit) -> None
 
list[int] Param (self, list[int] idxs, str emement_label)
 Param(*args, **kwargs) Overloaded function.
 
list[int] Param (self, list[int] idxs)
 Param(*args, **kwargs) Overloaded function.
 
list[int] Param (self, str emement_label)
 Param(*args, **kwargs) Overloaded function.
 
None disable_layer (self)
 disable_layer(self: vqcircuit.VQCircuit) -> None
 
None display_ansatz (self)
 display_ansatz(self: vqcircuit.VQCircuit) -> None
 
None enable_layer (self)
 enable_layer(self: vqcircuit.VQCircuit) -> None
 
list[int] get_Param_dims (self)
 get_Param_dims(self: vqcircuit.VQCircuit) -> list[int]
 
None set_Param (self, list[int] dim_size_s, list[str] dim_label_s)
 set_Param(*args, **kwargs) Overloaded function.
 
None set_Param (self, list[int] dim_size_s)
 set_Param(*args, **kwargs) Overloaded function.
 
 __call__ (self, *args, **kwargs)
 call(self: vqcircuit.VQCircuit, params: numpy.ndarray[numpy.float64]) -> QPanda::VQCircuitResult
 
VQCircuit __lshift__ (self, qgate)
 lshift(*args, **kwargs) Overloaded function.
 
VQCircuit __lshift__ (self, qcircuit)
 lshift(*args, **kwargs) Overloaded function.
 
VQCircuit __lshift__ (self, vqgate)
 lshift(*args, **kwargs) Overloaded function.
 

Constructor & Destructor Documentation

◆ __init__()

None pyqpanda3.vqcircuit.VQCircuit.__init__ ( self)

init(self: vqcircuit.VQCircuit) -> None

Constructs a new instance of the VariationalQuantumCircuit class.

This constructor initializes a new empty instance of the VariationalQuantumCircuit class, ready for further configuration and use.

Member Function Documentation

◆ __call__()

pyqpanda3.vqcircuit.VQCircuit.__call__ ( self,
* args,
** kwargs )

call(self: vqcircuit.VQCircuit, params: numpy.ndarray[numpy.float64]) -> QPanda::VQCircuitResult

Applies parameter values to the variational quantum circuit and evaluates it.

This method applies the provided parameter values (data) to the variational quantum circuit, considering the specified dimension sizes (dim_size_s). operator (<<). The variational quantum gate to be inserted is specified as the parameter vqgate.It then evaluates the circuit and returns the result as a VQCircuitResult object.

Parameters
paramsa numpy.ndarray object with all params to generate QCircuit objects

◆ __lshift__() [1/3]

VQCircuit pyqpanda3.vqcircuit.VQCircuit.__lshift__ ( self,
qcircuit )

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

  1. lshift(self: vqcircuit.VQCircuit, qgate: QPanda::QGate) -> vqcircuit.VQCircuit

Inserts a quantum gate into the variational quantum circuit.

This operator overload allows for the insertion of quantum gates into the variational quantum circuit using the stream insertion operator (<<). The quantum

Parameters
qgatethe quantum gate will be inserted to the variational quantum circuit,the qgate is with fixed params or without pparams gate to be inserted is specified as the parameter qgate.
  1. lshift(self: vqcircuit.VQCircuit, qcircuit: QPanda::QCircuit) -> vqcircuit.VQCircuit

Inserts a quantum circuit into the variational quantum circuit.

This operator overload allows for the insertion of a complete quantum circuit into the variational quantum circuit using the stream insertion operator (<<). The quantum circuit to be inserted is specified as the parameter qcircuit

Parameters
qcircuitthe quantum qcircuit will be inserted to the variational quantum circuit,its gates are with fixed params or without params gate to be inserted.
  1. lshift(self: vqcircuit.VQCircuit, vqgate: tuple[QPanda::VariationalQuantumGate, list[Union[float, list[int]]]]) -> vqcircuit.VQCircuit

Inserts a variational quantum gate into the variational quantum circuit.

This operator overload allows for the insertion of a variational quantum gate into the variational quantum circuit using the stream insertion operator (<<). The variational quantum gate to be inserted is specified as the parameter vqgate.

Parameters
vqgatea variational quantum gate object

◆ __lshift__() [2/3]

VQCircuit pyqpanda3.vqcircuit.VQCircuit.__lshift__ ( self,
qgate )

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

  1. lshift(self: vqcircuit.VQCircuit, qgate: QPanda::QGate) -> vqcircuit.VQCircuit

Inserts a quantum gate into the variational quantum circuit.

This operator overload allows for the insertion of quantum gates into the variational quantum circuit using the stream insertion operator (<<). The quantum

Parameters
qgatethe quantum gate will be inserted to the variational quantum circuit,the qgate is with fixed params or without pparams gate to be inserted is specified as the parameter qgate.
  1. lshift(self: vqcircuit.VQCircuit, qcircuit: QPanda::QCircuit) -> vqcircuit.VQCircuit

Inserts a quantum circuit into the variational quantum circuit.

This operator overload allows for the insertion of a complete quantum circuit into the variational quantum circuit using the stream insertion operator (<<). The quantum circuit to be inserted is specified as the parameter qcircuit

Parameters
qcircuitthe quantum qcircuit will be inserted to the variational quantum circuit,its gates are with fixed params or without params gate to be inserted.
  1. lshift(self: vqcircuit.VQCircuit, vqgate: tuple[QPanda::VariationalQuantumGate, list[Union[float, list[int]]]]) -> vqcircuit.VQCircuit

Inserts a variational quantum gate into the variational quantum circuit.

This operator overload allows for the insertion of a variational quantum gate into the variational quantum circuit using the stream insertion operator (<<). The variational quantum gate to be inserted is specified as the parameter vqgate.

Parameters
vqgatea variational quantum gate object

◆ __lshift__() [3/3]

VQCircuit pyqpanda3.vqcircuit.VQCircuit.__lshift__ ( self,
vqgate )

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

  1. lshift(self: vqcircuit.VQCircuit, qgate: QPanda::QGate) -> vqcircuit.VQCircuit

Inserts a quantum gate into the variational quantum circuit.

This operator overload allows for the insertion of quantum gates into the variational quantum circuit using the stream insertion operator (<<). The quantum

Parameters
qgatethe quantum gate will be inserted to the variational quantum circuit,the qgate is with fixed params or without pparams gate to be inserted is specified as the parameter qgate.
  1. lshift(self: vqcircuit.VQCircuit, qcircuit: QPanda::QCircuit) -> vqcircuit.VQCircuit

Inserts a quantum circuit into the variational quantum circuit.

This operator overload allows for the insertion of a complete quantum circuit into the variational quantum circuit using the stream insertion operator (<<). The quantum circuit to be inserted is specified as the parameter qcircuit

Parameters
qcircuitthe quantum qcircuit will be inserted to the variational quantum circuit,its gates are with fixed params or without params gate to be inserted.
  1. lshift(self: vqcircuit.VQCircuit, vqgate: tuple[QPanda::VariationalQuantumGate, list[Union[float, list[int]]]]) -> vqcircuit.VQCircuit

Inserts a variational quantum gate into the variational quantum circuit.

This operator overload allows for the insertion of a variational quantum gate into the variational quantum circuit using the stream insertion operator (<<). The variational quantum gate to be inserted is specified as the parameter vqgate.

Parameters
vqgatea variational quantum gate object

◆ disable_layer()

None pyqpanda3.vqcircuit.VQCircuit.disable_layer ( self)

disable_layer(self: vqcircuit.VQCircuit) -> None

Disables the layer mechanism for the variational quantum circuit.

This method deactivates the layer mechanism, resulting in a variational quantum circuit (VQCircuit) that has the same structure as the ansatz,with parameters updated based on the input parameters.

◆ display_ansatz()

None pyqpanda3.vqcircuit.VQCircuit.display_ansatz ( self)

display_ansatz(self: vqcircuit.VQCircuit) -> None

Displays the structure of the ansatz (variational quantum circuit).

This method prints or otherwise displays the structure and components of the variational quantum circuit (ansatz) to the user.

◆ enable_layer()

None pyqpanda3.vqcircuit.VQCircuit.enable_layer ( self)

enable_layer(self: vqcircuit.VQCircuit) -> None

Enables the layer mechanism for the variational quantum circuit.

This method activates a mechanism where the variational quantum circuit (VQCircuit) is composed of a series of sub-circuits,each with the same n-layer structure as the ansatz but potentially different parameters.

◆ get_Param_dims()

list[int] pyqpanda3.vqcircuit.VQCircuit.get_Param_dims ( self)

get_Param_dims(self: vqcircuit.VQCircuit) -> list[int]

Retrieves the dimension information of the Param object.

Returns
returns a vector of size_t values representing the dimension sizes associated with the Param object.

◆ Param() [1/3]

list[int] pyqpanda3.vqcircuit.VQCircuit.Param ( self,
list[int] idxs )

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

  1. Param(self: vqcircuit.VQCircuit, idxs: list[int], emement_label: str) -> list[int]

Retrieves the multi-dimensional array indices and associates a label with the corresponding parameter.

This method takes a vector of indices (idxs) specifying a position in a multi-dimensional array, along with a label string (element_label) to identify the parameter at that position.It returns the provided indices and internally associates the label with the corresponding parameter.

Parameters
idxsa vector of indices specifying a position in a multi-dimensional array
emement_labela label string to identify the parameter
Returns
th position in the multi-dimensional array
  1. Param(self: vqcircuit.VQCircuit, idxs: list[int]) -> list[int]

Retrieves the multi-dimensional array indices and associates a label with the corresponding parameter.

This method takes a vector of indices (idxs) specifying a position in a multi-dimensional array, along with a label string (element_label) to identify the parameter at that position.It returns the provided indices and internally associates the label with the corresponding parameter.

Parameters
idxsa vector of indices specifying a position in a multi-dimensional array
Returns
th position in the multi-dimensional array
  1. Param(self: vqcircuit.VQCircuit, emement_label: str) -> list[int]

Retrieves the multidimensional array index for a variable parameter with a specified label.

This method takes a label string for a variable parameter and returns the corresponding multidimensional array index.

Parameters
emement_labela label string to identify the parameter
Returns
th position in the multi-dimensional array

◆ Param() [2/3]

list[int] pyqpanda3.vqcircuit.VQCircuit.Param ( self,
list[int] idxs,
str emement_label )

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

  1. Param(self: vqcircuit.VQCircuit, idxs: list[int], emement_label: str) -> list[int]

Retrieves the multi-dimensional array indices and associates a label with the corresponding parameter.

This method takes a vector of indices (idxs) specifying a position in a multi-dimensional array, along with a label string (element_label) to identify the parameter at that position.It returns the provided indices and internally associates the label with the corresponding parameter.

Parameters
idxsa vector of indices specifying a position in a multi-dimensional array
emement_labela label string to identify the parameter
Returns
th position in the multi-dimensional array
  1. Param(self: vqcircuit.VQCircuit, idxs: list[int]) -> list[int]

Retrieves the multi-dimensional array indices and associates a label with the corresponding parameter.

This method takes a vector of indices (idxs) specifying a position in a multi-dimensional array, along with a label string (element_label) to identify the parameter at that position.It returns the provided indices and internally associates the label with the corresponding parameter.

Parameters
idxsa vector of indices specifying a position in a multi-dimensional array
Returns
th position in the multi-dimensional array
  1. Param(self: vqcircuit.VQCircuit, emement_label: str) -> list[int]

Retrieves the multidimensional array index for a variable parameter with a specified label.

This method takes a label string for a variable parameter and returns the corresponding multidimensional array index.

Parameters
emement_labela label string to identify the parameter
Returns
th position in the multi-dimensional array

◆ Param() [3/3]

list[int] pyqpanda3.vqcircuit.VQCircuit.Param ( self,
str emement_label )

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

  1. Param(self: vqcircuit.VQCircuit, idxs: list[int], emement_label: str) -> list[int]

Retrieves the multi-dimensional array indices and associates a label with the corresponding parameter.

This method takes a vector of indices (idxs) specifying a position in a multi-dimensional array, along with a label string (element_label) to identify the parameter at that position.It returns the provided indices and internally associates the label with the corresponding parameter.

Parameters
idxsa vector of indices specifying a position in a multi-dimensional array
emement_labela label string to identify the parameter
Returns
th position in the multi-dimensional array
  1. Param(self: vqcircuit.VQCircuit, idxs: list[int]) -> list[int]

Retrieves the multi-dimensional array indices and associates a label with the corresponding parameter.

This method takes a vector of indices (idxs) specifying a position in a multi-dimensional array, along with a label string (element_label) to identify the parameter at that position.It returns the provided indices and internally associates the label with the corresponding parameter.

Parameters
idxsa vector of indices specifying a position in a multi-dimensional array
Returns
th position in the multi-dimensional array
  1. Param(self: vqcircuit.VQCircuit, emement_label: str) -> list[int]

Retrieves the multidimensional array index for a variable parameter with a specified label.

This method takes a label string for a variable parameter and returns the corresponding multidimensional array index.

Parameters
emement_labela label string to identify the parameter
Returns
th position in the multi-dimensional array

◆ set_Param() [1/2]

None pyqpanda3.vqcircuit.VQCircuit.set_Param ( self,
list[int] dim_size_s )

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

  1. set_Param(self: vqcircuit.VQCircuit, dim_size_s: list[int], dim_label_s: list[str]) -> None

Sets the dimension sizes and labels for the Param object.

This method allows the user to specify both the dimension sizes and corresponding labels for the Param object.

Parameters
dim_size_sa vector with dim's sizes
dim_label_sa vector with dim's labels
  1. set_Param(self: vqcircuit.VQCircuit, dim_size_s: list[int]) -> None

Sets the dimension sizes for the Param object.

This method allows the user to specify the dimension sizes for the Param object using a vector of size_t values.

Parameters
dim_size_sa vector with dim's sizes

◆ set_Param() [2/2]

None pyqpanda3.vqcircuit.VQCircuit.set_Param ( self,
list[int] dim_size_s,
list[str] dim_label_s )

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

  1. set_Param(self: vqcircuit.VQCircuit, dim_size_s: list[int], dim_label_s: list[str]) -> None

Sets the dimension sizes and labels for the Param object.

This method allows the user to specify both the dimension sizes and corresponding labels for the Param object.

Parameters
dim_size_sa vector with dim's sizes
dim_label_sa vector with dim's labels
  1. set_Param(self: vqcircuit.VQCircuit, dim_size_s: list[int]) -> None

Sets the dimension sizes for the Param object.

This method allows the user to specify the dimension sizes for the Param object using a vector of size_t values.

Parameters
dim_size_sa vector with dim's sizes

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