2024-10-18 09:40:24 +02:00
|
|
|
#import "qcs.typ": *
|
2024-10-17 15:33:29 +02:00
|
|
|
#set page(
|
|
|
|
paper: "a4",
|
|
|
|
header: align(center)[
|
|
|
|
QCS - DM4 - Augustin LUCAS
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2024-10-18 09:40:24 +02:00
|
|
|
#question("Assignment Q1",
|
2024-10-17 15:33:29 +02:00
|
|
|
([
|
|
|
|
+ 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]$.
|
2024-10-18 09:40:24 +02:00
|
|
|
])
|
2024-10-17 15:33:29 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
+ $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;
|
|
|
|
)$
|
|
|
|
|
|
|
|
|
2024-10-18 09:40:24 +02:00
|
|
|
#question("Assignment Q2",
|
2024-10-17 15:33:29 +02:00
|
|
|
([
|
|
|
|
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($$)
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|