You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/architecture.md
+20-3Lines changed: 20 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,7 +24,13 @@ The compiler resolves logical gate names to explicit unitary matrices using `rqm
24
24
25
25
Neither backend reimplements math or compilation logic. They each implement the same interface contract, which is why the same program runs on either backend without modification.
26
26
27
-
### 4. Documentation lives in `rqm-docs`
27
+
### 4. Optimization lives in `rqm-optimize`
28
+
29
+
`rqm-optimize` is the optimization layer. It accepts circuits already translated to a backend format and applies SU(2)-aware passes — gate fusion, redundancy elimination, and depth reduction — using exact quaternion arithmetic from `rqm-core`.
30
+
31
+
Optimization is a post-compilation, pre-execution step. It is optional for simulation but recommended for hardware runs where gate count directly affects decoherence.
32
+
33
+
### 5. Documentation lives in `rqm-docs`
28
34
29
35
`rqm-docs` (this site) organizes and explains the platform. It does not introduce new algorithms, theory, or notebook content. Its job is to make everything else discoverable, understandable, and usable.
30
36
@@ -46,6 +52,12 @@ rqm-compiler
46
52
rqm-qiskit rqm-braket
47
53
(Qiskit circuit) (Braket circuit)
48
54
│ │
55
+
└────────┬─────────┘
56
+
▼
57
+
rqm-optimize
58
+
(SU(2) fusion, compression)
59
+
│
60
+
┌────────┴─────────┐
49
61
▼ ▼
50
62
simulator/hardware simulator/hardware
51
63
│ │
@@ -60,15 +72,17 @@ The program is defined once. The compiler processes it once. Execution backends
60
72
## Dependency Graph
61
73
62
74
```
63
-
rqm-braket ──► rqm-compiler ──► rqm-core
64
-
rqm-qiskit ──► rqm-compiler ──► rqm-core
75
+
rqm-braket ──► rqm-compiler ──► rqm-core
76
+
rqm-qiskit ──► rqm-compiler ──► rqm-core
77
+
rqm-optimize ──► rqm-core
65
78
rqm-notebooks ──► rqm-qiskit, rqm-braket
66
79
```
67
80
68
81
-`rqm-core` has no ecosystem dependencies.
69
82
-`rqm-compiler` depends on `rqm-core`.
70
83
-`rqm-qiskit` depends on `rqm-compiler` (and transitively `rqm-core`).
71
84
-`rqm-braket` depends on `rqm-compiler` (and transitively `rqm-core`).
85
+
-`rqm-optimize` depends on `rqm-core` for SU(2) and quaternion primitives. It is applied at runtime to circuits already translated to a backend format — it is not a package-level dependency of `rqm-qiskit` or `rqm-braket`.
72
86
-`rqm-notebooks` depends on the execution backends.
73
87
-`rqm-docs` references all packages but has no runtime dependency on any of them.
Copy file name to clipboardExpand all lines: docs/ecosystem.md
+31-12Lines changed: 31 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -38,6 +38,16 @@ RQM is a compiler-first quantum software platform built from focused, composable
38
38
-**Exposes `BraketBackend`** with `run_local()` and `run_device()` methods
39
39
-**Returns normalized results** compatible with the RQM result contract
40
40
41
+
### `rqm-optimize` — Optimization Layer
42
+
43
+
`rqm-optimize` applies SU(2)-aware circuit optimization and compression to compiled circuits before they are submitted to a backend. It uses quaternion composition from `rqm-core` to fuse, simplify, and reduce gate sequences with geometric correctness.
44
+
45
+
-**Depends on `rqm-core`** for SU(2) and quaternion primitives
46
+
-**Backend-compatible** — accepts circuits already translated to a backend format (Qiskit or Braket)
47
+
-**Drop-in step** — insert `optimize(qc)` between translation and execution without restructuring the pipeline
48
+
49
+
See the [Optimization guide](optimization.md) for details and usage examples.
50
+
41
51
### `rqm-notebooks` — Demos and Learning
42
52
43
53
`rqm-notebooks` is a curated collection of Jupyter notebooks that guide users from first principles through practical quantum circuit execution.
@@ -51,10 +61,11 @@ RQM is a compiler-first quantum software platform built from focused, composable
51
61
## Architecture Diagram
52
62
53
63
```
54
-
rqm-core → canonical math (quaternions, spinors, SU(2))
55
-
rqm-compiler → instruction generation and normalization
56
-
rqm-qiskit → Qiskit execution backend
57
-
rqm-braket → AWS Braket execution backend
64
+
rqm-core → canonical math (quaternions, spinors, SU(2))
65
+
rqm-compiler → instruction generation and normalization
66
+
rqm-qiskit → execution bridge (Qiskit)
67
+
rqm-braket → execution bridge (AWS Braket)
68
+
rqm-optimize → optimization layer (SU(2)-aware gate fusion and compression)
| Optimization |[`rqm-optimize`](https://github.com/RQM-Technologies-dev/rqm-optimize)| SU(2)-aware circuit optimization and compression layer |
25
26
26
27
The math layer has no backend dependency. The compiler layer transforms programs into a normalized instruction set. Execution backends consume that normalized form — they do not reimplement math or compiler logic.
27
28
@@ -45,11 +46,17 @@ RQM is a compiler-first quantum software platform. It separates three concerns t
45
46
-**Mathematical representation** — handled by `rqm-core`, which defines canonical quaternion, spinor, and SU(2) structures with no backend dependency.
46
47
-**Compilation** — handled by `rqm-compiler`, which transforms those structures into a normalized instruction set that any backend can consume.
47
48
-**Execution** — handled by `rqm-qiskit` and `rqm-braket`, which map the compiled instructions onto their respective runtimes.
49
+
-**Optimization** — handled by `rqm-optimize`, which applies SU(2)-aware gate fusion and circuit compression before execution.
48
50
49
51
This separation means the same program can run on Qiskit or Amazon Braket without modification. Swapping backends is a one-line change.
50
52
51
53
---
52
54
55
+
!!! tip "New: rqm-optimize"
56
+
**rqm-optimize** is now part of the RQM ecosystem — an SU(2)-aware circuit optimization and compression layer. Insert `optimize(qc)` between translation and execution to reduce gate count before hardware runs. See the [Optimization guide](optimization.md).
57
+
58
+
---
59
+
53
60
!!! tip "New to the platform?"
54
61
Start with [Quickstart](quickstart.md) for a working example, then read [Concepts](concepts.md) to understand the architecture.
`rqm-optimize` is the optimization layer of the RQM platform. It sits above the execution backends and applies SU(2)-aware circuit transformations to reduce gate count, circuit depth, and backend resource usage — before the circuit is submitted to a simulator or hardware device.
4
+
5
+
---
6
+
7
+
## What It Does
8
+
9
+
`rqm-optimize` accepts a compiled quantum circuit (produced by `rqm-compiler` and translated to a backend format by `rqm-qiskit` or `rqm-braket`) and applies a sequence of geometry-aware optimization passes:
10
+
11
+
-**SU(2) gate fusion** — merges consecutive single-qubit rotations into a single SU(2) operation using exact quaternion composition
12
+
-**Redundancy elimination** — detects and removes gate pairs that compose to the identity
13
+
-**Depth reduction** — reorders commuting operations to minimize circuit depth without changing the program semantics
14
+
-**Compression** — collapses equivalent gate sequences into canonical forms defined by `rqm-core`
15
+
16
+
All passes are geometry-aware: they use the quaternion and SU(2) primitives from `rqm-core` to reason about gate equivalence exactly, not approximately.
17
+
18
+
---
19
+
20
+
## When to Use It
21
+
22
+
Use `rqm-optimize` when:
23
+
24
+
- You want to reduce the number of gates before submitting to hardware (fewer gates → less decoherence)
25
+
- You are running on a backend with a limited native gate set and want to minimize transpilation overhead
26
+
- You have long circuits with repeated rotation patterns that can be fused
27
+
- You want reproducible, geometry-correct optimization rather than heuristic transpilation
28
+
29
+
`rqm-optimize` is optional. If you are running on a simulator and circuit depth is not a concern, you can skip it. For hardware runs, it is recommended.
30
+
31
+
---
32
+
33
+
## Example
34
+
35
+
```python
36
+
from rqm_compiler import compile_circuit
37
+
from rqm_qiskit import compiled_circuit_to_qiskit
38
+
from rqm_optimize import optimize
39
+
40
+
# Step 1: compile the program to a backend-agnostic IR
41
+
qc = compile_circuit(program)
42
+
43
+
# Step 2: translate to a Qiskit circuit
44
+
qc = compiled_circuit_to_qiskit(qc)
45
+
46
+
# Step 3: apply SU(2)-aware optimization
47
+
qc = optimize(qc)
48
+
49
+
# Step 4: run on a backend as usual
50
+
result = backend.run(qc)
51
+
```
52
+
53
+
The `optimize()` call is a drop-in step. It accepts and returns the same circuit type, so it can be inserted into any existing workflow without restructuring the pipeline.
54
+
55
+
---
56
+
57
+
## Position in the Stack
58
+
59
+
`rqm-optimize` operates after compilation and translation, and before execution:
60
+
61
+
```
62
+
rqm-core → canonical math (quaternions, spinors, SU(2))
63
+
rqm-compiler → circuit construction and IR lowering
64
+
rqm-qiskit → execution bridge (Qiskit)
65
+
rqm-braket → execution bridge (AWS Braket)
66
+
rqm-optimize → optimization layer (SU(2)-aware gate fusion and compression)
67
+
```
68
+
69
+
It depends on `rqm-core` for geometry primitives and operates on circuits already in a backend format. It does not re-enter the compiler pipeline.
70
+
71
+
---
72
+
73
+
!!! tip "Optimization is geometry-correct"
74
+
Unlike heuristic transpilers, `rqm-optimize` uses exact SU(2) arithmetic from `rqm-core` to determine gate equivalences. Two gates are fused only when their quaternion product is provably correct — never based on floating-point approximation alone.
0 commit comments