qpe

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 17, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package qpe implements Quantum Phase Estimation.

Given a unitary U and an eigenstate |ψ⟩ with U|ψ⟩ = e^{2πiφ}|ψ⟩, QPE estimates the phase φ using a register of ancilla qubits and the inverse Quantum Fourier Transform.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyInverseQFT

func ApplyInverseQFT(b *builder.Builder, n int)

ApplyInverseQFT applies the inverse QFT in-place on qubits [0..n-1].

func ApplyQFT

func ApplyQFT(b *builder.Builder, n int)

ApplyQFT applies the QFT in-place on qubits [0..n-1] of the builder.

func InverseQFT

func InverseQFT(numQubits int) (*ir.Circuit, error)

InverseQFT builds an inverse QFT circuit on numQubits.

func QFT

func QFT(numQubits int) (*ir.Circuit, error)

QFT builds a Quantum Fourier Transform circuit on numQubits.

Types

type Config

type Config struct {
	// Unitary is the gate whose eigenvalue phase to estimate.
	Unitary gate.Gate
	// NumPhaseBits is the number of ancilla qubits for precision.
	NumPhaseBits int
	// EigenState is a preparation circuit for the target eigenstate.
	// If nil, the target register is left in |0...0⟩.
	EigenState *ir.Circuit
	// Shots is the number of measurement shots. Default: 1024.
	Shots int
}

Config specifies the QPE problem.

type Result

type Result struct {
	Circuit      *ir.Circuit
	Counts       map[string]int
	Phase        float64
	PhaseRegBits int
}

Result holds QPE output.

func Run

func Run(ctx context.Context, cfg Config) (*Result, error)

Run executes Quantum Phase Estimation.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL