浏览代码

Tidy up examples, remove images from docs & readme

master
Pete Shadbolt 8 年前
父节点
当前提交
d41fff969c
共有 7 个文件被更改,包括 19 次插入41 次删除
  1. +1
    -5
      README.md
  2. +0
    -4
      doc/index.rst
  3. 二进制
      examples/demo.gif
  4. +0
    -24
      examples/mercedes_demo.py
  5. +0
    -8
      examples/tidying_vops.py
  6. +18
    -0
      examples/visualization/issues/unpositioned_nodes.py
  7. 二进制
      examples/viz.png

+ 1
- 5
README.md 查看文件

@@ -2,8 +2,6 @@

Python port of Anders and Briegel' s [method](https://arxiv.org/abs/quant-ph/0504117) for fast simulation of Clifford circuits. You can read the full documentation [here](https://peteshadbolt.co.uk/abp/).

![demo](examples/demo.gif)

## Installation

It's easiest to install with `pip`:
@@ -48,9 +46,7 @@ Now, in another terminal, use `abp.fancy.GraphState` to run a Clifford circuit:
>>> g.update()
```

And you should see a visualization of the state:

![demo](examples/viz.png)
And you should see a visualization of the state.

## Testing



+ 0
- 4
doc/index.rst 查看文件

@@ -19,8 +19,6 @@ This is the documentation for ``abp``. It's a work in progress.
``abp`` is a Python port of Anders and Briegel' s `method <https://arxiv.org/abs/quant-ph/0504117>`_ for fast simulation of Clifford circuits.
That means that you can make quantum states of thousands of qubits, perform any sequence of Clifford operations, and measure in any of :math:`\{\sigma_x, \sigma_y, \sigma_z\}`.

.. image:: ../examples/demo.gif

Installing
----------------------------

@@ -119,8 +117,6 @@ Now, in another terminal, use ``abp.fancy.GraphState`` to run a Clifford circuit

And you should see a 3D visualization of the state. You can call ``update()`` in a loop to see an animation.

.. image:: ../examples/viz.png

Reference
----------------------------



二进制
examples/demo.gif 查看文件

之前 之后
宽度: 381  |  高度: 302  |  大小: 517KB

+ 0
- 24
examples/mercedes_demo.py 查看文件

@@ -1,24 +0,0 @@
from abp.fancy import GraphState as FGS
import abp
from abp.util import xyz

def linear_cluster(n):
g = FGS(range(n), deterministic=False)
g.act_circuit([(i, "hadamard") for i in range(n)])
g.act_circuit([((i, i+1), "cz") for i in range(n-1)])
return g


def test_mercedes_example_1():
""" Run an example provided by mercedes """

g = linear_cluster(5)
g.measure(2, "px", 1)
g.measure(3, "px", 1)
g.remove_vop(0, 1)
g.remove_vop(1, 0)
print g.node

if __name__ == '__main__':
test_mercedes_example_1()

+ 0
- 8
examples/tidying_vops.py 查看文件

@@ -1,8 +0,0 @@
import abp

# TODO

# make a random state

# try to tidy up such that all VOPs are in (X, Y, Z)


+ 18
- 0
examples/visualization/issues/unpositioned_nodes.py 查看文件

@@ -0,0 +1,18 @@
from abp.fancy import GraphState
import networkx as nx

edges = [(0,1),(1,2),(2,3),(3,4)]
nodes = [(i, {'x': i, 'y': 0, 'z':0}) for i in range(5)]
gs = GraphState()

for node, position in nodes:
gs.add_qubit(node, position=position)
gs.act_hadamard(node)

for edge in edges:
gs.act_cz(*edge)
gs.update(3)
# a single line of qubits are created along the x axis
gs.add_qubit('start')
gs.update(0)
# a curved 5-qubit cluster and single qubit is depicted

二进制
examples/viz.png 查看文件

之前 之后
宽度: 529  |  高度: 321  |  大小: 10KB

正在加载...
取消
保存