VQD¶
- class VQD(estimator, fidelity, ansatz, optimizer, *, k=2, betas=None, initial_point=None, callback=None)[ソース]¶
ベースクラス:
VariationalAlgorithm
,Eigensolver
The Variational Quantum Deflation algorithm. Implementation using primitives.
VQD is a quantum algorithm that uses a variational technique to find the k eigenvalues of the Hamiltonian \(H\) 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) classicaloptimizers
. 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 returnsNone
, 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 providesNone
as the lower bound, then VQD will default it to \(-2\pi\); similarly, if the ansatz returnsNone
as the upper bound, the default value will be \(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
- fidelity¶
The fidelity class instance used to compute the overlap estimation as indicated in the VQD paper.
- Type
- ansatz¶
A parameterized circuit used as ansatz for the wave function.
- Type
- 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.
- k¶
the number of eigenvalues to return. Returns the lowest k eigenvalues.
- Type
int
- 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[float]
- initial point
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.- Type
Sequence[float] | Sequence[Sequence[float]] | None
- 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, np.ndarray, float, dict[str, Any]], None] | None
- パラメータ
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) – The number of eigenvalues to return. Returns the lowest k eigenvalues.
betas (Sequence[float] | 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] | Sequence[Sequence[float]] | 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, np.ndarray, float, dict[str, 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.
Methods
Computes the minimum eigenvalue.
Whether computing the expectation value of auxiliary operators is supported.
Attributes
- initial_point¶
Returns initial point.