feat: add diagrams

This commit is contained in:
Kristofers Solo 2025-06-05 19:38:49 +03:00
parent c37a749776
commit 817fe323f0
Signed by: kristoferssolo
GPG Key ID: 8687F2D3EEE6F0ED

View File

@ -17,7 +17,7 @@
#let CU = $lr(C-U)$ #let CU = $lr(C-U)$
#let QFT = $lr(Q F T)$ #let QFT = $lr(Q F T)$
= Bre-Ket Notation = Bra-Ket Notation
== Ket $ket(psi)$ == Ket $ket(psi)$
Represents a column vector for a quantum state. Represents a column vector for a quantum state.
$ ket(psi)=alpha ket(0)+beta ket(1) <==> vec(alpha, beta) $ $ ket(psi)=alpha ket(0)+beta ket(1) <==> vec(alpha, beta) $
@ -107,7 +107,10 @@ $
= Single Qubit Unitary Transformations = Single Qubit Unitary Transformations
Quantum gates are unitary matrices $U$. Quantum gates are unitary matrices $U$.
$ U U^dagger=U^dagger U=I $ - Unitary condition: $U U^dagger=U^dagger U=I$, where $U^dagger$ is the
conjugate transpose.
- Action on state $ket(psi')=U ket(psi)$
=== Properties === Properties
Linearity Linearity
@ -132,6 +135,7 @@ $
=== X (NOT) === X (NOT)
Bit flip Bit flip
#figure(quantum-circuit(..tq.build(tq.x(0))))
$ $
X=mat(0, 1; 1, 0) distance X=mat(0, 1; 1, 0) distance
cases( cases(
@ -141,6 +145,7 @@ $
$ $
=== Y Gate === Y Gate
#figure(quantum-circuit(..tq.build(tq.y(0))))
$ $
Y=mat(0, -i; i, 0) distance Y=mat(0, -i; i, 0) distance
cases( cases(
@ -151,6 +156,7 @@ $
=== Z Gate === Z Gate
Phase flip Phase flip
#figure(quantum-circuit(..tq.build(tq.z(0))))
$ $
Z=mat(1, 0; 0, -1) distance Z=mat(1, 0; 0, -1) distance
cases( cases(
@ -161,6 +167,7 @@ $
== Hadamard Gate ($H$) == Hadamard Gate ($H$)
Creates superpositions Creates superpositions
#figure(quantum-circuit(..tq.build(tq.h(0))))
$ $
H=1/sqrt(2) mat(1, 1; 1, -1) distance H=1/sqrt(2) mat(1, 1; 1, -1) distance
cases( cases(
@ -174,14 +181,18 @@ $
H H=H^2=I H H=H^2=I
$ $
== Phase Gates == Phase Gates
=== $S$ Gate $(sqrt(Z))$ === $S$ Gate $(sqrt(Z))$
#figure(quantum-circuit(..tq.build(tq.s(0))))
$ S= mat(1, 0; 0, i) distance S^2=Z $ $ S= mat(1, 0; 0, i) distance S^2=Z $
=== $T$ Gate $(pi/8))$ === $T$ Gate $(pi/8))$
#figure(quantum-circuit(..tq.build(tq.t(0))))
$ T= mat(1, 0; 0, e^(i pi/4)) distance T^2=S $ $ T= mat(1, 0; 0, e^(i pi/4)) distance T^2=S $
== Rotation Gates ($R_n (theta)$) == Rotation Gates ($R_n (theta)$)
#figure(quantum-circuit(..tq.build(tq.rx($theta$, 0))))
$ $
R_x (theta)= R_x (theta)=
e^((-i theta X)/2)= e^((-i theta X)/2)=
@ -191,6 +202,7 @@ $
) )
$ $
#figure(quantum-circuit(..tq.build(tq.ry($theta$, 0))))
$ $
R_y (theta)= R_y (theta)=
e^((-i theta Y)/2)= e^((-i theta Y)/2)=
@ -200,6 +212,7 @@ $
) )
$ $
#figure(quantum-circuit(..tq.build(tq.rz($theta$, 0))))
$ $
R_z (theta)= R_z (theta)=
e^((-i theta Z)/2)= e^((-i theta Z)/2)=
@ -264,11 +277,24 @@ $
$ $
=== Entangled States === Entangled States
Cannot be factored Cannot be factored
==== Example ==== Example
$ $
1/sqrt(2)(ket(00)+ket(11)) ("Bell state" ket(Phi^+)) 1/sqrt(2)(ket(00)+ket(11)) ("Bell state" ket(Phi^+))
$ $
#figure(quantum-circuit(
lstick($ket(0)$),
gate($H$),
ctrl(1),
1,
[\ ],
lstick($ket(0)$),
1,
targ(),
1,
))
== Multi-Qubit Measurement & Normalization == Multi-Qubit Measurement & Normalization
Measure one qubit from a multi-qubit system. Measure one qubit from a multi-qubit system.
==== Example ==== Example
@ -333,7 +359,11 @@ $ CNOT ket(c) ket(t)=ket(c)ket(t tensor c) $
=== $SWAP$ Gate === $SWAP$ Gate
Swaps two qubits. Swaps two qubits.
#figure(quantum-circuit(..tq.build(tq.swap(0, 1)))) #figure([
#quantum-circuit(..tq.build(tq.swap(0, 1)))
or
#quantum-circuit(..tq.build(tq.cx(0, 1), tq.cx(1, 0), tq.cx(0, 1)))
])
=== Toffoli Gate ($CCNOT$) === Toffoli Gate ($CCNOT$)
$ CCNOT ket(c_1 c_2 t)=ket(c_1 c_2 t tensor (c_1 dot c_2)) $ $ CCNOT ket(c_1 c_2 t)=ket(c_1 c_2 t tensor (c_1 dot c_2)) $
@ -483,6 +513,10 @@ $
(where $N=p q$, period $p$), then (where $N=p q$, period $p$), then
$ QFT_N ket(psi)=1/sqrt(p) sum_(k=0)^(p-1) c_k ket(k dot N/p) $ (Output is $ QFT_N ket(psi)=1/sqrt(p) sum_(k=0)^(p-1) c_k ket(k dot N/p) $ (Output is
superposition of multiples of $N/p$). superposition of multiples of $N/p$).
#figure(quantum-circuit(..tq.qft(3)))
== Period Finding (Kvantu algoritms perioda atrašanai) == Period Finding (Kvantu algoritms perioda atrašanai)
- Problem: Given $f(x) = f(x+r)$, find period $r$. $N$ is size of domain. - Problem: Given $f(x) = f(x+r)$, find period $r$. $N$ is size of domain.
- Algorithm: - Algorithm: