SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · quant-ph/0406196 · 2004

Improved Simulation of Stabilizer Circuits

arXiv · PDF · Open in the Atlas

Code that ran

9 of 11 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 9 have no contract verdict; 0 failures of our instrument; 2 no recorded run), measured 2026-11-22; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/quant-ph/0406196.json · badge: /api/ran/quant-ph/0406196.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
quantumlib/stim community (classifier label)
classifier basis not recorded on the link
5 ran · 1 no recorded run
or1426/Clifford-T-estimator community (classifier label)
classifier basis not recorded on the link
4 ran · 1 no recorded run
FunctionStatusWhere it lives
LMin Ran
ran on a synthesized input
or1426/Clifford-T-estimator/estimate.py
code served (permissive licence) · get_code("27a3574bfd53ad9a")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned float64, ndim 0, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np

def LMin(delta, eta):
    return np.ceil(-np.power(eta / (1 - eta), 2) * np.log(delta))

# delta: should be a small probability value between 0 and 1
delta = 0.1

# eta: should be a value between 0 and 1 (but not equal to 1 to avoid division by zero)
eta = 0.3

ARGS = {
    "delta": delta,
    "eta": eta
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float64, ndim 0, dtype family float — no output shape is stated: observe_signature.py recorded float ndim 0, which disagrees with the fixture run
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
a2str Ran
ran on a synthesized input
or1426/Clifford-T-estimator/util.py
code served (permissive licence) · get_code("63b5fac16913cd36")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np

# Create 1D boolean array
a_1d = np.array([True, False, True, True], dtype=bool)

# Create 2D boolean array
a_2d = np.array([
    [True, False, True],
    [False, True, False],
    [True, True, False]
], dtype=bool)

ARGS = {
    "a": a_1d
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
benchmark_go Ran
ran on a synthesized input
quantumlib/stim/src/stim/circuit/circuit_pybind_perf.py
code served (permissive licence) · get_code("aa3519dd333778a5")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned BenchmarkResult. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import math
import time
from typing import Callable

torch.manual_seed(0)

# The benchmark_go function takes:
# - body: a Callable that takes no arguments
# - target_wait_time_seconds: a float (optional, has default)

# We need to create a simple callable that does some work
def simple_body():
    """A simple function to benchmark - does some lightweight computation"""
    x = 0
    for i in range(100):
        x += i * 2

ARGS = {
    'body': simple_body,
    'target_wait_time_seconds': 0.1
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type BenchmarkResult — a BenchmarkResult output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a BenchmarkResult output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
deltaPrime Ran
ran on a synthesized input
or1426/Clifford-T-estimator/estimate.py
code served (permissive licence) · get_code("e842f57630b81f56")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned float64, ndim 0, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np

# Analyze the function to determine parameter types
# p: used in np.power and arithmetic - scalar or array
# epsTot: used in np.power and arithmetic - scalar or array
# eta: used in arithmetic - scalar or array
# s: used in np.power - scalar or array
# L: used in np.power - scalar or array
# m: used in np.power - scalar or array

# All parameters appear to be numeric scalars or small arrays
# Let's use reasonable numeric values

ARGS = {
    "p": np.array(1.5),
    "epsTot": np.array(0.8),
    "eta": np.array(0.3),
    "s": np.array(2.0),
    "L": np.array(1.2),
    "m": np.array(2),
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float64, ndim 0, dtype family float — no output shape is stated: observe_signature.py recorded float ndim 0, which disagrees with the fixture run
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
epsPrime Ran
ran on a synthesized input
or1426/Clifford-T-estimator/estimate.py
code served (permissive licence) · get_code("793ddace2837fd38")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned float, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np

# Analyze the function epsPrime to understand what parameters it needs:
# - p: appears in deltaPrime calls, used in arithmetic operations - should be numeric
# - deltaTarg: compared with deltaPrime result - should be numeric (delta target)
# - eta: used in arithmetic operations - should be numeric, between 0 and 1
# - s: passed to deltaPrime - should be numeric
# - LPlus: passed to deltaPrime - should be numeric
# - m: passed to deltaPrime - should be numeric
# - precision: optional, defaults to 1e-15 - numeric

# The function performs binary search on epsPrime, so all parameters should be
# reasonable numeric values that allow the algorithm to converge.

# Set up reasonable test values based on differential privacy context:
p = 1.0  # privacy budget parameter
deltaTarg = 0.1  # target delta value
eta = 0.5  # smoothing parameter between 0 and 1
s = 2.0  # sensitivity parameter
LPlus = 5.0  # number of layers
m = 10  # dimension/model parameter
precision = 1e-10  # precision for binary search

ARGS = {
    "p": p,
    "deltaTarg": deltaTarg,
    "eta": eta,
    "s": s,
    "LPlus": LPlus,
    "m": m,
    "precision": precision
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
no_really_i_have_a_doc_why_is_this_needed_argh Ran
ran on a synthesized input
quantumlib/stim/dev/doctest_proper.py
code served (permissive licence) · get_code("e0e8a79a01ff0e8f")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned function. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn


class DummyObjectWithDoc:
    """This is a dummy docstring for testing."""
    pass


# Create an object with a __doc__ attribute
v = DummyObjectWithDoc()

# Define fullname as a string
fullname = "test_function_name"

# Construct the ARGS dictionary
ARGS = {
    "v": v,
    "fullname": fullname,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
normalize_doc_string Ran
ran on a synthesized input
quantumlib/stim/dev/util_gen_stub_file.py
code served (permissive licence) · get_code("6dfda233dc5c1159")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

def normalize_doc_string(d: str) -> str:
    lines = d.splitlines()
    indented_lines = [e for e in lines[1:] if e.strip()]
    indentation = min([len(line) - len(line.lstrip()) for line in indented_lines], default=0)
    return '\n'.join(lines[:1] + [e[indentation:] for e in lines[1:]])

# Test case 1: Simple docstring with consistent indentation
test_docstring_1 = """Summary line.
    Indented content line 1.
    Indented content line 2.
    Another indented line."""

# Test case 2: Docstring with empty lines
test_docstring_2 = """Summary line.
    Content line 1.

    Content line 2."""

# Test case 3: Docstring with varying indentation
test_docstring_3 = """Summary line.
        More indented line.
    Less indented line."""

# Test case 4: Single line docstring
test_docstring_4 = """Just a summary."""

# Test case 5: Docstring with no indented content after summary
test_docstring_5 = """Summary line.
"""

ARGS = {
    "d": test_docstring_1
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
si2 Ran
ran on a synthesized input
quantumlib/stim/src/stim/circuit/circuit_pybind_perf.py
code served (permissive licence) · get_code("670b6e92f440d6bd")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import math

def si2(val: float) -> str:
    """Describe quantity as an SI-prefixed value with two significant figures."""
    unit = ' '
    if val < 1:
        if val < 1:
            val *= 1000
            unit = 'm'
        if val < 1:
            val *= 1000
            unit = 'u'
        if val < 1:
            val *= 1000
            unit = 'n'
        if val < 1:
            val *= 1000
            unit = 'p'
    else:
        if val > 1000:
            val /= 1000
            unit = 'k'
        if val > 1000:
            val /= 1000
            unit = 'M'
        if val > 1000:
            val /= 1000
            unit = 'G'
        if val > 1000:
            val /= 1000
            unit = 'T'
    if 1 <= val < 10:
        return f'{math.floor(val)}.{math.floor(val * 10) % 10} {unit}'
    elif 10 <= val < 100:
        return f' {math.floor(val)} {unit}'
    elif 100 <= val < 1000:
        return f'{math.floor(val / 10) * 10} {unit}'
    else:
        return f'{val} {unit}'


ARGS = {
    'val': 42.5
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
splay_signature Ran
ran on a synthesized input
quantumlib/stim/dev/util_gen_stub_file.py
code served (permissive licence) · get_code("39f943cac460a842")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np
from typing import Optional, Iterator, List

torch.manual_seed(0)

# Analyze the function body:
# - Takes a parameter 'sig' which is a string
# - The function processes the string by:
#   - Replacing various type annotations
#   - Asserting it starts with 'def'
#   - Parsing through characters looking for commas at level 0
#   - Building output list with formatted strings
# - No methods or attributes are called on sig beyond string operations
# - sig must be a valid function signature string starting with 'def'

# Create a valid function signature string to test with
test_sig = "def example_func(x: int, y: str, z: Optional[List[int]]) -> None:"

ARGS = {
    "sig": test_sig
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family float — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
benchmark Not yet run
unverified (harvested, no recorded run)
quantumlib/stim/src/stim/circuit/circuit_pybind_perf.py
code served (permissive licence) · get_code("1205728b447c787a")
How it ran

no invocation recorded.

rref Not yet run
unverified (harvested, no recorded run)
or1426/Clifford-T-estimator/util.py
code served (permissive licence) · get_code("40b74173abf64c50")
How it ran

no invocation recorded.

Also present in other papers' code

Of 11 samples lifted from this paper's linked repositories, 11 carry a function identity and 0 do not. Of the 11 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 11 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-22.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

The Gottesman-Knill theorem says that a stabilizer circuit -- that is, a quantum circuit consisting solely of CNOT, Hadamard, and phase gates -- can be simulated efficiently on a classical computer. This paper improves that theorem in several directions. First, by removing the need for Gaussian elimination, we make the simulation algorithm much faster at the cost of a factor-2 increase in the number of bits needed to represent a state. We have implemented the improved algorithm in a freely-available program called CHP (CNOT-Hadamard-Phase), which can handle thousands of qubits easily. Second, we show that the problem of simulating stabilizer circuits is complete for the classical complexity class ParityL, which means that stabilizer circuits are probably not even universal for classical computation. Third, we give efficient algorithms for computing the inner product between two stabilizer states, putting any n-qubit stabilizer circuit into a "canonical form" that requires at most O(n^2/log n) gates, and other useful tasks. Fourth, we extend our simulation algorithm to circuits acting on mixed states, circuits containing a limited number of non-stabilizer gates, and circuits acting on general tensor-product initial states but containing only a limited number of measurements.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("quant-ph/0406196")
get_code_for_paper("quant-ph/0406196")
have("quant-ph/0406196")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/quant-ph/0406196.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/quant-ph/0406196.svg)](https://syntology.ai/paper/quant-ph/0406196)

Connect an agent — have() is free.