qiskit-documentation/docs/api/qiskit/0.29/qiskit.chemistry.algorithms...

345 lines
12 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: QEomVQE
description: API reference for qiskit.chemistry.algorithms.QEomVQE
in_page_toc_min_heading_level: 1
python_api_type: class
python_api_name: qiskit.chemistry.algorithms.QEomVQE
---
# QEomVQE
<Class id="qiskit.chemistry.algorithms.QEomVQE" isDedicatedPage={true} github="https://github.com/qiskit-community/qiskit-aqua/tree/stable/0.9/qiskit/chemistry/algorithms/eigen_solvers/q_eom_vqe.py" signature="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)" modifiers="class">
Bases: `qiskit.aqua.algorithms.minimum_eigen_solvers.vqe.VQE`
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`, `Backend`, `BaseBackend`, `None`]) Quantum Instance or Backend
**Raises**
**ValueError** invalid parameter
## Methods
### cleanup\_parameterized\_circuits
<Function id="qiskit.chemistry.algorithms.QEomVQE.cleanup_parameterized_circuits" signature="QEomVQE.cleanup_parameterized_circuits()">
set parameterized circuits to None
</Function>
### compute\_minimum\_eigenvalue
<Function id="qiskit.chemistry.algorithms.QEomVQE.compute_minimum_eigenvalue" signature="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**
* **operator** (`Union`\[`OperatorBase`, `LegacyBaseOperator`, `None`]) If not None replaces operator in algorithm
* **aux\_operators** (`Optional`\[`List`\[`Union`\[`OperatorBase`, `LegacyBaseOperator`, `None`]]]) If not None replaces aux\_operators in algorithm
**Return type**
`MinimumEigensolverResult`
**Returns**
MinimumEigensolverResult
</Function>
### construct\_circuit
<Function id="qiskit.chemistry.algorithms.QEomVQE.construct_circuit" signature="QEomVQE.construct_circuit(parameter)">
Return the circuits used to compute the expectation value.
**Parameters**
**parameter** (`Union`\[`List`\[`float`], `List`\[`Parameter`], `ndarray`]) Parameters for the ansatz circuit.
**Return type**
`List`\[`QuantumCircuit`]
**Returns**
A list of the circuits used to compute the expectation value.
</Function>
### construct\_expectation
<Function id="qiskit.chemistry.algorithms.QEomVQE.construct_expectation" signature="QEomVQE.construct_expectation(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 Observables expectation `StateFn`.
**Raises**
[**AquaError**](qiskit.aqua.AquaError "qiskit.aqua.AquaError") If no operator has been provided.
</Function>
### find\_minimum
<Function id="qiskit.chemistry.algorithms.QEomVQE.find_minimum" signature="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
</Function>
### get\_optimal\_circuit
<Function id="qiskit.chemistry.algorithms.QEomVQE.get_optimal_circuit" signature="QEomVQE.get_optimal_circuit()">
Get the circuit with the optimal parameters.
**Return type**
`QuantumCircuit`
</Function>
### get\_optimal\_cost
<Function id="qiskit.chemistry.algorithms.QEomVQE.get_optimal_cost" signature="QEomVQE.get_optimal_cost()">
Get the minimal cost or energy found by the VQE.
**Return type**
`float`
</Function>
### get\_optimal\_vector
<Function id="qiskit.chemistry.algorithms.QEomVQE.get_optimal_vector" signature="QEomVQE.get_optimal_vector()">
Get the simulation outcome of the optimal circuit.
**Return type**
`Union`\[`List`\[`float`], `Dict`\[`str`, `int`]]
</Function>
### get\_prob\_vector\_for\_params
<Function id="qiskit.chemistry.algorithms.QEomVQE.get_prob_vector_for_params" signature="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
</Function>
### get\_probabilities\_for\_counts
<Function id="qiskit.chemistry.algorithms.QEomVQE.get_probabilities_for_counts" signature="QEomVQE.get_probabilities_for_counts(counts)">
get probabilities for counts
</Function>
### print\_settings
<Function id="qiskit.chemistry.algorithms.QEomVQE.print_settings" signature="QEomVQE.print_settings()">
Preparing the setting of VQE into a string.
**Returns**
the formatted setting of VQE
**Return type**
str
</Function>
### run
<Function id="qiskit.chemistry.algorithms.QEomVQE.run" signature="QEomVQE.run(quantum_instance=None, **kwargs)">
Execute the algorithm with selected backend.
**Parameters**
* **quantum\_instance** (`Union`\[`QuantumInstance`, `Backend`, `BaseBackend`, `None`]) the experimental setting.
* **kwargs** (*dict*) kwargs
**Returns**
results of an algorithm.
**Return type**
dict
**Raises**
[**AquaError**](qiskit.aqua.AquaError "qiskit.aqua.AquaError") If a quantum instance or backend has not been provided
</Function>
### set\_backend
<Function id="qiskit.chemistry.algorithms.QEomVQE.set_backend" signature="QEomVQE.set_backend(backend, **kwargs)">
Sets backend with configuration.
**Return type**
`None`
</Function>
### supports\_aux\_operators
<Function id="qiskit.chemistry.algorithms.QEomVQE.supports_aux_operators" signature="QEomVQE.supports_aux_operators()" modifiers="classmethod">
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
</Function>
## Attributes
### aux\_operators
<Attribute id="qiskit.chemistry.algorithms.QEomVQE.aux_operators">
Returns aux operators
**Return type**
`Optional`\[`List`\[`Optional`\[`OperatorBase`]]]
</Attribute>
### backend
<Attribute id="qiskit.chemistry.algorithms.QEomVQE.backend">
Returns backend.
**Return type**
`Union`\[`Backend`, `BaseBackend`]
</Attribute>
### expectation
<Attribute id="qiskit.chemistry.algorithms.QEomVQE.expectation">
The expectation value algorithm used to construct the expectation measurement from the observable.
**Return type**
`ExpectationBase`
</Attribute>
### initial\_point
<Attribute id="qiskit.chemistry.algorithms.QEomVQE.initial_point">
Returns initial point
**Return type**
`Optional`\[`ndarray`]
</Attribute>
### operator
<Attribute id="qiskit.chemistry.algorithms.QEomVQE.operator">
Returns operator
**Return type**
`Optional`\[`OperatorBase`]
</Attribute>
### optimal\_params
<Attribute id="qiskit.chemistry.algorithms.QEomVQE.optimal_params">
The optimal parameters for the variational form.
**Return type**
`List`\[`float`]
</Attribute>
### optimizer
<Attribute id="qiskit.chemistry.algorithms.QEomVQE.optimizer">
Returns optimizer
**Return type**
`Optional`\[`Optimizer`]
</Attribute>
### quantum\_instance
<Attribute id="qiskit.chemistry.algorithms.QEomVQE.quantum_instance">
Returns quantum instance.
**Return type**
`Optional`\[`QuantumInstance`]
</Attribute>
### random
<Attribute id="qiskit.chemistry.algorithms.QEomVQE.random">
Return a numpy random.
</Attribute>
### setting
<Attribute id="qiskit.chemistry.algorithms.QEomVQE.setting">
Prepare the setting of VQE as a string.
</Attribute>
### var\_form
<Attribute id="qiskit.chemistry.algorithms.QEomVQE.var_form">
Returns variational form
**Return type**
`Union`\[`QuantumCircuit`, `VariationalForm`, `None`]
</Attribute>
</Class>