Skip to content

Commit

Permalink
chore: improve language.
Browse files Browse the repository at this point in the history
  • Loading branch information
Panadestein committed Nov 22, 2024
1 parent 585c4b7 commit 694ff3c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
8 changes: 4 additions & 4 deletions bqn-utils/plots.bqn
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,19 @@ SetPlot ← {𝕤⋄ opts_type ↩ 𝕩 }

paAt "class=code|style=fill:none;stroke:black|stroke-width=2"
pgAt "class=code|style=fill:none;stroke:#267CB9|stroke-width=3"
pcAt "class=code|r=4"
pcAt "class=code|style=fill:#267CB9|r=1"
rcAt "class=code|style=fill:none;stroke:black|stroke-width=1|rx=5"
gr"g" At "font-family=BQN,monospace|font-size=18px"
Path"path" Elt ⊣∾"d"⋈⊢

Pair ← {
"Plot: 𝕨 and 𝕩 must consist of rows of numbers" ! 𝕨 ((1≤=)0,´@>⟩) 𝕩
"Plot: 𝕨 and 𝕩 must have the same length" ! 𝕨 1((¯1⊑≢)) 𝕩
"Plot: 𝕨 and 𝕩 must consist of rows of numbers" ! 𝕨 ((1≤=)0,´@>⟩) 𝕩
"Plot: 𝕨 and 𝕩 must have the same length" ! 𝕨 1((¯1⊑≢)) 𝕩
𝕨 (< (¯1⊑≢) )1 𝕩
}
PairRec ← {
d𝕨𝕩
𝕨 (2≤⌊´d)Pair⊣"Plot: invalid depth mixing"!·´1=d˙, ⥊𝕊¨𝕩
𝕨 (2≤⌊´d)Pair⊣"Plot: invalid depth mixing"!·´1=d˙, ⥊𝕊¨𝕩
}
Plot ← {
xy1e300 (⊣-⌈⌊) ⍉> 𝕨 PairRec 𝕩 # organize and clip
Expand Down
22 changes: 13 additions & 9 deletions src/qbqn.org
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

** Preamble

We will implement and test a compact quantum interpreter in the BQN[fn:1] programming language.
We will implement and test a Schrödinger-style[fn:1] quantum simulator in the BQN[fn:2] programming language.
Initially, we import the necessary system functions and define a 1-modifier for handling
complex matrix products. Next, we define a namespace containing various quantum gates:
complex-valued matrix products. Next, we define a namespace containing various quantum gates:

#+name: preamble
#+begin_src bqn :exports code :results none :tangle ./bqn/q.bqn
Expand All @@ -25,7 +25,7 @@ complex matrix products. Next, we define a namespace containing various quantum

** Interpreter

The (call_count-chars() chars[fn:2]) quantum interpreter is based on references [[https://arxiv.org/abs/1711.02086][arXiv:1711.02086]]
The (call_count-chars() chars[fn:3]) quantum interpreter is based on references [[https://arxiv.org/abs/1711.02086][arXiv:1711.02086]]
and [[https://arxiv.org/abs/1608.03355][arXiv:1608.03355]]. For simplicity, we always measure at the end of the execution:

#+name: interpreter
Expand Down Expand Up @@ -67,7 +67,7 @@ Additionally, we define a classical post-processing function:
C ← {n (⊣≡×´∘GCD) +‿-{𝕩𝕎1}¨ <a⋆(≠÷2×⊑∘⍒) 0⌾⊑+˝∘‿(2⋆qb-2)⥊𝕩}
#+end_src

Wir müssen wissen, wir werden wissen![fn:3]
Wir müssen wissen, wir werden wissen![fn:4]

#+name: run
#+begin_src bqn :exports both :tangle ./bqn/q.bqn
Expand Down Expand Up @@ -180,8 +180,9 @@ Got 25361 samples
</details>
#+end_export

Try running the simulation in the call_generate-bqn-link() and explore it! This post is also available as an =org-mode= computational
notebook in a GitHub [[https://github.com/Panadestein/blog][repository]].
Try running the simulation in the call_generate-bqn-link() and explore it!
If you are an Emacs user, the =org-mode= computational notebook in
the blog's [[https://github.com/Panadestein/blog][repository]] provides the best experience.

#+name: generate-bqn-link
#+begin_src emacs-lisp :noweb yes :noweb-prefix no :exports none :results raw :tangle no
Expand All @@ -195,9 +196,12 @@ notebook in a GitHub [[https://github.com/Panadestein/blog][repository]].
(- (length "<<interpreter>>") 4)
#+end_src

[fn:1] This post's title is a playful recursive acronym that employs quantum computing terminology, without any specific significance beyond that.
[fn:2] I optimized it up to this number, but I wasn't targeting the Kolmogorov complexity.
[fn:3] Hilbert's [[https://maa.org/press/periodicals/convergence/david-hilberts-radio-address-english-translation][radio address]] in 1930.
[fn:1] Although conceptually straightforward, a Hilbert space of size =2⋆n= makes this type of simulation a true computational challenge.
For an efficient implementation, see [[https://arxiv.org/abs/1910.09534][arXiv:1910.09534]].
[fn:2] This post's title is a playful recursive acronym that employs quantum computing terminology, without any specific significance
beyond that.
[fn:3] I optimized it up to this number, but I wasn't targeting the Kolmogorov complexity.
[fn:4] Hilbert's [[https://maa.org/press/periodicals/convergence/david-hilberts-radio-address-english-translation][radio address]] in 1930.

#+BEGIN_EXPORT html
<div style="text-align: center; font-size: 2em; padding: 20px 0;">
Expand Down

0 comments on commit 694ff3c

Please sign in to comment.