Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
183 commits
Select commit Hold shift + click to select a range
320ec57
Unitary 1
adam-godel Jan 31, 2026
b917f37
placeholder unitary2 file
nicolajack Jan 31, 2026
feefe26
THis is chat
AVeryBoredPerson Jan 31, 2026
6ca9606
Yes
AVeryBoredPerson Jan 31, 2026
fba0753
fixed utils
nicolajack Jan 31, 2026
3e63256
updated unitary2
nicolajack Jan 31, 2026
105c6d7
Removed commonts
AVeryBoredPerson Jan 31, 2026
5e134e3
removed idk.py
nicolajack Jan 31, 2026
cad084c
Merge branch 'main' of https://github.com/adam-godel/2026-Superquantum
AVeryBoredPerson Jan 31, 2026
55b3831
removed inline comments
nicolajack Jan 31, 2026
a7014fe
Test pygridsynth
adam-godel Jan 31, 2026
eb12b4e
updated utils.py, removed redundancy
nicolajack Jan 31, 2026
a28f7b8
updated utils.py
nicolajack Jan 31, 2026
ca35510
temporary unitary3 file
nicolajack Jan 31, 2026
9762ee8
Cleanup
adam-godel Jan 31, 2026
be2bf0e
Update
adam-godel Jan 31, 2026
23ff0eb
removed gatesequence
nicolajack Jan 31, 2026
c8e0f13
WHat
AVeryBoredPerson Jan 31, 2026
dc6fdb4
Merge branch 'main' of https://github.com/adam-godel/2026-Superquantum
AVeryBoredPerson Jan 31, 2026
91d5bd0
fixed test function
nicolajack Jan 31, 2026
51687da
Filespace cleanup
adam-godel Jan 31, 2026
09580db
ajbdla
AVeryBoredPerson Jan 31, 2026
db70991
fixed qasm 3
nicolajack Jan 31, 2026
c3cb644
fixed some errors
nicolajack Jan 31, 2026
a1db818
Add unitary 4
adam-godel Jan 31, 2026
8b9c5bb
Added unitary1 as expected
adam-godel Jan 31, 2026
31d926a
test
nicolajack Jan 31, 2026
1d805a7
Added S gate support and unitary 5 draft
adam-godel Jan 31, 2026
59c4de7
Add unitary 5
adam-godel Jan 31, 2026
c1247fb
Add unitary 6
adam-godel Jan 31, 2026
2aa0008
fixing test
nicolajack Jan 31, 2026
ca3e8cb
fixing test
nicolajack Jan 31, 2026
7f6c8bf
fixed test i think
nicolajack Jan 31, 2026
36d48e1
Added expected unitary 2
adam-godel Jan 31, 2026
7254b8d
updated test
nicolajack Jan 31, 2026
d9dacea
Wrap unitary 2 in H gate
adam-godel Jan 31, 2026
1c9ec96
update
nicolajack Jan 31, 2026
3200805
update
nicolajack Jan 31, 2026
13ddc22
delete extraneous prints
nicolajack Jan 31, 2026
f6062e1
Unitary 2 updated
adam-godel Jan 31, 2026
958b6e9
Fix Rz bug
adam-godel Jan 31, 2026
6c0f35d
Delete comparison
adam-godel Jan 31, 2026
deda472
udpated equal up to global phase
nicolajack Jan 31, 2026
b4d0e1e
added stuff to test
nicolajack Jan 31, 2026
4f9b340
added better thing
nicolajack Jan 31, 2026
08b262f
added t gate counter
nicolajack Jan 31, 2026
82b5568
removed weird duplicate files
nicolajack Jan 31, 2026
483e92b
Fixed unitary 4
adam-godel Jan 31, 2026
1b1a55a
fixed errors
nicolajack Jan 31, 2026
9455201
fixed t gate count
nicolajack Jan 31, 2026
3fb53ff
WEwe
AVeryBoredPerson Jan 31, 2026
ed3718a
fixed scrub test.py
nicolajack Jan 31, 2026
df64edc
Unitary 5
adam-godel Jan 31, 2026
3429361
Global phase update
adam-godel Jan 31, 2026
4f1ca9c
fixed arange?
nicolajack Jan 31, 2026
6092b7d
fixed var names
nicolajack Jan 31, 2026
87e7fb4
Cleanup
adam-godel Jan 31, 2026
0645404
deleting stupid stuff
nicolajack Jan 31, 2026
963a51c
updates
nicolajack Jan 31, 2026
270f240
removed atols
nicolajack Jan 31, 2026
2ecacf9
fixed count t gates
nicolajack Jan 31, 2026
856a28b
Updates
adam-godel Jan 31, 2026
53460be
Update
adam-godel Jan 31, 2026
5058777
Update
adam-godel Jan 31, 2026
1861a16
Fix test script bug
adam-godel Jan 31, 2026
ed8a755
updated unitary2
nicolajack Jan 31, 2026
81356b9
Fix unitary 5
adam-godel Jan 31, 2026
13be966
Unitary7, Not quite finished
timmyjr11 Jan 31, 2026
7694215
Merge branch 'main' of https://github.com/adam-godel/2026-Superquantum
timmyjr11 Jan 31, 2026
d7fe621
added optim
nicolajack Jan 31, 2026
e21c7f7
Fixed unitary 6
adam-godel Jan 31, 2026
02517b6
Yes???
AVeryBoredPerson Jan 31, 2026
0816882
Merge branch 'main' of https://github.com/adam-godel/2026-Superquantum
AVeryBoredPerson Jan 31, 2026
55a7b5d
Change filename
adam-godel Jan 31, 2026
a9ad9f0
fixed parsed 2?
nicolajack Jan 31, 2026
2e64906
fixed optim
nicolajack Jan 31, 2026
78d82d7
fixed comments
nicolajack Jan 31, 2026
1287ce0
7
timmyjr11 Jan 31, 2026
7e0ec77
Merge branch 'main' of https://github.com/adam-godel/2026-Superquantum
timmyjr11 Jan 31, 2026
cbe7de2
improved optim
nicolajack Jan 31, 2026
a95b191
Added unitary 8
adam-godel Jan 31, 2026
f80d687
improved unitary4 efficiency
nicolajack Jan 31, 2026
87860ae
Merge branch 'iQuHACK:main' into main
adam-godel Jan 31, 2026
6f7ade8
improved unitary 6 efficiency
nicolajack Jan 31, 2026
d9558a7
updated opt
nicolajack Jan 31, 2026
f18af54
Unitary 9 in progress
adam-godel Jan 31, 2026
0efb048
Add unitary 9
adam-godel Jan 31, 2026
591bafd
slight tweaks to unitary2
nicolajack Jan 31, 2026
66cd4d2
qasm update
adam-godel Jan 31, 2026
75fb6cf
Yeas\
AVeryBoredPerson Feb 1, 2026
471f01f
random changes
nicolajack Feb 1, 2026
48a3568
Merge branch 'main' of https://github.com/adam-godel/2026-Superquantum
AVeryBoredPerson Feb 1, 2026
d4aa398
Merge branch 'main' of https://github.com/adam-godel/2026-Superquantum
AVeryBoredPerson Feb 1, 2026
49fa2e9
cooked
timmyjr11 Feb 1, 2026
6f547a3
improve 6
nicolajack Feb 1, 2026
ef16cc4
random change
nicolajack Feb 1, 2026
bafd124
Removed comments
AVeryBoredPerson Feb 1, 2026
fc5da2f
Merge branch 'main' of https://github.com/adam-godel/2026-Superquantum
AVeryBoredPerson Feb 1, 2026
9aa3a92
typo fix
adam-godel Feb 1, 2026
40d27be
Merge branch 'main' of https://github.com/adam-godel/2026-Superquantum
timmyjr11 Feb 1, 2026
01dc68f
little fixes to 6
nicolajack Feb 1, 2026
c6c9445
Merge branch 'main' of https://github.com/adam-godel/2026-Superquantum
timmyjr11 Feb 1, 2026
a6c8edb
Merge branch 'main' of https://github.com/adam-godel/2026-Superquantum
timmyjr11 Feb 1, 2026
486eb95
7 in progress
timmyjr11 Feb 1, 2026
54435f9
temp changes
nicolajack Feb 1, 2026
9ccf84d
Add back unitary 9
adam-godel Feb 1, 2026
35f9f56
more optim fixes for rn
nicolajack Feb 1, 2026
e3b0e4d
Need to dramatically optimize
timmyjr11 Feb 1, 2026
a5f18d6
stuff
nicolajack Feb 1, 2026
8bae6db
ok
nicolajack Feb 1, 2026
d234d25
Fix Ry bug and add unitary 10
adam-godel Feb 1, 2026
b5cbf12
clean up comments
nicolajack Feb 1, 2026
b544d7c
Restored parser changes
adam-godel Feb 1, 2026
b3e6955
made plots dir
nicolajack Feb 1, 2026
62246fd
unitary 10
nicolajack Feb 1, 2026
4386fa2
unitary 11
nicolajack Feb 1, 2026
918fa9a
updated plot
nicolajack Feb 1, 2026
b0d3b87
updated plot images
nicolajack Feb 1, 2026
a5ee02a
Added unitary 7
adam-godel Feb 1, 2026
6e1c8d8
changing stuff
nicolajack Feb 1, 2026
739bfe1
11 test works rn
nicolajack Feb 1, 2026
0749097
updated test.py
nicolajack Feb 1, 2026
409e26a
yea
AVeryBoredPerson Feb 1, 2026
6892322
updated
nicolajack Feb 1, 2026
9f80ed7
Add unitary 11
adam-godel Feb 1, 2026
21b331c
Commit
AVeryBoredPerson Feb 1, 2026
5ffea48
minor cleanup
adam-godel Feb 1, 2026
ca3399b
take away plot funcs
adam-godel Feb 1, 2026
e385dc1
Paper draft + change Rx to Ry in unitary 2
adam-godel Feb 1, 2026
f5c87e2
Add texpad to gitignore
adam-godel Feb 1, 2026
3f06dca
updated qasm parsing for unitary 2
nicolajack Feb 1, 2026
901989e
Updated with bibtex
adam-godel Feb 1, 2026
93641ba
updated citations
nicolajack Feb 1, 2026
38a2856
Add three and four
adam-godel Feb 1, 2026
c916b78
More accurate unitary 6
adam-godel Feb 1, 2026
2211ebd
L AD
AVeryBoredPerson Feb 1, 2026
893df15
Merge branch 'main' of https://github.com/adam-godel/2026-Superquantum
AVeryBoredPerson Feb 1, 2026
a462ddc
More paper progress
adam-godel Feb 1, 2026
ae70280
Remove todo
adam-godel Feb 1, 2026
d37da38
Adapted 7 and 10 for mutli-processing
timmyjr11 Feb 1, 2026
899b2c9
Merge branch 'main' of https://github.com/adam-godel/2026-Superquantum
timmyjr11 Feb 1, 2026
c101eac
Merge branch 'iQuHACK:main' into main
adam-godel Feb 1, 2026
53bd1a2
Update writeup
adam-godel Feb 1, 2026
e6c5099
Update writeup
adam-godel Feb 1, 2026
2321252
Fixed key-value pair for cite
timmyjr11 Feb 1, 2026
5e47be3
Merge branch 'main' of https://github.com/adam-godel/2026-Superquantum
timmyjr11 Feb 1, 2026
70d97c7
update plots
nicolajack Feb 1, 2026
d938bd6
Made plots for 10
timmyjr11 Feb 1, 2026
ec4f0ac
updated plot
nicolajack Feb 1, 2026
98bce39
Add unitary 12
adam-godel Feb 1, 2026
4af1bd4
cleaned up unitary 7
nicolajack Feb 1, 2026
6e07abc
New plots for use
timmyjr11 Feb 1, 2026
f1095ba
updates to simulations section
nicolajack Feb 1, 2026
2bd97c7
Preparing all plots at once
timmyjr11 Feb 1, 2026
8e62959
In case the world falls over here is an image
timmyjr11 Feb 1, 2026
966f4c0
Little better image
timmyjr11 Feb 1, 2026
970a644
cleaned unitary 12
nicolajack Feb 1, 2026
c1f7763
Merge branch 'main' of https://github.com/adam-godel/2026-Superquantum
timmyjr11 Feb 1, 2026
bd3c79a
updated simulation descriptions
nicolajack Feb 1, 2026
cbc3762
Add missing approach subsections
adam-godel Feb 1, 2026
42801c8
moved into plots
nicolajack Feb 1, 2026
7b6be88
Add graphics path
adam-godel Feb 1, 2026
795f8ff
FInished image 7
timmyjr11 Feb 1, 2026
34c6bfa
Merge branch 'main' of https://github.com/adam-godel/2026-Superquantum
timmyjr11 Feb 1, 2026
4d0ccbd
Formatting fixes
adam-godel Feb 1, 2026
5412d49
update this
nicolajack Feb 1, 2026
69dfd78
updated unitary 7 in tx
nicolajack Feb 1, 2026
808fd8d
add readme
nicolajack Feb 1, 2026
648f752
update tex
nicolajack Feb 1, 2026
4fc98f0
fix
nicolajack Feb 1, 2026
b468b3a
Shipping
AVeryBoredPerson Feb 1, 2026
c93fde9
Merge branch 'main' of https://github.com/adam-godel/2026-Superquantum
AVeryBoredPerson Feb 1, 2026
14e89f7
Yea?
AVeryBoredPerson Feb 1, 2026
c64302f
fix
nicolajack Feb 1, 2026
6add783
update reame w team name
nicolajack Feb 1, 2026
2308880
Finalize documentation
adam-godel Feb 1, 2026
075fbd7
Post Cleanup
timmyjr11 Feb 1, 2026
3ec83ba
Finalized documentation
adam-godel Feb 1, 2026
0295770
delete
nicolajack Feb 1, 2026
5c5ef31
Minor typo fix
adam-godel Feb 1, 2026
3532f8b
Minor addition
adam-godel Feb 1, 2026
32e5949
Finished checking
timmyjr11 Feb 1, 2026
0f80894
Merge branch 'main' of https://github.com/adam-godel/2026-Superquantum
timmyjr11 Feb 1, 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: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
__pycache__
venv
challenge.pdf
writeup/.texpadtmp
141 changes: 141 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
# iQuHack 2026: Superquantum Challenge

