qml.VQECost

class VQECost(*args, **kwargs)[source]

Bases: pennylane.vqe.vqe.ExpvalCost

Create a cost function that gives the expectation value of an input Hamiltonian.

Warning

Use of VQECost is deprecated and should be replaced with ExpvalCost.

__call__(*args, **kwargs)

Call self as a function.

metric_tensor(args[, kwargs, diag_approx, …])

Evaluate the value of the metric tensor.

__call__(*args, **kwargs)

Call self as a function.

metric_tensor(args, kwargs=None, diag_approx=False, only_construct=False)

Evaluate the value of the metric tensor.

Parameters
  • args (tuple[Any]) – positional (differentiable) arguments

  • kwargs (dict[str, Any]) – auxiliary arguments

  • diag_approx (bool) – iff True, use the diagonal approximation

  • only_construct (bool) – Iff True, construct the circuits used for computing the metric tensor but do not execute them, and return None.

Returns

metric tensor

Return type

array[float]

Contents

Using PennyLane

Development

API