eigensolvers

Compute quantum operator eigenvalues using exact NumPy diagonalization and variational VQD workflows.

18|3|Updated Aug 14, 2026
One-click install
npx skills add https://github.com/unitarylab/quantum-practices --skill eigensolvers-unitarylab
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: eigensolvers
Source: https://github.com/unitarylab/quantum-practices/tree/main/algorithms/eigensolvers
Command: npx skills add https://github.com/unitarylab/quantum-practices --skill eigensolvers-unitarylab

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires qiskit, qiskit_algorithms, numpy, scipy, and includes scripts (resource) components.

What problem does it solve? Choosing and implementing the right eigensolver for a quantum operator is error-prone: exact classical diagonalization scales exponentially, while variational excited-state methods require careful ansatz, optimizer, and penalty tuning. This Skill routes eigensolver tasks to the correct approach and provides runnable Qiskit implementations with validation guidance. ## Core Features & Use Cases - Intent Routing: Directs tasks to NumPyEigensolver for exact diagonalization or VQD for variational excited-state computation based on problem type. - Exact Classical Baseline: Computes the lowest k eigenvalues and eigenstates of SparsePauliOp operators via NumPy/SciPy dense or sparse solvers, with auxiliary operator evaluation and eigenpair filtering. - Variational Excited States: Implements VQD with Qiskit primitives (Estimator, ComputeUncompute fidelity), overlap penalties, and per-step optimization for ground plus excited states. - Use Case: A researcher validating a VQD setup on a 2-qubit Hamiltonian first runs NumPyEigensolver as an exact baseline, then compares variational eigenvalues against the deterministic reference. ## Quick Start Ask the assistant to compute the lowest eigenvalues of a SparsePauliOp Hamiltonian and compare the exact NumPyEigensolver result with a VQD variational estimate.

Frequently Asked Questions about eigensolvers

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I compute eigenvalues of a SparsePauliOp in Qiskit?

Use NumPyEigensolver from qiskit_algorithms.eigensolvers with the k parameter set to the number of eigenvalues needed. Call compute_eigenvalues(operator) to get sorted eigenvalues and eigenstates via exact NumPy/SciPy diagonalization.

How to compute excited states with VQD in Qiskit?

Instantiate VQD with an estimator primitive, a ComputeUncompute fidelity primitive, a parameterized ansatz like RealAmplitudes, an optimizer such as SLSQP, and k for the number of states. VQD adds overlap penalties against previously found states to enforce orthogonality.

NumPyEigensolver vs VQD: which eigensolver should I use?

Use NumPyEigensolver for exact deterministic results on small operators up to roughly 10-12 qubits. Use VQD when a variational workflow is preferred, when testing ansatz-based pipelines, or as a scalable design pattern despite its dependence on optimizer and penalty tuning.

What are the memory limits of exact quantum operator diagonalization?

The dense matrix grows as 2^n by 2^n, so 10 qubits need about 8 MB and 12 qubits about 128 MB in complex128. Beyond 12 qubits the dense path may exhaust memory, making exact diagonalization impractical.

Why does VQD return excited-state energies close to the ground state?

The overlap penalty weights (betas) are too weak to enforce orthogonality against previously found states. Increase betas starting around 1.0, or raise optimizer maxiter so the penalty term is properly minimized.

Can NumPyEigensolver filter eigenvalues by a condition?

Yes, pass a filter_criterion callable with signature (eigenstate, eigenvalue, aux_values) returning a boolean. Only eigenpairs passing the filter are returned, so the result may contain fewer than k entries.