瀏覽代碼

Add an example of 2D grid generation (#12)

master
Pete Shadbolt 8 年之前
父節點
當前提交
bd55821c11
共有 1 個檔案被更改,包括 14 行新增0 行删除
  1. +14
    -0
      examples/visualization/grid_2d.py

+ 14
- 0
examples/visualization/grid_2d.py 查看文件

@@ -0,0 +1,14 @@
from abp.fancy import GraphState
from abp.util import xyz
import itertools

psi = GraphState()
grid = itertools.product(range(10), range(10))
for i, (x, y) in enumerate(grid):
psi.add_qubit(i, position=xyz(x, y, 0), vop=0)

for i in range(50):
psi.act_cz(i, i+1)

psi.update()


Loading…
取消
儲存