Skip to main contentIBM Quantum Documentation
This page is from an old version of Qiskit SDK and does not exist in the latest version. We recommend you migrate to the latest version. See the release notes for more information.
Important

IBM Quantum Platform is moving and this version will be sunset on July 1. To get started on the new platform, read the migration guide.

QEomVQE

class QEomVQE(operator, var_form, optimizer, num_orbitals, num_particles, initial_point=None, max_evals_grouped=1, callback=None, qubit_mapping='parity', two_qubit_reduction=True, is_eom_matrix_symmetric=True, active_occupied=None, active_unoccupied=None, se_list=None, de_list=None, z2_symmetries=None, untapered_op=None, aux_operators=None, quantum_instance=None)

GitHub

QEomVQE algorithm

Parameters

  • operator (LegacyBaseOperator) – qubit operator
  • var_form (Union[QuantumCircuit, VariationalForm]) – parameterized variational form.
  • optimizer (Optimizer) – the classical optimization algorithm.
  • num_orbitals (int) – total number of spin orbitals, has a min. value of 1.
  • num_particles (Union[List[int], int]) – number of particles, if it is a list, the first number is alpha and the second number if beta.
  • initial_point (Optional[ndarray]) – optimizer initial point, 1-D vector
  • max_evals_grouped (int) – max number of evaluations performed simultaneously
  • callback (Optional[Callable[[int, ndarray, float, float], None]]) – a callback that can access the intermediate data during the optimization. Internally, four arguments are provided as follows the index of evaluation, parameters of variational form, evaluated mean, evaluated standard deviation.
  • qubit_mapping (str) – qubit mapping type
  • two_qubit_reduction (bool) – two qubit reduction is applied or not
  • is_eom_matrix_symmetric (bool) – is EoM matrix symmetric
  • active_occupied (Optional[List[int]]) – list of occupied orbitals to include, indices are 0 to n where n is num particles // 2
  • active_unoccupied (Optional[List[int]]) – list of unoccupied orbitals to include, indices are 0 to m where m is (num_orbitals - num particles) // 2
  • se_list (Optional[List[List[int]]]) – single excitation list, overwrite the setting in active space
  • de_list (Optional[List[List[int]]]) – double excitation list, overwrite the setting in active space
  • z2_symmetries (Optional[Z2Symmetries]) – represent the Z2 symmetries
  • untapered_op (Optional[LegacyBaseOperator]) – if the operator is tapered, we need untapered operator during building element of EoM matrix
  • aux_operators (Optional[List[LegacyBaseOperator]]) – Auxiliary operators to be evaluated at each eigenvalue
  • quantum_instance (Union[QuantumInstance, BaseBackend, None]) – Quantum Instance or Backend

Raises

ValueError – invalid parameter


Attributes

aux_operators

Type: Optional[List[Optional[qiskit.aqua.operators.operator_base.OperatorBase]]]

Returns aux operators

Return type

Optional[List[Optional[OperatorBase]]]

backend

Type: qiskit.providers.basebackend.BaseBackend

Returns backend.

Return type

BaseBackend

expectation

Type: qiskit.aqua.operators.expectations.expectation_base.ExpectationBase

The expectation value algorithm used to construct the expectation measurement from the observable.

Return type

ExpectationBase

initial_point

Type: Optional[numpy.ndarray]

Returns initial point

Return type

Optional[ndarray]

operator

Type: Optional[qiskit.aqua.operators.operator_base.OperatorBase]

Returns operator

Return type

Optional[OperatorBase]

optimal_params

Type: List[float]

The optimal parameters for the variational form.

Return type

List[float]

optimizer

Type: Optional[qiskit.aqua.components.optimizers.optimizer.Optimizer]

Returns optimizer

Return type

Optional[Optimizer]

quantum_instance

Type: Union[None, qiskit.aqua.quantum_instance.QuantumInstance]

Returns quantum instance.

Return type

Optional[QuantumInstance]

random

Return a numpy random.

setting

Prepare the setting of VQE as a string.

var_form

Type: Optional[Union[qiskit.circuit.quantumcircuit.QuantumCircuit, qiskit.aqua.components.variational_forms.variational_form.VariationalForm]]

Returns variational form

Return type

Union[QuantumCircuit, VariationalForm, None]


Methods

cleanup_parameterized_circuits

QEomVQE.cleanup_parameterized_circuits()

set parameterized circuits to None

compute_minimum_eigenvalue

QEomVQE.compute_minimum_eigenvalue(operator=None, aux_operators=None)

Computes minimum eigenvalue. Operator and aux_operators can be supplied here and if not None will override any already set into algorithm so it can be reused with different operators. While an operator is required by algorithms, aux_operators are optional. To ‘remove’ a previous aux_operators array use an empty list here.

Parameters

Return type

MinimumEigensolverResult

Returns

MinimumEigensolverResult

construct_circuit

QEomVQE.construct_circuit(parameter)

Generate the ansatz circuit and expectation value measurement, and return their runnable composition.

Parameters

parameter (Union[List[float], List[Parameter], ndarray]) – Parameters for the ansatz circuit.

Return type

OperatorBase

Returns

The Operator equalling the measurement of the ansatz StateFn by the Observable’s expectation StateFn.

Raises

AquaError – If no operator has been provided.

find_minimum

QEomVQE.find_minimum(initial_point=None, var_form=None, cost_fn=None, optimizer=None, gradient_fn=None)

Optimize to find the minimum cost value.

Parameters

  • initial_point (Optional[ndarray]) – If not None will be used instead of any initial point supplied via constructor. If None and None was supplied to constructor then a random point will be used if the optimizer requires an initial point.
  • var_form (Union[QuantumCircuit, VariationalForm, None]) – If not None will be used instead of any variational form supplied via constructor.
  • cost_fn (Optional[Callable]) – If not None will be used instead of any cost_fn supplied via constructor.
  • optimizer (Optional[Optimizer]) – If not None will be used instead of any optimizer supplied via constructor.
  • gradient_fn (Optional[Callable]) – Optional gradient function for optimizer

Returns

Optimized variational parameters, and corresponding minimum cost value.

Return type

dict

Raises

ValueError – invalid input

get_optimal_circuit

QEomVQE.get_optimal_circuit()

Get the circuit with the optimal parameters.

Return type

QuantumCircuit

get_optimal_cost

QEomVQE.get_optimal_cost()

Get the minimal cost or energy found by the VQE.

Return type

float

get_optimal_vector

QEomVQE.get_optimal_vector()

Get the simulation outcome of the optimal circuit.

Return type

Union[List[float], Dict[str, int]]

get_prob_vector_for_params

QEomVQE.get_prob_vector_for_params(construct_circuit_fn, params_s, quantum_instance, construct_circuit_args=None)

Helper function to get probability vectors for a set of params

get_probabilities_for_counts

QEomVQE.get_probabilities_for_counts(counts)

get probabilities for counts

QEomVQE.print_settings()

Preparing the setting of VQE into a string.

Returns

the formatted setting of VQE

Return type

str

run

QEomVQE.run(quantum_instance=None, **kwargs)

Execute the algorithm with selected backend.

Parameters

Returns

results of an algorithm.

Return type

dict

Raises

AquaError – If a quantum instance or backend has not been provided

set_backend

QEomVQE.set_backend(backend, **kwargs)

Sets backend with configuration.

Return type

None

supports_aux_operators

QEomVQE.supports_aux_operators()

Whether computing the expectation value of auxiliary operators is supported.

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

Return type

bool

Returns

True if aux_operator expectations can be evaluated, False otherwise

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