Skip to content

Commit

Permalink
Add quantum fourier transform example to playground
Browse files Browse the repository at this point in the history
  • Loading branch information
GabrieleMessina committed Apr 12, 2024
1 parent 686b18d commit 4c0bc0b
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions playground/examples/quantum_fourier_transform.qut
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
//init
qubit x_1 = 0q;
qubit x_2 = 1q;
qubit x_3 = 1q;

//QFT
hadamard x_1;
mcp x_1,x_2 by (3.14/2);
mcp x_1,x_2 by (3.14/4);

hadamard x_2;
mcp x_2,x_3 by (3.14/2);

hadamard x_3;

swap x_3,x_1;


//inverse

hadamard x_1;
mcp x_1,x_2 by (-3.14/2);
mcp x_1,x_2 by (-3.14/4);

hadamard x_2;
mcp x_2,x_3 by (-3.14/2);

hadamard x_3;
swap x_3,x_1;

//measure

measure x_1;
measure x_2;
measure x_3;

0 comments on commit 4c0bc0b

Please sign in to comment.