Skip to content

Commit b8d0505

Browse files
david-plrafaelhajohnzl-777
authored
Update documentation to match the upcoming SQUIN refactor (#291)
FYI, @jon-wurtz I updated the tutorial you wrote in order to match the new semantics. Something to keep in mind while working on coming tutorials. Also, we need to support lowering of `cirq.ZZPowGate` or, equivalently, `cirq.CZPowGate` for arbitrary exponents again, which is something I still need to address. Still need to rewrite the actual documentation pages. --------- Co-authored-by: Rafael Haenel <[email protected]> Co-authored-by: John Long <[email protected]>
1 parent 94941f1 commit b8d0505

File tree

22 files changed

+229
-221
lines changed

22 files changed

+229
-221
lines changed

docs/background.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Neutral Atom Qubits
44

5-
A key feature of a quantum computer is the ability to physically represent qubits. In neutral atom computers, the qubit is represented in the electronic state of the valence electron of Rubdidium 87. Arrays of individual atoms are held by laser tweezers, and quantum computations are executed by manipulating the electronic state of each atom using lasers and RF fields. Entanglement can be generated using the [Rydberg state](https://en.wikipedia.org/wiki/Rydberg_atom), which is a highly excited state that strongly interacts with adjacent atoms through a $R^{-6}$ power law Van der Waals force.
5+
A key feature of a quantum computer is the ability to physically represent qubits. In neutral atom computers, the qubit is represented in the electronic state of the valence electron of Rubidium 87. Arrays of individual atoms are held by laser tweezers, and quantum computations are executed by manipulating the electronic state of each atom using lasers and RF fields. Entanglement can be generated using the [Rydberg state](https://en.wikipedia.org/wiki/Rydberg_atom), which is a highly excited state that strongly interacts with adjacent atoms through a $R^{-6}$ power law Van der Waals force.
66

77

88

@@ -14,7 +14,7 @@ $$
1414
i \hbar \dfrac{\partial}{\partial t} | \psi \rangle = \hat{\mathcal{H}}(t) | \psi \rangle, \\
1515
$$
1616

17-
Were $H$ is a time-dependent "Rydberg atom" Hamiltonian.
17+
where $H$ is a time-dependent "Rydberg atom" Hamiltonian.
1818

1919
$$
2020
\frac{\mathcal{H}(t)}{\hbar} = \sum_j \frac{\Omega_j(t)}{2} \left( e^{i \phi_j(t) } | g_j \rangle \langle r_j | + e^{-i \phi_j(t) } | r_j \rangle \langle g_j | \right) - \sum_j \Delta_j(t) \hat{n}_j + \sum_{j < k} V_{jk} \hat{n}_j \hat{n}_k,

docs/blog/posts/2023/bloqade-release.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ adiabatic_program = (
7878
],
7979
)
8080
.assign(max_rabi=15.8, max_detuning=16.33)
81-
.batch_assign(lattice_spacing=np.arrange(4.0, 7.0, 0.5))
81+
.batch_assign(lattice_spacing=np.arange(4.0, 7.0, 0.5))
8282
)
8383

8484
# Launch your program on your choice of Braket or in-house emulator...
@@ -121,7 +121,7 @@ During the next year, we plan on continuing development of Bloqade's python inte
121121

122122
That's right! However, there's a key motivating factor for the reason we created Bloqade Python that's distinct for Bloqade.jl's existence.
123123

124-
Bloqade.jl is primarily geared as a *high-performance emulator*. It allows you to design complex neutral-atom algorithms that may not necessarily run on our hardware BUT are excellent if you're exploring novel physical phenonema/algorithms or as a tool for pedagogical purposes.
124+
Bloqade.jl is primarily geared as a *high-performance emulator*. It allows you to design complex neutral-atom algorithms that may not necessarily run on our hardware BUT are excellent if you're exploring novel physical phenomena/algorithms or as a tool for pedagogical purposes.
125125

126126
Bloqade.jl does have the ability to submit to [*Aquila*](https://www.quera.com/aquila), our flagship quantum computer, but for more complex tasks such as sweeping parameters (e.g. running the same program on hardware with slightly different parameters each time) or advanced post-processing, it becomes cumbersome quite quickly.
127127

docs/blog/posts/2025/a-new-journey.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,4 @@ The first step in Bloqade's journey was building out the analog mode SDK, design
3838

3939
## Learn more
4040

41-
Bloqade is an open-source project and can be freely downloaded and modified; you can learn how to do so [here](../../../install.md). If you want to see how to write programs with of the new `bloqade` package, check out our examples [here](../../../digital/index.md). If you would like to learn more about QuEra Computing Inc., check out our [webpage](https://quera.com) as well as discover our many [academic publications and demonstrations](https://www.quera.com/news#publications).
41+
Bloqade is an open-source project and can be freely downloaded and modified; you can learn how to do so [here](../../../install.md). If you want to see how to write programs with the new `bloqade` package, check out our examples [here](../../../digital/index.md). If you would like to learn more about QuEra Computing Inc., check out our [webpage](https://quera.com) as well as discover our many [academic publications and demonstrations](https://www.quera.com/news#publications).

docs/contrib.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ or for a specific test file with the `-s` flag to show the output of the program
2727
pytest -s tests/test_program.py
2828
```
2929

30-
lots of tests contains pretty printing of the IR themselves, so it's useful to see the output.
30+
lots of tests contain pretty printing of the IR themselves, so it's useful to see the output.
3131

3232
## Code style
3333

@@ -37,7 +37,7 @@ good-to-have practices:
3737
### Naming
3838

3939
- try not to use abbreviation as names, unless it's a common abbreviation like `idx` for `index`
40-
- try not create a lot of duplicated name prefix unless the extra information is necessary when accessing the class object.
40+
- try not to create a lot of duplicated name prefix unless the extra information is necessary when accessing the class object.
4141
- try to use `snake_case` for naming variables and functions, and `CamelCase` for classes.
4242

4343
### Comments
@@ -47,7 +47,7 @@ good-to-have practices:
4747

4848
## Documentation
4949

50-
We use `just` for mangaging command line tools and scripts. It should be installed when you run `uv sync`. To build the documentation, simply run:
50+
We use `just` for managing command line tools and scripts. It should be installed when you run `uv sync`. To build the documentation, simply run:
5151

5252
```bash
5353
just doc

docs/digital/cirq_interop/cirq_to_squin.md

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Converting cirq to squin
22

3-
If you want to obtain a squin kernel from a circuit, you can use the `load_circuit` method in the `squin.cirq` submodule.
3+
If you want to obtain a squin kernel from a circuit, you can use the `load_circuit` method in the `cirq_utils` submodule.
44
What you're effectively doing is lowering a circuit to a squin IR.
55
This IR can then be further lowered to eventually run on hardware.
66

@@ -9,7 +9,7 @@ This IR can then be further lowered to eventually run on hardware.
99
Here are some basic usage examples to help you get started.
1010

1111
```python
12-
from bloqade import squin
12+
from bloqade import squin, cirq_utils
1313
import cirq
1414

1515
qubits = cirq.LineQubit.range(2)
@@ -22,19 +22,17 @@ circuit = cirq.Circuit(
2222
# let's have a look
2323
print(circuit)
2424

25-
main_loaded = squin.cirq.load_circuit(circuit, kernel_name="main_loaded")
25+
main_loaded = cirq_utils.load_circuit(circuit, kernel_name="main_loaded")
2626
```
2727

2828
The above is equivalent to writing the following kernel function yourself:
2929

3030
```python
3131
@squin.kernel
3232
def main():
33-
q = squin.qubit.new(2)
34-
H = squin.op.h()
35-
CX = squin.op.cx()
36-
squin.qubit.apply(H, q[0])
37-
squin.qubit.apply(CX, q)
33+
q = squin.qalloc(2)
34+
squin.h(q[0])
35+
squin.cx(q[0], q[1])
3836
squin.qubit.measure(q)
3937
```
4038

@@ -55,7 +53,7 @@ Lowering a noisy circuit to squin is also supported.
5553
All common channels in cirq will be lowered to an equivalent noise statement in squin.
5654

5755
```python
58-
from bloqade import squin
56+
from bloqade import cirq_utils
5957
import cirq
6058

6159
qubits = cirq.LineQubit.range(2)
@@ -68,7 +66,7 @@ noisy_circuit = cirq.Circuit(
6866
# let's have a look
6967
print(noisy_circuit)
7068

71-
noisy_kernel = squin.cirq.load_circuit(noisy_circuit)
69+
noisy_kernel = cirq_utils.load_circuit(noisy_circuit)
7270
noisy_kernel.print()
7371
```
7472

@@ -87,7 +85,7 @@ This means you can use a loaded circuit as part of another kernel function.
8785
Check it out:
8886

8987
```python
90-
from bloqade import squin
88+
from bloqade import squin, cirq_utils
9189
import cirq
9290

9391
qubits = cirq.LineQubit.range(2)
@@ -96,12 +94,12 @@ circuit = cirq.Circuit(
9694
cirq.CX(qubits[0], qubits[1]),
9795
)
9896

99-
sub_kernel = squin.cirq.load_circuit(circuit, register_as_argument=True, kernel_name="sub_kernel")
97+
sub_kernel = cirq_utils.load_circuit(circuit, register_as_argument=True, kernel_name="sub_kernel")
10098

10199

102100
@squin.kernel
103101
def main():
104-
q = squin.qubit.new(4)
102+
q = squin.qalloc(4)
105103

106104
# entangle qubits 1 and 2
107105
sub_kernel([q[0], q[1]])
@@ -122,7 +120,7 @@ Let's adapt the above to instantiate and return a pair of entangled qubits using
122120

123121
```python
124122

125-
sub_kernel = squin.cirq.load_circuit(circuit, return_register=True, kernel_name="sub_kernel")
123+
sub_kernel = cirq_utils.load_circuit(circuit, return_register=True, kernel_name="sub_kernel")
126124

127125
@squin.kernel
128126
def main():

docs/digital/cirq_interop/index.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ For details on each of these, please see the documentation pages below:
1010
* [Obtaining a squin kernel function from a `cirq.Circuit`](./cirq_to_squin.md)
1111
* [Emitting a `cirq.Circuit` from a squin kernel](./squin_to_cirq.md)
1212

13-
For the API reference, please see the `cirq` submodule in the [squin API docs](../../reference/bloqade-circuit/src/bloqade/squin.md).
13+
For the API reference, please see the `cirq_utils` submodule in the API reference, specifically [here](../../reference/bloqade-circuit/src/bloqade/cirq_utils/lowering.md) and [here](../../reference/bloqade-circuit/src/bloqade/cirq_utils/emit/base.md).
1414

1515
## TL;DR
1616

1717
Here's a short example:
1818

1919
```python
20-
from bloqade import squin
20+
from bloqade import cirq_utils
2121
import cirq
2222

2323
q = cirq.LineQubit.range(2)
@@ -27,9 +27,9 @@ circuit = cirq.Circuit(
2727
)
2828
print(circuit)
2929

30-
main = squin.cirq.load_circuit(circuit)
30+
main = cirq_utils.load_circuit(circuit)
3131
main.print()
3232

33-
roundtrip_circuit = squin.cirq.emit_circuit(main)
33+
roundtrip_circuit = cirq_utils.emit_circuit(main)
3434
print(roundtrip_circuit)
3535
```

docs/digital/cirq_interop/squin_to_cirq.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,21 @@ The output circuit will feature gates that most closely resemble the kernel you
55

66
## Basic usage
77

8-
You can obtain a circuit using the `squin.cirq.emit_circuit` function.
8+
You can obtain a circuit using the `cirq_utils.emit_circuit` function.
99

1010
```python
11-
from bloqade import squin
11+
from bloqade import squin, cirq_utils
1212

1313
@squin.kernel
1414
def main():
15-
q = squin.qubit.new(2)
15+
q = squin.qalloc(2)
1616
h = squin.op.h()
1717
squin.qubit.apply(h, q[0])
1818
cx = squin.op.cx()
1919
squin.qubit.apply(cx, q[0], q[1])
2020
squin.qubit.measure(q)
2121

22-
circuit = squin.cirq.emit_circuit(main)
22+
circuit = cirq_utils.emit_circuit(main)
2323
print(circuit)
2424
```
2525

@@ -40,11 +40,11 @@ To allow modifications here, you can simply pass in a list of qubits (a sequence
4040
import cirq
4141

4242
qubits = cirq.GridQubit.rect(rows=1, cols=2)
43-
circuit = squin.cirq.emit_circuit(main, qubits=qubits)
43+
circuit = cirq_utils.emit_circuit(main, qubits=qubits)
4444
print(circuit)
4545
```
4646

47-
Note, that the qubits will be used in the resulting circuit in the order they appear in `squin.qubit.new` statements.
47+
Note, that the qubits will be used in the resulting circuit in the order they appear in `squin.qalloc` statements.
4848

4949
!!! warning
5050

docs/digital/dialects_and_kernels/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,15 @@ Have a look at the (growing) [examples collection](../examples/), where you can
5252

5353
## [squin](./squin.md)
5454

55-
With this dialect, you can structure your program in terms of operators rather than gate applications, or define circuits.
55+
This is the central dialect of bloqade-circuit, with which you can write your quantum programs.
56+
Rather than just defining circuits in terms of gates and qubits, this dialect also makes it possible to use control flow.
5657
Have a look at [the dedicated documentation page](./squin.md) and the corresponding [API reference](../../reference/bloqade-circuit/src/bloqade/squin/).
5758

5859
**Use cases**:
5960

6061
* Writing a program that represents a circuit.
6162
* If you require control flow (loops and if-statements, ...) and composability (function definitions, recursion, ...).
6263
* Simulation including noise.
63-
* Hamiltonian simulation (work in progress).
6464

6565

6666
## [qasm2](./qasm2.md)
-21.4 KB
Loading
-38.2 KB
Loading

0 commit comments

Comments
 (0)