Skip to content

Commit 00ae4c6

Browse files
committed
polish docs
1 parent 858dcfd commit 00ae4c6

19 files changed

+1842
-403
lines changed

.typos.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,10 @@ arange = "arange"
2525
nd = "nd"
2626
# delocate is a macOS wheel repair tool (delocate-wheel command)
2727
delocate = "delocate"
28+
# Gate name breakdown notation uses partial words like C(ontrolled), R(otation)
29+
ontrolled = "ontrolled"
30+
otation = "otation"
31+
repare = "repare"
32+
easure = "easure"
33+
egative = "egative"
34+
agger = "agger"

docs/development/DEVELOPMENT.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,4 +151,3 @@ PECOS_HOME = { value = "/custom/path", force = true }
151151
For specific development topics, see:
152152

153153
- [Parallel Blocks and Optimization](parallel-blocks-and-optimization.md) - Guide to using and extending the Parallel block construct and optimizer
154-
- [PECOS Home Directory Plan](PECOS_HOME_PLAN.md) - External dependency management architecture

docs/development/parallel-blocks-and-optimization.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Parallel Blocks and Optimization
22

3+
<!--skip: SLR examples require specific qubit API-->
4+
35
This guide explains the `Parallel` block construct in PECOS's SLR (Structured Language Representation) and the optimization transformations available for parallel quantum operations.
46

57
## Overview
@@ -12,7 +14,7 @@ When using `SlrConverter`, parallel optimization is enabled by default. This mea
1214

1315
### Creating Parallel Blocks
1416

