goqu

module
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2026 License: MIT

README

Goqu

Kamehame-Hadamard!

Go Reference CI codecov Go Report Card

A quantum computing SDK in pure Go — build, simulate, transpile, and run quantum circuits with zero external dependencies.

package main

import (
    "fmt"

    "github.com/splch/goqu/circuit/builder"
    "github.com/splch/goqu/sim/statevector"
)

func main() {
    c, _ := builder.New("bell", 2).
        H(0).
        CNOT(0, 1).
        MeasureAll().
        Build()

    sim := statevector.New(2)
    counts, _ := sim.Run(c, 1024)
    fmt.Println(counts) // map[00:~512 11:~512]
}

Install

go get github.com/splch/goqu@latest

Requires Go 1.24+.

Features

Area Details
Circuit Construction Fluent builder, 40+ gates, immutable IR, symbolic parameters, dynamic circuits
Simulation Statevector (28 qubits, auto-parallel), density matrix, Clifford (1000s of qubits), CUDA, Metal
Algorithms Grover, Shor, VQE, QAOA, QPE, HHL, amplitude estimation, Trotter, VQC, and more
Error Mitigation ZNE, readout correction, Pauli twirling, dynamical decoupling, PEC, CDR, TREX
Hardware Backends IBM, IonQ, Google, Amazon Braket, Quantinuum, Rigetti
Transpilation SABRE routing, 4 optimization levels, decomposition, gate cancellation, verification
Interop OpenQASM 2/3 parser + emitter, Quil emitter
Visualization Text, SVG, LaTeX circuits; histograms; Bloch spheres
Pulse Programming OpenPulse model, waveforms, defcal
Noise Modeling Kraus operators, device noise models, depolarizing/amplitude-damping channels
Observability Zero-dep hooks + OpenTelemetry and Prometheus bridges
Education 20 Jupyter notebooks from qubits to Shor's algorithm (Go kernel via gonb)
q0: ─H───@──
         │
q1: ─────X──

Documentation

Contributing

Contributions welcome — open an issue or submit a PR. Run make test before submitting.

License

MIT

Directories

