From bd55821c11622a5beb22bbbdaf7c7d14faff79cc Mon Sep 17 00:00:00 2001 From: Pete Shadbolt Date: Tue, 25 Oct 2016 10:53:18 +0100 Subject: [PATCH] Add an example of 2D grid generation (#12) --- examples/visualization/grid_2d.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 examples/visualization/grid_2d.py diff --git a/examples/visualization/grid_2d.py b/examples/visualization/grid_2d.py new file mode 100644 index 0000000..6a88d40 --- /dev/null +++ b/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() +