Skip to main contentIBM Quantum Documentation

Objective function(s)

qiskit_addon_aqc_tensor.objective

Code for building and evaluating objective functions used for AQC parameter optimization.

Currently, this module provides the simplest possible objective function, MaximizeStateFidelity.

MaximizeStateFidelity

class MaximizeStateFidelity(target, ansatz, settings)

GitHub

Bases: object

Simplest possible objective function for use with AQC-Tensor.

Its definition is given by Eq. (7) in arXiv:2301.08609v6:

C=10V(θ)ψtarget2.C = 1 - \left| \langle 0 | V^{\dagger}(\vec\theta) | \psi_\mathrm{target} \rangle \right|^2 .

Minimizing this function is equivalent to maximizing the pure-state fidelity between the state prepared by the ansatz circuit at the current parameter point, V(θ)0V(\vec\theta) |0\rangle, and the target state, ψtarget| \psi_\mathrm{target} \rangle.

When called with an ndarray of parameters, this object will return (objective_value, gradient) as a tuple[float, numpy.ndarray].

Initialize the objective function.

Parameters

loss_function

loss_function(x)

GitHub

Evaluate (objective_value, gradient) of function at point x.

Return type

tuple[float, ndarray]

Parameters

x (ndarray)

target

Type: TensorNetworkState

Target tensor network.

OneMinusFidelity

class OneMinusFidelity(target, ansatz, settings)

GitHub

Bases: MaximizeStateFidelity

DEPRECATED objective function, equivalent to MaximizeStateFidelity.

Initialize the objective function.

The OneMinusFidelity class is DEPRECATED since v0.2. Please migrate to MaximizeStateFidelity as soon as possible.

Deprecated since version 0.2.0

The class qiskit_addon_aqc_tensor.objective.OneMinusFidelity is deprecated as of qiskit-addon-aqc-tensor 0.2.0. It will be removed no earlier than v0.4.0. This class has been renamed to MaximizeStateFidelity.

Parameters

__call__

__call__(x)

GitHub

Evaluate (objective_value, gradient) of function at point x.

This method is DEPRECATED since v0.2. The loss_function() method should be called instead.

Return type

tuple[float, ndarray]

Parameters

x (ndarray)

Deprecated since version 0.2.0

The method qiskit_addon_aqc_tensor.objective.MaximizeStateFidelity.__call__() is deprecated as of qiskit-addon-aqc-tensor 0.2.0. It will be removed no earlier than v0.4.0. Going forward, the loss_function method should be called instead of calling the instance directly.

loss_function

loss_function(x)

GitHub

Evaluate (objective_value, gradient) of function at point x.

Return type

tuple[float, ndarray]

Parameters

x (ndarray)

target

Type: TensorNetworkState

Target tensor network.

Was this page helpful?
Report a bug or request content on GitHub.