Skip to content
Merged
Show file tree
Hide file tree
Changes from 71 commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
98edf5f
Add QRE code owners for PR review assignment. (#2853)
msoeken Jan 15, 2026
24f5344
Merge branch 'main' into feature/qre
msoeken Jan 27, 2026
413cba3
Types to define ISAs and ISA requirements (#2856)
msoeken Jan 27, 2026
dcc53ed
Enumerate ISAs with transforms and queries (#2894)
msoeken Jan 30, 2026
0fae825
Initial commit; hypergraph module added (#2909)
brad-lackey Feb 2, 2026
c0308e9
Data types for traces, transforms, Pareto frontiers (#2907)
msoeken Feb 3, 2026
4c706d4
Magnets: added greedy edge coloring method, and two simple 1d lattice…
brad-lackey Feb 3, 2026
50d9bbc
Magnets: Base classes for Trotter-Suzuki expansions (#2913)
brad-lackey Feb 3, 2026
c8b973a
Base class for magnet models (#2914)
brad-lackey Feb 3, 2026
29c03ba
Magnets: more basic geometries (#2919)
brad-lackey Feb 6, 2026
ecd7e23
ISA queries, trace queries, and enumeration. (#2916)
msoeken Feb 7, 2026
aee65fa
Magnets: changed implementation of edge coloring (#2925)
brad-lackey Feb 9, 2026
b3f5198
Magnets: refactored Trotter step classes and added Suzuki and Yoshida…
brad-lackey Feb 9, 2026
b026182
New ISA and ISARequirements function (#2923)
msoeken Feb 10, 2026
289a181
Track instruction origin (#2933)
msoeken Feb 13, 2026
80ec786
Refactor trace and result properties (#2952)
msoeken Feb 17, 2026
bcc31d0
Brlackey/magnets ising model (#2955)
brad-lackey Feb 18, 2026
e19e6a1
Magnets: added utilities (#2965)
brad-lackey Feb 20, 2026
511c953
Various RE models and some API enhancements (#2963)
msoeken Feb 25, 2026
696f0dc
Merge branch 'main' into feature/qre
msoeken Feb 26, 2026
41bf7b5
Magnets: revisions to (hypergraph) coloring (#2972)
brad-lackey Feb 26, 2026
674124f
Minor changes to colorings and term representation; added Heisenberg …
brad-lackey Feb 27, 2026
1040016
More edits to functionality
brad-lackey Mar 5, 2026
739d087
Merge branch 'feature/qre' of github.com:microsoft/qdk into feature/qre
brad-lackey Mar 5, 2026
df1f2c2
Fix magnet tests (#3006)
msoeken Mar 10, 2026
bdddb70
Resource estimation results table (#2973)
msoeken Mar 11, 2026
a7d15c9
Refactor property keys from string to integer and add estimation impr…
msoeken Mar 16, 2026
8b1b520
QIR interop in QRE (#3018)
msoeken Mar 16, 2026
5ce010a
Split Yoked SC model into two codes (#3019)
msoeken Mar 17, 2026
0c86dbb
Use Rust parallelism for estimation with post processing (#3025)
msoeken Mar 17, 2026
dcadb5c
Fixes bucketing logic to distribute rotations to match the right dept…
msoeken Mar 23, 2026
317ff6a
Graph-based ISA pruning for resource estimation (#3031)
msoeken Mar 23, 2026
5de8ec1
Magnets: modified Trotter expansion classes and added Cirq output. (#…
brad-lackey Mar 23, 2026
1d5b568
Two small fixes to QRE 3 (#3041)
msoeken Mar 23, 2026
cd308a9
Return ISA as a pandas data frame (#3042)
msoeken Mar 23, 2026
8597d0a
Temporary plotting for estimation results (#3043)
msoeken Mar 23, 2026
232df87
Get the name of a known property ID as a string (#3044)
msoeken Mar 23, 2026
f1ceab8
Trace properties for logical qubits (#3045)
msoeken Mar 23, 2026
9d87a9c
Expose ISA requirements of a trace (#3046)
msoeken Mar 23, 2026
dabfa32
Trace ISA requirements (#3050)
msoeken Mar 25, 2026
c22cf5c
Plot multiple estimation tables in single plot (#3054)
msoeken Mar 25, 2026
0b92123
Create QRE traces from cirq circuits (#3060)
msoeken Mar 27, 2026
bc9a3c7
Merge branch 'main' into feature/qre
msoeken Mar 27, 2026
358171d
File missing from previous merge.
msoeken Mar 27, 2026
8f08a2b
Reorganize files and spit up large files in QRE (#3069)
msoeken Mar 30, 2026
c1bc4fc
Complete and consistent docs for QRE (#3077)
msoeken Apr 2, 2026
556e8a4
Remove matplotlib from tests (#3078)
msoeken Apr 2, 2026
cf70736
Adjust pruning logic for graph based search (#3089)
msoeken Apr 2, 2026
04f1e46
Merge branch 'main' into feature/qre
msoeken Apr 2, 2026
e5708d1
Fix CODEOWNERS file.
msoeken Apr 2, 2026
1c3b049
Enhance application models.
msoeken Apr 7, 2026
204c3e0
Address or postpone TODOs.
msoeken Apr 7, 2026
9d63b78
OpenQASM application model.
msoeken Apr 7, 2026
7c24ece
Re-export qre from the qdk package as extra dependency.
msoeken Apr 8, 2026
4b1acbf
Convenience functions for custom properties and property columns.
msoeken Apr 9, 2026
32ce932
API and doc improvements.
msoeken Apr 9, 2026
ce85591
Fix problem with negative exponents in cirq interop.
msoeken Apr 14, 2026
923a356
Move magnets module into qre.application.
msoeken Apr 15, 2026
017ebfc
Add telemetry events for QRE.
msoeken Apr 15, 2026
fc899f9
Cirq interop handles memory/compute qubits.
msoeken Apr 15, 2026
0f31c20
Make RoundBasedFactory not expose lattice surgery instructions into p…
msoeken Apr 15, 2026
ef339bb
Clarify memory qubit tracking in Cirq interop.
msoeken Apr 15, 2026
6d801f2
Addressing reviewer comments.
msoeken Apr 16, 2026
74220b9
Missed pandas dependency in all.
msoeken Apr 16, 2026
3aea86f
Remove spurious commented code
brad-lackey Apr 16, 2026
c379b59
Instruction IDs and property keys.
msoeken Apr 17, 2026
42666f3
Properties.
msoeken Apr 20, 2026
a4f812c
Instruction IDs.
msoeken Apr 20, 2026
9f00d3b
Add diagnostic code to error type.
msoeken Apr 21, 2026
8674a75
qre extras in qsharp package.
msoeken Apr 22, 2026
e6474c3
Move magnets to applications module in qsharp and qdk.
msoeken Apr 22, 2026
2f3b526
Merge branch 'main' into feature/qre
msoeken Apr 22, 2026
3eb898b
PyQIR API updates.
msoeken Apr 22, 2026
543f021
Apply suggestion from @billti
billti Apr 22, 2026
2405dba
Merge remote-tracking branch 'origin/main' into feature/qre
billti Apr 22, 2026
ecce077
Exclude cirq on Windows ARM64
billti Apr 22, 2026
cd3f5c3
More cirq preconditions
billti Apr 23, 2026
8691f67
Merge remote-tracking branch 'origin/main' into feature/qre
billti Apr 23, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
/source/compiler/qsc_partial_eval @idavis @swernli
/source/compiler/qsc_rca @idavis @swernli
/source/compiler/qsc_rir @idavis @swernli
/source/fuzz @billti @idavis @swernli
/source/fuzz @billti @idavis @swernli
/katas @billti @swernli
/source/jupyterlab @billti @idavis @minestarks
/source/language_service @billti @idavis @minestarks @ScottCarda-MS
Expand All @@ -19,7 +19,9 @@
/library @swernli @orpuente-MS
/source/npm @billti @minestarks @ScottCarda-MS
/source/pip @billti @idavis @minestarks
/source/pip/qsharp/qre @msoeken @brad-lackey @jwhogabo
/source/playground @billti @minestarks
/source/qre @msoeken @brad-lackey @jwhogabo
/source/resource_estimator @billti @swernli
/samples @minestarks @swernli
/source/vscode @billti @idavis @minestarks
Expand Down
13 changes: 13 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ members = [
"source/language_service",
"source/simulators",
"source/pip",
"source/qre",
"source/resource_estimator",
"source/samples_test",
"source/wasm",
Expand Down
1 change: 1 addition & 0 deletions source/pip/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ num-traits = { workspace = true }
qsc = { path = "../compiler/qsc" }
qdk_simulators = { path = "../simulators" }
resource_estimator = { path = "../resource_estimator" }
qre = { path = "../qre" }
miette = { workspace = true, features = ["fancy"] }
rustc-hash = { workspace = true }
serde = { workspace = true, features = ["derive"] }
Expand Down
105 changes: 105 additions & 0 deletions source/pip/benchmarks/bench_qre.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

import timeit
from dataclasses import dataclass, KW_ONLY, field
from qsharp.qre import linear_function, generic_function
from qsharp.qre._architecture import _make_instruction
from qsharp.qre.models import (
GateBased,
SurfaceCode,
TwoDimensionalYokedSurfaceCode,
Litinski19Factory,
)
from qsharp.qre._enumeration import _enumerate_instances


def bench_enumerate_instances():
# Measure performance of enumerating instances with a large domain
@dataclass
class LargeDomain:
_: KW_ONLY
param1: int = field(default=0, metadata={"domain": range(1000)})
param2: bool

number = 100

duration = timeit.timeit(
"list(_enumerate_instances(LargeDomain))",
globals={
"_enumerate_instances": _enumerate_instances,
"LargeDomain": LargeDomain,
},
number=number,
)

print(f"Enumerating instances took {duration / number:.6f} seconds on average.")


def bench_enumerate_isas():
ctx = GateBased(gate_time=50, measurement_time=100).context()

# Hierarchical factory using from_components
query = (
SurfaceCode.q()
* TwoDimensionalYokedSurfaceCode.q(source=SurfaceCode.q())
* Litinski19Factory.q()
)

number = 100
duration = timeit.timeit(
"list(query.enumerate(ctx))",
globals={
"query": query,
"ctx": ctx,
},
number=number,
)

print(f"Enumerating ISAs took {duration / number:.6f} seconds on average.")


def bench_function_evaluation_linear():
fl = linear_function(12)

inst = _make_instruction(42, 0, None, 1, fl, None, 1.0, {})
number = 1000
duration = timeit.timeit(
"inst.space(5)",
globals={
"inst": inst,
},
number=number,
)

print(
f"Evaluating linear function took {duration / number:.6f} seconds on average."
)


def bench_function_evaluation_generic():
def func(arity: int) -> int:
return 12 * arity

fg = generic_function(func)

inst = _make_instruction(42, 0, None, 1, fg, None, 1.0, {})
number = 1000
duration = timeit.timeit(
"inst.space(5)",
globals={
"inst": inst,
},
number=number,
)

print(
f"Evaluating linear function took {duration / number:.6f} seconds on average."
)


if __name__ == "__main__":
bench_enumerate_instances()
bench_enumerate_isas()
bench_function_evaluation_linear()
bench_function_evaluation_generic()
1 change: 1 addition & 0 deletions source/pip/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jupyterlab = ["qsharp-jupyterlab"]
widgets = ["qsharp-widgets"]
qiskit = ["qiskit>=1.2.2,<3.0.0"]
cirq = ["cirq-core>=1.6.1,<1.7"]
qre = ["cirq-core==1.6.1,<1.7", "pandas>=2.1", "ply>=3.11", "pyqir<0.12"]
Comment thread
billti marked this conversation as resolved.
Outdated

[build-system]
requires = ["maturin ~= 1.10.2"]
Expand Down
2 changes: 2 additions & 0 deletions source/pip/qsharp/applications/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
14 changes: 14 additions & 0 deletions source/pip/qsharp/applications/magnets/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

# flake8: noqa F403
# pyright: ignore[reportWildcardImportFromLibrary]

"""Magnets application module.
Re-exports from the submodules."""

from .geometry import *
from .models import *
from .trotter import *
from .utilities import *
22 changes: 22 additions & 0 deletions source/pip/qsharp/applications/magnets/geometry/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

"""Geometry module for representing quantum system topologies.
This module provides hypergraph data structures for representing the
geometric structure of quantum systems, including lattice topologies
and interaction graphs.
"""

from .complete import CompleteBipartiteGraph, CompleteGraph
from .lattice1d import Chain1D, Ring1D
from .lattice2d import Patch2D, Torus2D

__all__ = [
"CompleteBipartiteGraph",
"CompleteGraph",
"Chain1D",
"Ring1D",
"Patch2D",
"Torus2D",
]
150 changes: 150 additions & 0 deletions source/pip/qsharp/applications/magnets/geometry/complete.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

"""Complete graph geometries for quantum simulations.

This module provides classes for representing complete graphs and complete
bipartite graphs as hypergraphs. These structures are useful for quantum
systems with all-to-all or bipartite all-to-all interactions.
"""

from ..utilities import (
Hyperedge,
Hypergraph,
HypergraphEdgeColoring,
)


class CompleteGraph(Hypergraph):
"""A complete graph where every vertex is connected to every other vertex.

In a complete graph K_n, there are n vertices and n(n-1)/2 edges,
with each pair of distinct vertices connected by exactly one edge.

Attributes:
n: Number of vertices in the graph.

Example:

.. code-block:: python
>>> graph = CompleteGraph(4)
>>> graph.nvertices
4
>>> graph.nedges
6
"""

def __init__(self, n: int, self_loops: bool = False) -> None:
"""Initialize a complete graph.

Args:
n: Number of vertices in the graph.
self_loops: If True, include self-loop edges on each vertex
for single-site terms.
"""
if self_loops:
_edges = [Hyperedge([i]) for i in range(n)]
else:
_edges = []

# Add all pairs of vertices
for i in range(n):
for j in range(i + 1, n):
_edges.append(Hyperedge([i, j]))
super().__init__(_edges)

self.n = n

def edge_coloring(self) -> HypergraphEdgeColoring:
"""Compute edge coloring for this complete graph."""
coloring = HypergraphEdgeColoring(self)
for edge in self.edges():
if len(edge.vertices) == 1:
coloring.add_edge(edge, -1)
else:
if self.n % 2 == 0:
i, j = edge.vertices
m = self.n - 1
if j == m:
coloring.add_edge(edge, i)
elif (j - i) % 2 == 0:
coloring.add_edge(edge, (j - i) // 2)
else:
coloring.add_edge(edge, (j - i + m) // 2)
else:
m = self.n
i, j = edge.vertices
if (j - i) % 2 == 0:
coloring.add_edge(edge, (j - i) // 2)
else:
coloring.add_edge(edge, (j - i + m) // 2)
return coloring


class CompleteBipartiteGraph(Hypergraph):
"""A complete bipartite graph with two vertex sets.

In a complete bipartite graph K_{m,n} (m <= n), there are m + n
vertices partitioned into two sets of sizes m and n. Every vertex
in the first set is connected to every vertex in the second set,
giving m * n edges total.

Vertices 0 to m-1 form the first set, and vertices m to m+n-1
form the second set.

Attributes:
m: Number of vertices in the first set.
n: Number of vertices in the second set.

Requires:
m <= n

Example:

.. code-block:: python
>>> graph = CompleteBipartiteGraph(2, 3)
>>> graph.nvertices
5
>>> graph.nedges
6
"""

def __init__(self, m: int, n: int, self_loops: bool = False) -> None:
"""Initialize a complete bipartite graph.

Args:
m: Number of vertices in the first set (vertices 0 to m-1).
n: Number of vertices in the second set (vertices m to m+n-1).
self_loops: If True, include self-loop edges on each vertex
for single-site terms.
"""
assert m <= n, "Require m <= n for CompleteBipartiteGraph."
total_vertices = m + n

if self_loops:
_edges = [Hyperedge([i]) for i in range(total_vertices)]

else:
_edges = []

# Connect every vertex in first set to every vertex in second set
for i in range(m):
for j in range(m, m + n):
_edges.append(Hyperedge([i, j]))
super().__init__(_edges)

self.m = m
self.n = n

def edge_coloring(self) -> HypergraphEdgeColoring:
"""Compute edge coloring for this complete bipartite graph."""
coloring = HypergraphEdgeColoring(self)
m = self.m
n = self.n
for edge in self.edges():
if len(edge.vertices) == 1:
coloring.add_edge(edge, -1)
else:
i, j = edge.vertices
coloring.add_edge(edge, (i + j - m) % n)
return coloring
Loading
Loading