Gradient#

class qiskit.opflow.gradients.Gradient(grad_method='param_shift', **kwargs)[ソース]#

ベースクラス: GradientBase

Deprecated: Convert an operator expression to the first-order gradient.

バージョン 0.24.0 で非推奨: The class qiskit.opflow.gradients.gradient.Gradient 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

grad_method#

Returns CircuitGradient.

戻り値:

CircuitGradient.

Methods

convert(operator, params=None)[ソース]#
パラメータ:
戻り値:

An operator whose evaluation yields the Gradient.

例外:
  • ValueError – If params contains a parameter not present in operator.

  • ValueError – If operator is not parameterized.

戻り値の型:

OperatorBase

get_gradient(operator, params)[ソース]#

Get the gradient for the given operator w.r.t. the given parameters

パラメータ:
戻り値:

Operator which represents the gradient w.r.t. the given params.

例外:
  • ValueError – If params contains a parameter not present in operator.

  • 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

  • Exception – Unintended code is reached

  • MissingOptionalLibraryError – jax not installed

戻り値の型:

OperatorBase