hadamard-test

Official

Estimate quantum expectations with Hadamard tests

Authorunitarylab
Version1.0.0
Installs0

System Documentation

What problem does it solve?

The Hadamard Test Skill enables efficient estimation of the real and imaginary parts of the expectation ⟨ψ|U|ψ⟩ for a unitary U on a state |ψ⟩, and it also supports measuring overlaps via a swap test. It provides a reusable workflow for quantum algorithm debugging, verification, and phase information extraction.

Core Features & Use Cases

  • Three modes: 'expectation' (real/imag parts), 'swap_test' (overlap), and 'phase_estimation' (complex eigenphase).
  • Optional imaginary component extraction via S† on the ancilla, and support for preparing arbitrary target states.
  • Flexible backend simulation with shot-based noise and optional circuit diagram export for visualization.
  • Works with a GateSequence representation and a HadamardTestAlgorithm runner to integrate into larger quantum workflows.
  • Educational and prototyping friendly, suitable for learning, experimentation, and algorithm development.

Quick Start

Instantiate U and prepare_psi, then run HadamardTestAlgorithm with mode set to 'expectation' to obtain the Re/Im estimates.

Dependency Matrix

Required Modules

None required

Components

scripts

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: hadamard-test
Download link: https://github.com/unitarylab/quantum-skills/archive/main.zip#hadamard-test

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.