Path Synopsis
Package algorithm provides quantum algorithms and classical optimization.
Package algorithm provides quantum algorithms and classical optimization.
ampest
Package ampest implements Quantum Amplitude Estimation.
Package ampest implements Quantum Amplitude Estimation.
ansatz
Package ansatz provides parameterized circuit templates for variational algorithms.
Package ansatz provides parameterized circuit templates for variational algorithms.
counting
Package counting implements Quantum Approximate Counting.
Package counting implements Quantum Approximate Counting.
gradient
Package gradient provides quantum gradient computation methods.
Package gradient provides quantum gradient computation methods.
grover
Package grover implements Grover's quantum search algorithm.
Package grover implements Grover's quantum search algorithm.
hhl
Package hhl implements the Harrow-Hassidim-Lloyd algorithm for solving linear systems of equations Ax = b on a quantum computer.
Package hhl implements the Harrow-Hassidim-Lloyd algorithm for solving linear systems of equations Ax = b on a quantum computer.
internal/algoutil
Package algoutil provides shared helper functions for the algorithm subpackages.
Package algoutil provides shared helper functions for the algorithm subpackages.
mitigation
Package mitigation provides quantum error mitigation techniques for NISQ devices.
Package mitigation provides quantum error mitigation techniques for NISQ devices.
optim
Package optim provides classical optimization algorithms.
Package optim provides classical optimization algorithms.
qaoa
Package qaoa implements the Quantum Approximate Optimization Algorithm.
Package qaoa implements the Quantum Approximate Optimization Algorithm.
qpe
Package qpe implements Quantum Phase Estimation.
Package qpe implements Quantum Phase Estimation.
shor
Package shor implements Shor's quantum factoring algorithm.
Package shor implements Shor's quantum factoring algorithm.
textbook
Package textbook implements textbook quantum algorithms: Bernstein-Vazirani, Deutsch-Jozsa, and Simon's algorithm.
Package textbook implements textbook quantum algorithms: Bernstein-Vazirani, Deutsch-Jozsa, and Simon's algorithm.
trotter
Package trotter implements Trotter-Suzuki Hamiltonian simulation.
Package trotter implements Trotter-Suzuki Hamiltonian simulation.
vqc
Package vqc implements the Variational Quantum Classifier.
Package vqc implements the Variational Quantum Classifier.
vqd
Package vqd implements the Variational Quantum Deflation algorithm.
Package vqd implements the Variational Quantum Deflation algorithm.
vqe
Package vqe implements the Variational Quantum Eigensolver.
Package vqe implements the Variational Quantum Eigensolver.
Package backend defines the interface for quantum execution backends.
Package backend defines the interface for quantum execution backends.
ibm
Package ibm implements a backend.Backend for IBM Quantum via the Qiskit Runtime V2 API.
Package ibm implements a backend.Backend for IBM Quantum via the Qiskit Runtime V2 API.
ionq
Package ionq implements a backend.Backend for the IonQ quantum cloud via its REST API (v0.4).
Package ionq implements a backend.Backend for the IonQ quantum cloud via its REST API (v0.4).
local
Package local provides a backend.Backend backed by the in-process statevector simulator.
Package local provides a backend.Backend backed by the in-process statevector simulator.
mock
Package mock provides a configurable backend.Backend for testing job managers and pipelines without network calls.
Package mock provides a configurable backend.Backend for testing job managers and pipelines without network calls.
quantinuum
Package quantinuum implements a backend.Backend for Quantinuum's H-series trapped-ion quantum computers via the Quantinuum Machine API (v1).
Package quantinuum implements a backend.Backend for Quantinuum's H-series trapped-ion quantum computers via the Quantinuum Machine API (v1).
circuit
builder
Package builder provides a fluent API for constructing quantum circuits.
Package builder provides a fluent API for constructing quantum circuits.
draw
Package draw renders quantum circuits as text, SVG, and LaTeX diagrams.
Package draw renders quantum circuits as text, SVG, and LaTeX diagrams.
gate
Package gate defines the Gate interface and provides a standard library of quantum gates.
Package gate defines the Gate interface and provides a standard library of quantum gates.
ir
Package ir defines the circuit intermediate representation.
Package ir defines the circuit intermediate representation.
param
Package param provides symbolic parameters and expressions for parameterized quantum circuits.
Package param provides symbolic parameters and expressions for parameterized quantum circuits.
internal
mathutil
Package mathutil provides internal math helpers shared across goqu packages.
Package mathutil provides internal math helpers shared across goqu packages.
piformat
Package piformat formats rotation angles as human-readable pi fractions.
Package piformat formats rotation angles as human-readable pi fractions.
job
manager
Package manager provides concurrent job submission, polling, and result retrieval across multiple quantum backends.
Package manager provides concurrent job submission, polling, and result retrieval across multiple quantum backends.
retry
Package retry provides retry policies with exponential backoff and a circuit breaker for protecting against repeated backend failures.
Package retry provides retry policies with exponential backoff and a circuit breaker for protecting against repeated backend failures.
Package observe provides zero-dependency observability hooks for goqu.
Package observe provides zero-dependency observability hooks for goqu.
Package pulse provides types for pulse-level quantum control.
Package pulse provides types for pulse-level quantum control.
defcal
Package defcal maps gate-level circuits to pulse programs via calibration tables.
Package defcal maps gate-level circuits to pulse programs via calibration tables.
qasmparse
Package qasmparse parses OpenQASM 3.0 with OpenPulse cal {} blocks into pulse.Program objects.
Package qasmparse parses OpenQASM 3.0 with OpenPulse cal {} blocks into pulse.Program objects.
waveform
Package waveform provides standard pulse envelope shapes for the pulse package.
Package waveform provides standard pulse envelope shapes for the pulse package.
qasm
emitter
Package emitter serializes a quantum circuit as OpenQASM 3.0 source text.
Package emitter serializes a quantum circuit as OpenQASM 3.0 source text.
parser
Package parser implements a hand-written recursive descent parser for OpenQASM source.
Package parser implements a hand-written recursive descent parser for OpenQASM source.
token
Package token defines the lexical token types for OpenQASM 3.0 parsing.
Package token defines the lexical token types for OpenQASM 3.0 parsing.
quil
emitter
Package emitter writes a Circuit as Quil source.
Package emitter writes a Circuit as Quil source.
sim
Package sim defines the Simulator interface satisfied by all backends (CPU statevector, density matrix, GPU, etc.).
Package sim defines the Simulator interface satisfied by all backends (CPU statevector, density matrix, GPU, etc.).
clifford
Package clifford implements an efficient stabilizer-state simulator using the Aaronson-Gottesman tableau representation.
Package clifford implements an efficient stabilizer-state simulator using the Aaronson-Gottesman tableau representation.
densitymatrix
Package densitymatrix implements a density matrix quantum simulator supporting mixed states and noise channels.
Package densitymatrix implements a density matrix quantum simulator supporting mixed states and noise channels.
noise
Package noise defines quantum noise channels and noise models for use with the density matrix simulator.
Package noise defines quantum noise channels and noise models for use with the density matrix simulator.
operator
Package operator provides quantum channel representations and conversions.
Package operator provides quantum channel representations and conversions.
pauli
Package pauli provides Pauli algebra types and efficient expectation value computation for statevector and density matrix simulators.
Package pauli provides Pauli algebra types and efficient expectation value computation for statevector and density matrix simulators.
pulsesim
Package pulsesim simulates pulse programs via statevector evolution.
Package pulsesim simulates pulse programs via statevector evolution.
statevector
Package statevector implements a full statevector quantum simulator supporting up to 28 qubits.
Package statevector implements a full statevector quantum simulator supporting up to 28 qubits.
Package sweep provides parameter sweep types for evaluating variational quantum circuits across ranges of parameter values.
Package sweep provides parameter sweep types for evaluating variational quantum circuits across ranges of parameter values.
Package transpile provides the quantum circuit transpilation framework.
Package transpile provides the quantum circuit transpilation framework.
analysis
Package analysis provides circuit analysis helpers for transpilation passes.
Package analysis provides circuit analysis helpers for transpilation passes.
decompose
Package decompose provides gate decomposition algorithms for single-qubit and two-qubit unitaries.
Package decompose provides gate decomposition algorithms for single-qubit and two-qubit unitaries.
pass
Package pass provides individual transpilation passes for circuit optimization and target compliance.
Package pass provides individual transpilation passes for circuit optimization and target compliance.
pipeline
Package pipeline provides pre-built transpilation pipelines with four optimization levels, following the industry-standard quantum compilation flow: init → pre-route optimize → route → translate → optimize → validate.
Package pipeline provides pre-built transpilation pipelines with four optimization levels, following the industry-standard quantum compilation flow: init → pre-route optimize → route → translate → optimize → validate.
routing
Package routing inserts SWAP gates to satisfy hardware connectivity constraints using the SABRE algorithm.
Package routing inserts SWAP gates to satisfy hardware connectivity constraints using the SABRE algorithm.
target
Package target defines hardware target descriptions for transpilation.
Package target defines hardware target descriptions for transpilation.
verify
Package verify checks circuit equivalence using statevector simulation.
Package verify checks circuit equivalence using statevector simulation.
Package viz renders quantum simulation results as SVG visualizations.
Package viz renders quantum simulation results as SVG visualizations.

Jump to

Keyboard shortcuts

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