# qiskit.aqua.algorithms.NumPyEigensolver¶

class NumPyEigensolver(operator=None, k=1, aux_operators=None, filter_criterion=None)[código fonte]

The NumPy Eigensolver algorithm.

NumPy Eigensolver computes up to the first $$k$$ eigenvalues of a complex-valued square matrix of dimension $$n \times n$$, with $$k \leq n$$.

Nota

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.

Parâmetros
• 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.

__init__(operator=None, k=1, aux_operators=None, filter_criterion=None)[código fonte]
Parâmetros
• 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

 __init__([operator, k, aux_operators, …]) type operator Union[OperatorBase, LegacyBaseOperator, None] compute_eigenvalues([operator, aux_operators]) Computes eigenvalues. run() Execute the classical algorithm. Whether computing the expectation value of auxiliary operators is supported.

Attributes

 aux_operators Returns the auxiliary operators. filter_criterion returns the filter criterion if set k returns k (number of eigenvalues requested) operator Return the operator. random Return a numpy random.
property aux_operators

Returns the auxiliary operators.

Tipo de retorno

Optional[List[Optional[OperatorBase]]]

compute_eigenvalues(operator=None, aux_operators=None)[código fonte]

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.

Parâmetros
• 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

Tipo de retorno

EigensolverResult

Retorna

EigensolverResult

property filter_criterion

returns the filter criterion if set

Tipo de retorno

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

property k

returns k (number of eigenvalues requested)

Tipo de retorno

int

property operator

Return the operator.

Tipo de retorno

Optional[OperatorBase]

property random

Return a numpy random.

run()

Execute the classical algorithm.

Retorna

results of an algorithm.

Tipo de retorno

dict

classmethod supports_aux_operators()[código fonte]

Whether computing the expectation value of auxiliary operators is supported.

Tipo de retorno

bool

Retorna

True if aux_operator expectations can be evaluated, False otherwise