Hessian#
- class qiskit.opflow.gradients.Hessian(hess_method='param_shift', **kwargs)[código fonte]#
Bases:
HessianBase
Deprecated: Compute the Hessian of an expected value.
Obsoleto desde a versão 0.24.0: The class
qiskit.opflow.gradients.hessian.Hessian
is deprecated as of qiskit-terra 0.24.0. It will be removed no earlier than 3 months after the release date. For code migration guidelines, visit https://qisk.it/opflow_migration.Attributes
- hess_method#
Returns
CircuitGradient
.- Retorno:
CircuitGradient
.
Methods
- convert(operator, params=None)[código fonte]#
- Parâmetros:
operator (OperatorBase) – The operator for which we compute the Hessian
params (Tuple[ParameterExpression, ParameterExpression] | List[Tuple[ParameterExpression, ParameterExpression]] | List[ParameterExpression] | ParameterVector | None) – The parameters we are computing the Hessian with respect to Either give directly the tuples/list of tuples for which the second order derivative is to be computed or give a list of parameters to build the full Hessian for those parameters. If not explicitly passed, the full Hessian is constructed. The parameters are then inferred from the operator and sorted by name.
- Retorno:
An operator whose evaluation yields the Hessian
- Tipo de retorno:
- get_hessian(operator, params=None)[código fonte]#
Get the Hessian for the given operator w.r.t. the given parameters
- Parâmetros:
operator (OperatorBase) – Operator w.r.t. which we take the Hessian.
params (Tuple[ParameterExpression, ParameterExpression] | List[Tuple[ParameterExpression, ParameterExpression]] | List[ParameterExpression] | ParameterVector | None) – Parameters w.r.t. which we compute the Hessian. If not explicitly passed, the full Hessian is constructed. The parameters are then inferred from the operator and sorted by name.
- Retorno:
Operator which represents the gradient w.r.t. the given params.
- Levanta:
ValueError – If
params
contains a parameter not present inoperator
.ValueError – If
operator
is not parameterized.OpflowError – If the coefficient of the operator could not be reduced to 1.
OpflowError – If the differentiation of a combo_fn requires JAX but the package is not installed.
TypeError – If the operator does not include a StateFn given by a quantum circuit
TypeError – If the parameters were given in an unsupported format.
Exception – Unintended code is reached
MissingOptionalLibraryError – jax not installed
- Tipo de retorno: