Anders and Briegel in Python
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 1.5KB

8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. # abp 0.4.22
  2. 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/).
  3. ## Installation
  4. It's easiest to install with `pip`:
  5. ```shell
  6. $ pip install --user abp==0.4.22
  7. ```
  8. Or clone and install in `develop` mode:
  9. ```shell
  10. $ git clone https://github.com/peteshadbolt/abp.git
  11. $ cd abp
  12. $ python setup.py develop --user
  13. $ python setup.py develop --user --prefix= # Might be required on OSX
  14. ```
  15. ## Visualization
  16. `abp` comes with a tool to visualize graph states in a web browser. It uses a client-server architecture.
  17. First, run `abpserver` in a terminal:
  18. ```shell
  19. $ abpserver
  20. Listening on port 5000 for clients..
  21. ```
  22. Then browse to `http://localhost:5001/`. Alternatively, `abpserver -v` will automatically pop a browser window.
  23. Now, in another terminal, use `abp.fancy.GraphState` to run a Clifford circuit:
  24. ```python
  25. >>> from abp.fancy import GraphState
  26. >>> g = GraphState(10)
  27. >>> for i in range(10):
  28. ... g.act_hadamard(i)
  29. ...
  30. >>> g.update()
  31. >>> for i in range(9):
  32. ... g.act_cz(i, i+1)
  33. ...
  34. >>> g.update()
  35. ```
  36. And you should see a visualization of the state.
  37. ## Testing
  38. `abp` has a bunch of tests. You can run them all with `nose`:
  39. ```shell
  40. $ nosetests
  41. 53 tests run in 39.5 seconds (53 tests passed)
  42. ```
  43. Currently I use some reference implementations of `chp` and `graphsim` which you won't have installed, so some tests will be skipped. That's expected.