15-
```python
17+
```python,skip
1618
from pecos.slr import Main, Parallel, QReg
1719
from pecos.qeclib import qubit as qb
1820
@@ -31,7 +33,7 @@ prog = Main(
3133

3234
Parallel blocks can contain other blocks for logical grouping:
3335

34-
```python
36+
```python,skip
3537
prog = Main(
3638
q := QReg("q", 6),
3739
Parallel(
@@ -60,7 +62,7 @@ The `ParallelOptimizer` transformation pass analyzes operations within `Parallel
6062
### Example Transformation
6163

6264
**Before optimization:**
63-
```python
65+
```python,skip
6466
Parallel(
6567
Block(H(q[0]), CX(q[0], q[1])),
6668
Block(H(q[2]), CX(q[2], q[3])),
@@ -69,7 +71,7 @@ Parallel(
6971
```
7072

7173
**After optimization:**
72-
```python
74+
```python,skip
7375
Block(
7476
Parallel(H(q[0]), H(q[2]), H(q[4])), # All H gates
7577
Parallel(CX(q[0], q[1]), CX(q[2], q[3]), CX(q[4], q[5])), # All CX gates
@@ -82,7 +84,7 @@ Block(
8284

8385
The simplest way to use the optimizer is through `SlrConverter`:
8486

85-
```python
87+
```python,skip
8688
from pecos.slr import SlrConverter
8789
8890
# With optimization (default)
@@ -96,7 +98,7 @@ qasm_unoptimized = SlrConverter(prog, optimize_parallel=False).qasm()
9698

9799
For more control, use the optimizer directly:
98100

99-
```python
101+
```python,skip
100102
from pecos.slr.transforms import ParallelOptimizer
101103
102104
optimizer = ParallelOptimizer()
@@ -135,7 +137,7 @@ The optimizer is conservative to ensure correctness:
135137

136138
Parallel blocks containing control flow (`If`, `Repeat`) are not optimized:
137139

138-
```python
140+
```python,skip
139141
Parallel(
140142
qb.H(q[0]),
141143
If(c[0] == 1).Then(qb.X(q[1])), # Control flow prevents optimization
@@ -147,7 +149,7 @@ Parallel(
147149

148150
Operations with qubit dependencies maintain their order:
149151

150-
```python
152+
```python,skip
151153
Parallel(
152154
qb.H(q[0]),
153155
qb.CX(q[0], q[1]), # Depends on H(q[0])
@@ -202,7 +204,7 @@ Comprehensive tests are available in:
202204

203205
Here's a more complex example showing parallel phase gates:
204206

205-
```python
207+
```python,skip
206208
from pecos.slr import Main, Parallel, QReg
207209
from pecos.qeclib import qubit as qb
208210

docs/user-guide/circuit-representation.md

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Circuit Representation
22

3+
<!--skip: Circuit examples require Guppy and specific circuit APIs-->
4+
35
PECOS provides several ways to represent and work with quantum circuits, from high-level program formats to low-level data structures.
46

57
## Quick Guide: What Should I Use?
@@ -29,7 +31,7 @@ When using PECOS's `sim()` API, you wrap your program in one of these types:
2931
### Example: Different Program Types
3032

3133
=== ":fontawesome-brands-python: Python"
32-
```python
34+
```python,skip
3335
from pecos import sim, Guppy, Qasm, Hugr
3436

3537
# Guppy - recommended for new code
@@ -110,7 +112,7 @@ A directed acyclic graph representation where nodes are gates and edges are qubi
110112
### Quick Start
111113

112114
=== ":fontawesome-brands-python: Python"
113-
```python
115+
```python,skip
114116
from pecos.quantum import DagCircuit
115117

116118
# Fluent builder API
@@ -142,7 +144,7 @@ A directed acyclic graph representation where nodes are gates and edges are qubi
142144
The fluent API automatically wires gates on the same qubit:
143145

144146
=== ":fontawesome-brands-python: Python"
145-
```python
147+
```python,skip
146148
from pecos.quantum import DagCircuit
147149

148150
circuit = DagCircuit()
@@ -214,7 +216,7 @@ The fluent API automatically wires gates on the same qubit:
214216
Gates can have arbitrary metadata attached:
215217

216218
=== ":fontawesome-brands-python: Python"
217-
```python
219+
```python,skip
218220
from pecos.quantum import DagCircuit, Attribute
219221

220222
circuit = DagCircuit()
@@ -248,7 +250,7 @@ Gates can have arbitrary metadata attached:
248250
### Circuit Analysis
249251

250252
=== ":fontawesome-brands-python: Python"
251-
```python
253+
```python,skip
252254
circuit = DagCircuit()
253255
circuit.h(0).cx(0, 1).h(1).cx(1, 2).mz(0).mz(1).mz(2)
254256

@@ -305,7 +307,7 @@ Gates can have arbitrary metadata attached:
305307
For advanced use cases, you can manually add gates and wire them:
306308

307309
=== ":fontawesome-brands-python: Python"
308-
```python
310+
```python,skip
309311
from pecos.quantum import DagCircuit, Gate, QubitId
310312

311313
circuit = DagCircuit()
@@ -348,7 +350,7 @@ A time-sliced circuit representation where gates are organized into discrete tim
348350
### Quick Start
349351

350352
=== ":fontawesome-brands-python: Python"
351-
```python
353+
```python,skip
352354
from pecos.quantum import TickCircuit
353355

354356
circuit = TickCircuit()
@@ -390,7 +392,7 @@ A time-sliced circuit representation where gates are organized into discrete tim
390392
TickCircuit prevents scheduling conflicting gates in the same tick:
391393

392394
=== ":fontawesome-brands-python: Python"
393-
```python
395+
```python,skip
394396
from pecos.quantum import TickCircuit
395397

396398
circuit = TickCircuit()
@@ -420,7 +422,7 @@ TickCircuit prevents scheduling conflicting gates in the same tick:
420422
### Tick Metadata
421423

422424
=== ":fontawesome-brands-python: Python"
423-
```python
425+
```python,skip
424426
circuit = TickCircuit()
425427

426428
# Add metadata to a tick
@@ -450,7 +452,7 @@ TickCircuit prevents scheduling conflicting gates in the same tick:
450452
TickCircuit can be converted to and from DagCircuit:
451453

452454
=== ":fontawesome-brands-python: Python"
453-
```python
455+
```python,skip
454456
from pecos.quantum import DagCircuit, TickCircuit
455457

456458
# TickCircuit -> DagCircuit
@@ -488,7 +490,7 @@ For general graph algorithms beyond quantum circuits, PECOS provides `DiGraph` (
488490
A general directed graph with weighted edges and attributes:
489491

490492
=== ":fontawesome-brands-python: Python"
491-
```python
493+
```python,skip
492494
from pecos.graph import DiGraph
493495

494496
graph = DiGraph()
@@ -538,7 +540,7 @@ A general directed graph with weighted edges and attributes:
538540
A directed acyclic graph with topological ordering and cycle prevention:
539541

540542
=== ":fontawesome-brands-python: Python"
541-
```python
543+
```python,skip
542544
from pecos.graph import DAG
543545

544546
dag = DAG()

docs/user-guide/cuda-setup.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# CUDA Setup Guide for GPU Simulators
22

3+
<!--skip: CUDA examples require cupy and NVIDIA GPU-->
4+
35
This guide provides detailed instructions for setting up NVIDIA CUDA support to use GPU-accelerated quantum simulators in PECOS, specifically **CuStateVec** and **MPS** (Matrix Product State).
46

57
## Overview
@@ -143,7 +145,7 @@ uv pip install -e "./python/quantum-pecos[all,cuda]"
143145

144146
### Test CUDA Installation
145147

146-
```python
148+
```python,skip
147149
# Test CuPy
148150
import cupy as cp
149151
@@ -158,7 +160,7 @@ print(f"cuStateVec available: {custatevec is not None}")
158160

159161
### Test PECOS Simulators
160162

161-
```python
163+
```python,skip
162164
from pecos.simulators import CuStateVec, MPS
163165
164166
# Test CuStateVec
@@ -243,7 +245,7 @@ uv pip install cupy-cuda12x cuquantum-python-cu12
243245

244246
**Solution**: GPU memory is limited. Use smaller circuits or the MPS simulator for larger systems.
245247

246-
```python
248+
```python,skip
247249
# MPS can handle larger systems with less memory
248250
from pecos.simulators import MPS
249251
@@ -348,7 +350,7 @@ To use GPU simulators in PECOS:
348350
just build-cuda
349351
```
350352
5. **Verify GPU simulators**:
351-
```python
353+
```python,skip
352354
from pecos.simulators import CuStateVec, MPS
353355
354356
sim = CuStateVec(2) # Should work!

0 commit comments

Comments
 (0)