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

Public Member Functions

None __init__ (self, *args, **kwargs)
 Initialize self.
 
float at (self, list[int] idx_s)
 at(*args, **kwargs) Overloaded function.
 
float at (self, int idx)
 at(*args, **kwargs) Overloaded function.
 
Any at (self, i)
 at(*args, **kwargs) Overloaded function.
 
list[float] gradients (self)
 gradients(self: vqcircuit.ResGradients) -> list[float]
 
int __len__ (self)
 len(self: vqcircuit.ResGradients) -> int
 

Constructor & Destructor Documentation

◆ __init__()

None pyqpanda3.vqcircuit.vqcircuit.ResGradients.__init__ ( self,
* args,
** kwargs )

Initialize self.

See help(type(self)) for accurate signature.

Member Function Documentation

◆ __len__()

int pyqpanda3.vqcircuit.vqcircuit.ResGradients.__len__ ( self)

len(self: vqcircuit.ResGradients) -> int

If an array [val_0, val_1, ..., val_n] is passed in as parameter values to generate a quantum circuit, the size of this array will be returned, and this size is equal to the number of gradient values.

◆ at() [1/3]

Any pyqpanda3.vqcircuit.vqcircuit.ResGradients.at ( self,
i )

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

  1. at(self: vqcircuit.ResGradients, idx_s: list[int]) -> float

Get a gradient value

If a mutable parameter is placeholder-ed using vqc.Param([idx_dim0, idx_dim1, ..., idx_dimn]), the corresponding gradient value can be obtained using at([idx_dim0, idx_dim1, ..., idx_dimn]).

Parameters
idx_sIt should be input like [idx_dim0, idx_dim1, ..., idx_dimn]
Returns
A gradient value
  1. at(self: vqcircuit.ResGradients, idx: int) -> float

Get a gradient value

If an array [val_0, val_1, ..., val_n] is passed as the parameter values to generate a quantum circuit, the gradient value corresponding to the parameter value val_i can be obtained using at(i).

Parameters
idx_sIt's i
Returns
A gradient value

◆ at() [2/3]

float pyqpanda3.vqcircuit.vqcircuit.ResGradients.at ( self,
int idx )

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

  1. at(self: vqcircuit.ResGradients, idx_s: list[int]) -> float

Get a gradient value

If a mutable parameter is placeholder-ed using vqc.Param([idx_dim0, idx_dim1, ..., idx_dimn]), the corresponding gradient value can be obtained using at([idx_dim0, idx_dim1, ..., idx_dimn]).

Parameters
idx_sIt should be input like [idx_dim0, idx_dim1, ..., idx_dimn]
Returns
A gradient value
  1. at(self: vqcircuit.ResGradients, idx: int) -> float

Get a gradient value

If an array [val_0, val_1, ..., val_n] is passed as the parameter values to generate a quantum circuit, the gradient value corresponding to the parameter value val_i can be obtained using at(i).

Parameters
idx_sIt's i
Returns
A gradient value

◆ at() [3/3]

float pyqpanda3.vqcircuit.vqcircuit.ResGradients.at ( self,
list[int] idx_s )

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

  1. at(self: vqcircuit.ResGradients, idx_s: list[int]) -> float

Get a gradient value

If a mutable parameter is placeholder-ed using vqc.Param([idx_dim0, idx_dim1, ..., idx_dimn]), the corresponding gradient value can be obtained using at([idx_dim0, idx_dim1, ..., idx_dimn]).

Parameters
idx_sIt should be input like [idx_dim0, idx_dim1, ..., idx_dimn]
Returns
A gradient value
  1. at(self: vqcircuit.ResGradients, idx: int) -> float

Get a gradient value

If an array [val_0, val_1, ..., val_n] is passed as the parameter values to generate a quantum circuit, the gradient value corresponding to the parameter value val_i can be obtained using at(i).

Parameters
idx_sIt's i
Returns
A gradient value

◆ gradients()

list[float] pyqpanda3.vqcircuit.vqcircuit.ResGradients.gradients ( self)

gradients(self: vqcircuit.ResGradients) -> list[float]

Get all gradient values

If an array [val_0, val_1, ..., val_n] is passed as the parameter values to generate the quantum circuit, the corresponding gradient values will be returned in the form [gradient_0, gradient_1, ..., gradient_n], where the gradient value gradient_i corresponds to the parameter value val_i.

Returns
Returns a list where each element is a gradient value.

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