qsp

Simulates Hamiltonian time evolution via QSP block-encoding and Chebyshev polynomial transformations.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve? Implementing QSP-based Hamiltonian simulation requires correctly combining block encoding, Bessel-derived Chebyshev coefficients, LCU circuit construction, and time-slice management, which is error-prone without a structured reference. ## Core Features & Use Cases - QSP-HS Algorithm Guide: Explains how QSPHSAlgorithm approximates e^{-iHt} by block-encoding a Hamiltonian and applying polynomial spectral transformations, with full parameter and return-value documentation. - Accuracy vs. Depth Control: Details how degree, beta, and automatic time_slices expansion jointly control approximation error and circuit depth, including the degree estimation formula. - Reference Implementations: Provides a verification script and a manual matrix-level implementation for debugging, validation, and reimplementation. - Use Case: A researcher benchmarking Hamiltonian simulation methods can run parameter sweeps over evolution time and polynomial degree, then compare the Frobenius-norm error against exact scipy.linalg.expm results. ## Quick Start Ask the assistant to run QSP Hamiltonian simulation on the 2x2 Hermitian matrix [[2,1],[1,3]] with t=1.0, error=1e-8, degree=15, and report the Frobenius-norm error.

Frequently Asked Questions about qsp

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

FAQPage Schema
How do I run QSP Hamiltonian simulation in Python?

Instantiate QSPHSAlgorithm and call run() with a Hermitian matrix H, evolution time t, target error, polynomial degree, and beta. It returns the approximate and exact evolution matrices plus the Frobenius-norm error for validation.

What is the difference between QSP Hamiltonian simulation and Trotterization?

QSP block-encodes the full Hamiltonian once and applies polynomial spectral transformations, achieving near-optimal query complexity. Trotterization decomposes H term-by-term into product formulas, typically requiring more gates for the same accuracy.

How do degree and time slices affect QSP simulation accuracy?

The required degree grows linearly with |alpha*t_slice| and logarithmically with 1/error. When the requested degree is insufficient, the algorithm automatically doubles time_slices until the per-slice degree fits, trading circuit repetitions for lower polynomial degree.

Why does QSP simulation fail with non-Hermitian Hamiltonians?

Block encoding requires H to be Hermitian within atol=1e-12; non-Hermitian inputs cause encoding failures. Symmetrize the input with H = (H + H.conj().T) / 2 before running the simulation.

What does the beta parameter do in QSP Hamiltonian simulation?

Beta is a preconditioning factor in (0, 1) that scales Chebyshev polynomial values to stay within [-1, 1] for numerical stability. The factor 2/beta later rescales the LCU output to recover the true evolution operator; the default 0.7 suits typical Hamiltonians.