Add DM4.typ
This commit is contained in:
parent
9578811c14
commit
3069af6043
120
DM4.typ
Normal file
120
DM4.typ
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
#set page(
|
||||||
|
paper: "a4",
|
||||||
|
header: align(center)[
|
||||||
|
QCS - DM4 - Augustin LUCAS
|
||||||
|
],
|
||||||
|
)
|
||||||
|
#import "@preview/showybox:2.0.1": showybox
|
||||||
|
#import "@preview/physica:0.9.3": bra, ket
|
||||||
|
|
||||||
|
#showybox(
|
||||||
|
frame: (
|
||||||
|
border-color: blue.darken(50%),
|
||||||
|
title-color: blue.lighten(60%),
|
||||||
|
body-color: blue.lighten(80%)
|
||||||
|
),
|
||||||
|
title-style: (
|
||||||
|
color: black,
|
||||||
|
weight: "regular",
|
||||||
|
align: center
|
||||||
|
),
|
||||||
|
shadow: (
|
||||||
|
offset: 3pt,
|
||||||
|
),
|
||||||
|
title: "Assignment Q1",
|
||||||
|
([
|
||||||
|
+ Let $U=mat(u_(00),u_(01);u_(10),u_(11))$. Write a matrix representation of $U[1]$ and $U[2]$ for $n=2$.
|
||||||
|
+ For $n=3$, write a matrix representation of CNOT$[3,1]$.
|
||||||
|
]),
|
||||||
|
)
|
||||||
|
|
||||||
|
+ $U[1] &= U times.circle I
|
||||||
|
&= mat(u_(00),u_(01);u_(10),u_(11)) times.circle mat(1,0;0,1)
|
||||||
|
&= mat(u_(00)I,u_(01)I;u_(10)I,u_(11)I)
|
||||||
|
&= mat(u_(00),0,u_(01),0;0,u_(00),0,u_(01);u_(10),0,u_(11),0;0,u_(10),0,u_(11))$
|
||||||
|
|
||||||
|
$U[2] &= I times.circle U
|
||||||
|
&= mat(U,0;0,U) = mat(u_(00),u_(01),0,0;u_(10),u_(11),0,0;0,0,u_(00),u_(01);0,0,u_(01),u_(11))$
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
+ $"CNOT"[3,1]$ corresponds to the following circuit:
|
||||||
|
|
||||||
|
#{
|
||||||
|
import "@preview/quill:0.4.0": *
|
||||||
|
|
||||||
|
quantum-circuit(
|
||||||
|
lstick($v_0$), 1, targ(), 2, rstick($$), [\ ],
|
||||||
|
lstick($v_1$), 1, rstick($$), 2, [\ ],
|
||||||
|
lstick($v_2$), 1, ctrl(-2), 2, rstick($$)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
Which corresponds to the following matrix:
|
||||||
|
|
||||||
|
$"CNOT"[3,1] = mat(
|
||||||
|
1,0,0,0,0,0,0,0;
|
||||||
|
0,0,0,0,0,1,0,0;
|
||||||
|
0,0,1,0,0,0,0,0;
|
||||||
|
0,0,0,0,0,0,0,1;
|
||||||
|
0,0,0,0,1,0,0,0;
|
||||||
|
0,1,0,0,0,0,0,0;
|
||||||
|
0,0,0,0,0,0,1,0;
|
||||||
|
0,0,0,1,0,0,0,0;
|
||||||
|
)$
|
||||||
|
|
||||||
|
|
||||||
|
#showybox(
|
||||||
|
frame: (
|
||||||
|
border-color: blue.darken(50%),
|
||||||
|
title-color: blue.lighten(60%),
|
||||||
|
body-color: blue.lighten(80%)
|
||||||
|
),
|
||||||
|
title-style: (
|
||||||
|
color: black,
|
||||||
|
weight: "regular",
|
||||||
|
align: center
|
||||||
|
),
|
||||||
|
shadow: (
|
||||||
|
offset: 3pt,
|
||||||
|
),
|
||||||
|
title: "Assignment Q2",
|
||||||
|
([
|
||||||
|
Let $A=1/sqrt(2) mat(-i,-1;1,i)$ and $B=mat(0,1;-1,0)$.
|
||||||
|
Which 2-qubit gate can you apply on the first qubits at the end of the circuit
|
||||||
|
#{
|
||||||
|
import "@preview/quill:0.4.0": *
|
||||||
|
|
||||||
|
quantum-circuit(
|
||||||
|
lstick($$), ctrl(2), 1, ctrl(2), 1, [\ ],
|
||||||
|
lstick($$), 1, ctrl(1), 1, ctrl(1), [\ ],
|
||||||
|
lstick($$), $B^(-1)$, $A^(-1)$, $B$, $A$, rstick($$)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
to get a Toffoli gate ?
|
||||||
|
]),
|
||||||
|
)
|
||||||
|
|
||||||
|
The circuit corresponds to applying the following gate:
|
||||||
|
|
||||||
|
$C &= mat(I_2,0,0,0;0,I_2,0,0;0,0,B^(-1),0;0,0,0,B^(-1))
|
||||||
|
mat(I_2,0,0,0;0,A^(-1),0,0;0,0,I_2,0;0,0,0,A^(-1))
|
||||||
|
mat(I_2,0,0,0;0,I_2,0,0;0,0,B,0;0,0,0,B)
|
||||||
|
mat(I_2,0,0,0;0,A,0,0;0,0,I_2,0;0,0,0,A)
|
||||||
|
&= mat(I_2,0,0,0;0,I_2,0,0;0,0,I_2,0;0,0,0,B^(-1)A^(-1) B A)$
|
||||||
|
|
||||||
|
And $B^(-1)A^(-1) B A = B A B A = mat(0,i;i,0)$.
|
||||||
|
|
||||||
|
Let $D = i I_2$. Then, $C mat(I_2,0,0,0;0,I_2,0,0;0,0,I_2,0;0,0,0,D) = "Toffoli"$
|
||||||
|
|
||||||
|
Which corresponds to the following circuit:
|
||||||
|
#{
|
||||||
|
import "@preview/quill:0.4.0": *
|
||||||
|
|
||||||
|
quantum-circuit(
|
||||||
|
lstick($$), ctrl(2), 1, ctrl(2), 1, [\ ],
|
||||||
|
lstick($$), 1, ctrl(1), 1, ctrl(1), [\ ],
|
||||||
|
lstick($$), $B^(-1)$, $A^(-1)$, $B$, $A$, $D$, rstick($$)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user