QPanda3
0.1.0
Supported by OriginQ
|
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. | |
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.
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.
params | a numpy.ndarray object with all params to generate QCircuit objects |
VQCircuit pyqpanda3.vqcircuit.VQCircuit.__lshift__ | ( | self, | |
qcircuit ) |
lshift(*args, **kwargs) Overloaded function.
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
qgate | the 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 . |
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
qcircuit | the quantum qcircuit will be inserted to the variational quantum circuit,its gates are with fixed params or without params gate to be inserted. |
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
.
vqgate | a variational quantum gate object |
VQCircuit pyqpanda3.vqcircuit.VQCircuit.__lshift__ | ( | self, | |
qgate ) |
lshift(*args, **kwargs) Overloaded function.
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
qgate | the 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 . |
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
qcircuit | the quantum qcircuit will be inserted to the variational quantum circuit,its gates are with fixed params or without params gate to be inserted. |
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
.
vqgate | a variational quantum gate object |
VQCircuit pyqpanda3.vqcircuit.VQCircuit.__lshift__ | ( | self, | |
vqgate ) |
lshift(*args, **kwargs) Overloaded function.
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
qgate | the 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 . |
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
qcircuit | the quantum qcircuit will be inserted to the variational quantum circuit,its gates are with fixed params or without params gate to be inserted. |
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
.
vqgate | a variational quantum gate object |
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.
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.
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.
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.
Param
object. list[int] pyqpanda3.vqcircuit.VQCircuit.Param | ( | self, | |
list[int] | idxs ) |
Param(*args, **kwargs) Overloaded function.
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.
idxs | a vector of indices specifying a position in a multi-dimensional array |
emement_label | a label string to identify the parameter |
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.
idxs | a vector of indices specifying a position in a multi-dimensional array |
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.
emement_label | a label string to identify the parameter |
list[int] pyqpanda3.vqcircuit.VQCircuit.Param | ( | self, | |
list[int] | idxs, | ||
str | emement_label ) |
Param(*args, **kwargs) Overloaded function.
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.
idxs | a vector of indices specifying a position in a multi-dimensional array |
emement_label | a label string to identify the parameter |
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.
idxs | a vector of indices specifying a position in a multi-dimensional array |
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.
emement_label | a label string to identify the parameter |
list[int] pyqpanda3.vqcircuit.VQCircuit.Param | ( | self, | |
str | emement_label ) |
Param(*args, **kwargs) Overloaded function.
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.
idxs | a vector of indices specifying a position in a multi-dimensional array |
emement_label | a label string to identify the parameter |
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.
idxs | a vector of indices specifying a position in a multi-dimensional array |
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.
emement_label | a label string to identify the parameter |
None pyqpanda3.vqcircuit.VQCircuit.set_Param | ( | self, | |
list[int] | dim_size_s ) |
set_Param(*args, **kwargs) Overloaded function.
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.
dim_size_s | a vector with dim's sizes |
dim_label_s | a vector with dim's labels |
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.
dim_size_s | a vector with dim's sizes |
None pyqpanda3.vqcircuit.VQCircuit.set_Param | ( | self, | |
list[int] | dim_size_s, | ||
list[str] | dim_label_s ) |
set_Param(*args, **kwargs) Overloaded function.
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.
dim_size_s | a vector with dim's sizes |
dim_label_s | a vector with dim's labels |
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.
dim_size_s | a vector with dim's sizes |