**Team Name:** 67 Qubits
**Team Members:** Adam Godel, Yebin Song, Nico Jackson, Travis Meyer, Timothy Wright
**Affiliation:** Boston University, Boston, MA

---

## Project Write-up & Presentation Slides

Our complete technical writeup is available in the `writeup/` directory:

- **PDF**: [`writeup/main.pdf`](writeup/main.pdf) - **Start here!** This is the compiled document with all our implementations, optimizations, and experimental results.

- **Slides**: Access our slides [here!](https://docs.google.com/presentation/d/1q9z32plF9qOmsmKggezTibO6qC0Dm3mvM3ZvNwCfbd8/edit?usp=sharing)

## Project Overview

This repository contains our implementations of **12 unitary operators** using the **Clifford + T gate set**, where the T gate is the most computationally expensive gate to execute. Our goal was to optimize quantum circuits by:

1. **Minimizing T-gate count** - Reducing the "quantumness" and computational cost
2. **Minimizing approximation error** - Achieving high fidelity to target unitaries
3. **Exploring the tradeoff** - Balancing these competing objectives

---

## Repository Structure

### `unitary/` - Circuit Implementations

Contains Python implementations for all 12 unitaries:

- **`unitary1.py` through `unitary12.py`**: Individual implementations for each target unitary
- **`optim.py`**: Main optimization framework for building and synthesizing circuits
- **`utils.py`**: Utility functions for rotation gates (Rz, Ry, Rx)
- **`test.py`**: Testing framework with expected unitary matrices and distance calculations
- **`plot.py`**: Plotting utilities for T-count vs. distance analysis
- **`plot7_mp.py`**: Plotting utilities for T-count vs. Fidelity in Unitary 7
- **`plot10.py`**: Plotting utilities for T-count vs. distance analysis in Unitary 10
- **`parser.py`**: Parsing utility for converting qasm to quantum gates

### `qasm/` - QASM Circuit Files

Contains OpenQASM 3.0 representations of all optimized circuits:

```
qasm/unitary1.qasm
qasm/unitary2.qasm
...
qasm/unitary12.qasm
```

These files can be loaded into Qiskit or other quantum computing frameworks.

### `plots/` - Visualization Results

Contains generated plots showing the T-count vs. distance tradeoffs:

- `unitary_2_distance_vs_tcount.png`
- `unitary_3_distance_vs_tcount.png`
- `unitary_4_distance_vs_tcount.png`
- `unitary_6_distance_vs_tcount.png`
- `unitary7_plot.png` (fidelity-based)
- `unitary10_distance_vs_tcount.png`

### `writeup/` - Technical Documentation

The complete LaTeX writeup.

---

## How to Use

### Prerequisites

```bash
pip install qiskit
pip install gridsynth
pip install rmsynth
pip install numpy matplotlib scipy
```

### Running Individual Unitaries

Each unitary can be executed independently:

```bash
cd unitary
python3 unitary2.py # Controlled-Ry(π/7) gate
python3 unitary7.py # State preparation
python3 unitary11.py # Four-qubit diagonal unitary
```

### Running Optimizations

To optimize a specific unitary with custom parameters:

```bash
cd unitary
python3 optim.py
```

Edit the file to select which unitary to optimize and adjust epsilon values.

### Generating Plots

To generate T-count vs. distance plots:

```bash
cd unitary
python3 plot.py
```

Modify the `constructions_to_analyze` list in the `if __name__ == "__main__"` block to select which unitaries to plot.

### Testing Implementations

To verify circuit correctness:

```bash
cd unitary
python3 test.py
```

This will load QASM files, compute circuit unitaries, and compare them against expected results.

---

## References

- **Gridsynth**: Ross, N. J., & Selinger, P. (2014). Optimal ancilla-free Clifford+T approximation of z-rotations.
- **Rmsynth**: Superquantum rmsynth package for phase polynomial optimization
- **Qiskit**: IBM's open-source quantum computing framework

## License

This project was created for the iQuHack 2026 hackathon. See individual package licenses for gridsynth, rmsynth, and Qiskit.

---

**For questions or issues, please open an issue on GitHub or contact the team.**
Binary file modified challenge.pdf
Binary file not shown.
Binary file added plots/unitary10_distance_vs_tcount.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added plots/unitary7_plot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added plots/unitary_11_distance_vs_tcount.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added plots/unitary_2_distance_vs_tcount.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added plots/unitary_3_distance_vs_tcount.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added plots/unitary_4_distance_vs_tcount.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added plots/unitary_5_distance_vs_tcount.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added plots/unitary_6_distance_vs_tcount.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added plots/unitary_8_distance_vs_tcount.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added plots/unitary_9_distance_vs_tcount.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
76 changes: 76 additions & 0 deletions qasm/parser.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import re
from pathlib import Path

GATE = re.compile(r'gate\s+(\w+)\s+([A-Za-z_]\w*(?:\s*,\s*[A-Za-z_]\w*)*)\s*\{(.*?)\}', re.S)
CALL = re.compile(r'^\s*(\w+)\s+([^;]+);\s*$')
QDECL = re.compile(r'^\s*qubit\[(\d+)\]\s+q\s*;\s*$', re.M)

def parse_ops(block):
return [ln.strip() for ln in block.splitlines() if ln.strip() and ln.strip().endswith(";")]

def expand_line(line, env, gates, out):
m = CALL.match(line)
if not m: return
name, args = m.group(1), [a.strip() for a in m.group(2).split(",")]

# map args through env (so gate-local names become q[i], etc.)
args = [env.get(a, a) for a in args]

# builtin op -> emit
if name not in gates:
out.append(f"{name} {', '.join(args)};")
return

# custom gate -> inline with new env
formal_args, body_ops = gates[name]
new_env = dict(env)
for fa, aa in zip(formal_args, args):
new_env[fa] = aa
for op in body_ops:
expand_line(op, new_env, gates, out)

def reformat(in_file):
p = Path(in_file)
s = p.read_text(encoding="utf-8")

# collect includes (keep them)
includes = "\n".join(re.findall(r'^\s*include\s+"[^"]+"\s*;\s*$', s, re.M))
if not includes:
includes = 'include "stdgates.inc";'

# parse gates
gates = {}
for name, argstr, body in GATE.findall(s):
gates[name] = ([a.strip() for a in argstr.split(",")], parse_ops(body))

# find main program start: after qubit[...] q;
qm = QDECL.search(s)
if not qm:
raise SystemExit("No 'qubit[n] q;' found.")
n = int(qm.group(1))
main = s[qm.end():]
main_ops = parse_ops(main)

# expand main ops
out_ops = []
for op in main_ops:
expand_line(op, {}, gates, out_ops)

# output name unitaryX.qasm next to input
m = re.search(r'unitary(\d+)\.qasm$', p.name)
X = m.group(1) if m else "0"
out_path = p.with_name(f"unitary{X}.qasm")

out_path.write_text(
"OPENQASM 3.0;\n"
f"{includes}\n"
f"qubit[{n}] q;\n"
+ "\n".join(out_ops)
+ "\n",
encoding="utf-8",
)
print(out_path)

if __name__ == "__main__":
import sys
reformat(sys.argv[1])
6 changes: 6 additions & 0 deletions qasm/unitary1.qasm
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
OPENQASM 3.0;
include "stdgates.inc";
qubit[2] q;
sdg q[0];
cx q[1], q[0];
s q[0];
Loading