Skip to main contentIBM Quantum Documentation
You are viewing the API reference for an old version of Qiskit SDK. Switch to latest version

VQD

qiskit.algorithms.eigensolvers.VQD(estimator, fidelity, ansatz, optimizer, *, k=2, betas=None, initial_point=None, callback=None)

GitHub(opens in a new tab)

Bases: VariationalAlgorithm, Eigensolver

The Variational Quantum Deflation algorithm. Implementation using primitives.

VQD(opens in a new tab) is a quantum algorithm that uses a variational technique to find the k eigenvalues of the Hamiltonian HH of a given system.

The algorithm computes excited state energies of generalised hamiltonians by optimising over a modified cost function where each succesive eigenvalue is calculated iteratively by introducing an overlap term with all the previously computed eigenstates that must be minimised, thus ensuring higher energy eigenstates are found.

An instance of VQD requires defining three algorithmic sub-components: an integer k denoting the number of eigenstates to calculate, a trial state (a.k.a. ansatz) which is a QuantumCircuit, and one instance (or list of) classical optimizers. The optimizer varies the circuit parameters The trial state ψ(θ)|\psi(\vec\theta)\rangle is varied by the optimizer, which modifies the set of ansatz parameters θ\vec\theta such that the expectation value of the operator on the corresponding state approaches a minimum. The algorithm does this by iteratively refining each excited state to be orthogonal to all the previous excited states.

An optional array of parameter values, via the initial_point, may be provided as the starting point for the search of the minimum eigenvalue. This feature is particularly useful when there are reasons to believe that the solution point is close to a particular point.

The length of the initial_point list value must match the number of the parameters expected by the ansatz. If the initial_point is left at the default of None, then VQD will look to the ansatz for a preferred value, based on its given initial state. If the ansatz returns None, then a random point will be generated within the parameter bounds set, as per above. It is also possible to give a list of initial points, one for every kth eigenvalue. If the ansatz provides None as the lower bound, then VQD will default it to 2π-2\pi; similarly, if the ansatz returns None as the upper bound, the default value will be 2π2\pi.

The following attributes can be set via the initializer but can also be read and updated once the VQD object has been constructed.

estimator

The primitive instance used to perform the expectation estimation as indicated in the VQD paper.

Type

BaseEstimator

fidelity

The fidelity class instance used to compute the overlap estimation as indicated in the VQD paper.

Type

BaseStateFidelity

ansatz

A parameterized circuit used as ansatz for the wave function.

Type

QuantumCircuit

optimizer

A classical optimizer or a list of optimizers, one for every k-th eigenvalue. Can either be a Qiskit optimizer or a callable that takes an array as input and returns a Qiskit or SciPy optimization result.

Type

Optimizer | Sequence[Optimizer]

k

the number of eigenvalues to return. Returns the lowest k eigenvalues.

Type

int(opens in a new tab)

betas

Beta parameters in the VQD paper. Should have length k - 1, with k the number of excited states. These hyper-parameters balance the contribution of each overlap term to the cost function and have a default value computed as the mean square sum of the coefficients of the observable.

Type

list(opens in a new tab)[float(opens in a new tab)]

callback

A callback that can access the intermediate data during the optimization. Four parameter values are passed to the callback as follows during each evaluation by the optimizer: the evaluation count, the optimizer parameters for the ansatz, the estimated value, the estimation metadata, and the current step.

Type

Callable[[int(opens in a new tab), np.ndarray, float(opens in a new tab), dict(opens in a new tab)[str(opens in a new tab), Any]], None] | None

Parameters

  • estimator (BaseEstimator) – The estimator primitive.
  • fidelity (BaseStateFidelity) – The fidelity class using primitives.
  • ansatz (QuantumCircuit) – A parameterized circuit used as ansatz for the wave function.
  • optimizer (Optimizer |Minimizer | Sequence[Optimizer |Minimizer]) – A classical optimizer or a list of optimizers, one for every k-th eigenvalue.
  • callable (Can either be a Qiskit optimizer or a) – that takes an array as input and returns a Qiskit or SciPy optimization result.
  • k (int(opens in a new tab)) – The number of eigenvalues to return. Returns the lowest k eigenvalues.
  • betas (Sequence[float(opens in a new tab)] | None) – Beta parameters in the VQD paper. Should have length k - 1, with k the number of excited states. These hyperparameters balance the contribution of each overlap term to the cost function and have a default value computed as the mean square sum of the coefficients of the observable.
  • initial_point (Sequence[float(opens in a new tab)] | Sequence[Sequence[float(opens in a new tab)]] | None) – An optional initial point (i.e. initial parameter values) or a list of initial points (one for every k-th eigenvalue) for the optimizer. If None then VQD will look to the ansatz for a preferred point and if not will simply compute a random one.
  • callback (Callable[[int(opens in a new tab), np.ndarray, float(opens in a new tab), dict(opens in a new tab)[str(opens in a new tab), Any]], None] | None) – A callback that can access the intermediate data during the optimization. Four parameter values are passed to the callback as follows during each evaluation by the optimizer: the evaluation count, the optimizer parameters for the ansatz, the estimated value, the estimation metadata, and the current step.

Attributes

initial_point

Returns initial point.


Methods

compute_eigenvalues

compute_eigenvalues(operator, aux_operators=None)

Computes the minimum eigenvalue. The operator and aux_operators are supplied here. While an operator is required by algorithms, aux_operators are optional.

Parameters

  • operator (BaseOperator | PauliSumOp) – Qubit operator of the observable.
  • aux_operators (ListOrDict[BaseOperator | PauliSumOp] | None) – Optional list of auxiliary operators to be evaluated with the eigenstate of the minimum eigenvalue main result and their expectation values returned. For instance, in chemistry, these can be dipole operators and total particle count operators, so we can get values for these at the ground state.

Returns

An eigensolver result.

Return type

VQDResult

supports_aux_operators

classmethod supports_aux_operators()

Whether computing the expectation value of auxiliary operators is supported.

If the eigensolver computes the eigenvalues of the main operator, then it can compute the expectation value of the aux_operators for that state. Otherwise they will be ignored.

Returns

True if aux_operator expectations can be evaluated, False otherwise.

Return type

bool(opens in a new tab)

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