Skip to content

ディープテック経済

市場が追いついたら、もう遅い。

Menu
  • Account
  • Log In
  • Password Reset
  • Profile
  • Register
  • お問い合わせ
  • サンプルページ
Menu

Quantum Fourier transform (QFT) with cirq

Posted on 1/26/2023 by DeepRecommend

$$
QFT |x> = frac{1}{2^{n/2}} sum_{y=0}^{2^n-1} e^{2 pi iyx / 2^n} |y>
$$

$|x_1>$ = -H-CR2-CR3-.. -CRn—————–
$|x_2>$ = ——————H-CR2–.. ———-
.
.
$|x_{n-1}>$ = ———————.. –H-CR2—
$|x_n>$ = ————————-.. ——–H-

import cirq
import random
import matplotlib.pyplot as plt
import numpy as np
def make_qft(qubits):
    qreg = list(qubits)
    while len(qreg) > 0:
        q_head = qreg.pop(0)
        yield cirq. H(q_head)
        for i, qubit in enumerate(qreg):
            yield (cirq. CZ **(1 / 2 ** (i + 1)))(qubit, q_head)
qubits = cirq. LineQubit.range(4)
qft = cirq. Circuit(make_qft(qubits))
print(qft)
image.png

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Categories

  • News (2)
  • Technology (8)
    • AI (5)
    • Brain (3)
    • Quantum (1)
  • Uncategorized (22)
  • Value (6)

Archives

  • May 2023 (1)
  • April 2023 (10)
  • March 2023 (5)
  • February 2023 (9)
  • January 2023 (62)
  • December 2022 (20)
  • November 2022 (1)
© 2026 ディープテック経済 | Powered by Minimalist Blog WordPress Theme