Skip to main content
IBM Quantum Platform
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.

NumPyEigensolver

class NumPyEigensolver(operator=None, k=1, aux_operators=None, filter_criterion=None)

GitHub

Bases: qiskit.aqua.algorithms.classical_algorithm.ClassicalAlgorithm, qiskit.aqua.algorithms.eigen_solvers.eigen_solver.Eigensolver

The NumPy Eigensolver algorithm.

NumPy Eigensolver computes up to the first kk eigenvalues of a complex-valued square matrix of dimension n×nn \times n, with knk \leq n.

Note

Operators are automatically converted to MatrixOperator as needed and this conversion can be costly in terms of memory and performance as the operator size, mostly in terms of number of qubits it represents, gets larger.

Parameters

  • operator (Union[OperatorBase, LegacyBaseOperator, None]) – Operator instance. If None is supplied it must be provided later before run() is called. Allowing None here permits the algorithm to be configured and used later when operator is available, say creating an instance an letting application stack use this algorithm with an operator it creates.
  • k (int) – How many eigenvalues are to be computed, has a min. value of 1.
  • aux_operators (Optional[List[Union[OperatorBase, LegacyBaseOperator, None]]]) – Auxiliary operators to be evaluated at each eigenvalue
  • filter_criterion (Optional[Callable[[Union[List, ndarray], float, Optional[List[float]]], bool]]) – callable that allows to filter eigenvalues/eigenstates, only feasible eigenstates are returned in the results. The callable has the signature filter(eigenstate, eigenvalue, aux_values) and must return a boolean to indicate whether to keep this value in the final returned result or not. If the number of elements that satisfies the criterion is smaller than k then the returned list has fewer elements and can even be empty.

Methods

compute_eigenvalues

NumPyEigensolver.compute_eigenvalues(operator=None, aux_operators=None)

Computes eigenvalues. 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

EigensolverResult

Returns

EigensolverResult

run

NumPyEigensolver.run()

Execute the classical algorithm.

Returns

results of an algorithm.

Return type

dict

supports_aux_operators

classmethod NumPyEigensolver.supports_aux_operators()

Whether computing the expectation value of auxiliary operators is supported.

Return type

bool

Returns

True if aux_operator expectations can be evaluated, False otherwise


Attributes

aux_operators

Return type

Optional[List[Optional[OperatorBase]]]

filter_criterion

returns the filter criterion if set

Return type

Optional[Callable[[Union[List, ndarray], float, Optional[List[float]]], bool]]

k

returns k (number of eigenvalues requested)

Return type

int

operator

Return type

Optional[OperatorBase]

random

Return a numpy random.

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