1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

量子フーリエ変換【ソース】

Posted at

blueqatにおけるソースコードを載せます。

 
from blueqat import *
import numpy as np
import copy
import math

def binphase(n, t, circ):
    cres = circ.copy()
    cres.h[t]
    for j in range(2, n - t + 1):
        cres.cphase(2.0 * np.pi / 2**j)[t + j - 1, t]
    return cres


def qft(n, xket, circ):
    cres = circ.copy()
    for j in range(n):
        cres = binphase(n, j, cres)
    return cres

x = [0, 0, 0, 1]
c = Circuit(4)
c.h[:]
cres = c.copy()
r = [j for j in range(16)]
result = cres.run(shot = 100)
print(x, result)
 
``` 
 
問1 逆量子フーリエ変換を実装してください。



問2 4量子ビットにおけるもっとも周波数の高い波はどのような状態からできるか。
  
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?