├── .gitattributes ├── .travis.yml ├── COPYING ├── Doxyfile ├── Makefile ├── Makefile.MacOSX ├── README.md ├── cphase.tbl ├── demo.py ├── doc ├── graphsim_py.html ├── html │ ├── annotated.html │ ├── classGraphRegister-members.html │ ├── classGraphRegister.html │ ├── doxygen.css │ ├── doxygen.png │ ├── files.html │ ├── functions.html │ ├── functions_func.html │ ├── functions_vars.html │ ├── globals.html │ ├── globals_func.html │ ├── globals_type.html │ ├── globals_vars.html │ ├── graphsim_8h-source.html │ ├── graphsim_8h.html │ ├── index.html │ ├── loccliff_8h-source.html │ ├── loccliff_8h.html │ ├── namespaceloccliff__tables.html │ ├── namespaces.html │ ├── stabilizer_8h-source.html │ ├── stabilizer_8h.html │ ├── structConnectionInfo-members.html │ ├── structConnectionInfo.html │ ├── structEdge-members.html │ ├── structEdge.html │ ├── structLocCliffOp-members.html │ ├── structLocCliffOp.html │ ├── structQubitVertex-members.html │ ├── structQubitVertex.html │ ├── structRightPhase-members.html │ ├── structRightPhase.html │ ├── structStabilizer-members.html │ ├── structStabilizer.html │ ├── structedge__hash-members.html │ └── structedge__hash.html ├── latex │ ├── Makefile │ ├── annotated.tex │ ├── classGraphRegister.tex │ ├── doxygen.sty │ ├── files.tex │ ├── graphsim_8h.tex │ ├── index.tex │ ├── loccliff_8h.tex │ ├── namespaceloccliff__tables.tex │ ├── namespaces.tex │ ├── refman.tex │ ├── stabilizer_8h.tex │ ├── structConnectionInfo.tex │ ├── structEdge.tex │ ├── structLocCliffOp.tex │ ├── structQubitVertex.tex │ ├── structRightPhase.tex │ ├── structStabilizer.tex │ └── structedge__hash.tex ├── timestamp.dummy └── xml │ ├── classGraphRegister.xml │ ├── compound.xsd │ ├── graphsim_8cpp.xml │ ├── graphsim_8h.xml │ ├── gstest_8cpp.xml │ ├── index.xml │ ├── index.xsd │ ├── indexpage.xml │ ├── loccliff_8cpp.xml │ ├── loccliff_8h.xml │ ├── namespaceloccliff__tables.xml │ ├── namespacestd.xml │ ├── stabilizer_8cpp.xml │ ├── stabilizer_8h.xml │ ├── structConnectionInfo.xml │ ├── structEdge.xml │ ├── structLocCliffOp.xml │ ├── structQState.xml │ ├── structQubitVertex.xml │ ├── structRightMatrix.xml │ ├── structRightPhase.xml │ ├── structStabilizer.xml │ └── structedge__hash.xml ├── graphsim.cpp ├── graphsim.h ├── gstest.cpp ├── loccliff.cpp ├── loccliff.h ├── make_cphase_tbl2.nb ├── multtbl.nb ├── multtbl.tbl ├── sqrt-gen.nb ├── stabilizer.cpp └── stabilizer.h /.gitattributes: -------------------------------------------------------------------------------- 1 | *.cpp linguist-language=C++ 2 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: cpp 2 | compiler: 3 | - clang 4 | - gcc 5 | notifications: 6 | email: false 7 | env: 8 | matrix: 9 | before_install: 10 | - sudo apt-get update -qq -y 11 | - sudo apt-get install python2.7 python2.7-dev -y 12 | - sudo apt-get install swig 13 | script: 14 | - make all 15 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for graphsim 2 | 3 | # This make file defines the following targets: 4 | # gs: The graphsim C++ library (as simple object file to link against) 5 | # and a small test program called gstest 6 | # pywrapper: Python bindings to graphsim (needs SWIG) 7 | # doc: documentation for use with C++ (needs Doxygen) 8 | # docpy: documentation for use with Python (needs Pydoc) 9 | # all: all of the above 10 | # chpcomp: compile Aaronson's CHP program to compare with this. Only for debugging 11 | # Needs subdirectory 'CHP'. 12 | # clean: Delete all generated files 13 | 14 | # Set these variables to 'yes' or 'no' to switch on or off debug information, 15 | # profile inpormation, and optimization 16 | DEBUG=yes 17 | PROFILE=no 18 | OPTIMIZE=yes 19 | 20 | # SWIG is a tool to generate bindings to the C++ library for script languages 21 | # (here: Python). Enter here the path to the SWIG binary. If you do not have 22 | # SWIG and do not need Python bindings, leave it empty and build only the target 23 | # 'gs', not 'all' 24 | SWIG=/usr/bin/swig 25 | 26 | # Mathlink is a part of Mathematica. It is used here to compare the computation of 27 | # graphsim with Scott Aaronson's CHP program. If you do not want to do debugging 28 | # or checking, you do not need this. Put it to 'no'. 29 | WITH_MATHLINK=no 30 | #MATHLINK=/opt/local/cluster/Mathematica/5.0/AddOns/MathLink/DeveloperKit/Linux/CompilerAdditions/ 31 | 32 | # The following compiler flags are for GNU C/C++. if you have another compiler 33 | # you might have to change them 34 | CXX=g++ 35 | CC=gcc 36 | 37 | CFLAGS=-Wall -fPIC 38 | NOLINK=-c 39 | ifeq (${DEBUG}, yes) 40 | CFLAGS += -g 41 | endif 42 | ifeq (${PROFILE}, yes) 43 | CFLAGS += -pg 44 | endif 45 | ifeq (${OPTIMIZE}, yes) 46 | CFLAGS += -O3 47 | endif 48 | 49 | # Doxygen binary. (Leave empty if you do not have Doxygen.) 50 | DOXYGEN= 51 | 52 | # End of user configurable settings. 53 | 54 | # This is for MathLink: 55 | MLLIB= 56 | MLINC= 57 | ifeq (${WITH_MATHLINK}, yes) 58 | CFLAGS += -DWITH_MATHLINK 59 | MLLIB = ${MATHLINK}/libML.a 60 | MLINC = -I${MATHLINK} 61 | endif 62 | 63 | 64 | 65 | all: gs pywrapper doc docpy 66 | 67 | gs: graphsim.o gstest 68 | 69 | pywrapper: graphsim.py _graphsim.so 70 | 71 | doc: doc/timestamp.dummy 72 | 73 | docpy: doc/graphsim_py.html 74 | 75 | chpcomp: chp.py _chp.so 76 | 77 | DELFILES=*.o _*.so gstest *_wrap.* graphsim.py \ 78 | graphsim.html chp.py chp.html *.pyc core.* 79 | clean: 80 | rm -f ${DELFILES} CHP/${DELFILES} 81 | cd doc && rm -rf * 82 | 83 | # Now the details: 84 | 85 | gstest: graphsim.o loccliff.o stabilizer.o gstest.cpp 86 | ${CXX} ${CFLAGS} -o gstest gstest.cpp graphsim.o loccliff.o stabilizer.o ${MLLIB} 87 | 88 | graphsim.o: graphsim.cpp graphsim.h cphase.tbl loccliff.h stabilizer.h 89 | ${CXX} ${CFLAGS} ${NOLINK} graphsim.cpp 90 | 91 | loccliff.o: loccliff.cpp loccliff.h 92 | ${CXX} ${CFLAGS} ${NOLINK} loccliff.cpp 93 | 94 | stabilizer.o: stabilizer.cpp stabilizer.h graphsim.h loccliff.h 95 | ${CXX} ${CFLAGS} ${NOLINK} stabilizer.cpp ${MLINC} 96 | 97 | graphsim_wrap.cxx: graphsim.h loccliff.h 98 | ${SWIG} -python ${NOLINK}++ -globals consts graphsim.h 99 | 100 | _graphsim.so: graphsim.o graphsim_wrap.o loccliff.o stabilizer.o 101 | ${CXX} ${CFLAGS} -shared graphsim.o graphsim_wrap.o loccliff.o \ 102 | stabilizer.o ${MLLIB} -o _graphsim.so 103 | 104 | graphsim_wrap.o: graphsim_wrap.cxx 105 | ${CXX} ${CFLAGS} ${NOLINK} graphsim_wrap.cxx -I/usr/include/python2.7/ 106 | 107 | loccliff.h: multtbl.tbl 108 | 109 | graphsim.py: _graphsim.so 110 | 111 | doc/graphsim_py.html: graphsim.py 112 | pydoc -w ./graphsim.py 113 | mv graphsim.html doc/graphsim_py.html 114 | 115 | doc/chp.html: chp.py 116 | pydoc -w CHP/chp.py 117 | mv chp.html doc/chp_py.html 118 | 119 | doc/timestamp.dummy: graphsim.h loccliff.h stabilizer.h 120 | touch doc/timestamp.dummy 121 | ${DOXYGEN} 122 | 123 | chp.py: _chp.so 124 | 125 | chp_wrap.o: CHP/chp_wrap.c 126 | ${CC} ${CFLAGS} ${NOLINK} CHP/chp_wrap.c -I/usr/include/python2.7/ 127 | 128 | chp_wrap.c: CHP/chp.i CHP/chp.h 129 | ${SWIG} -python CHP/chp.i 130 | 131 | chp.o: CHP/chp.c 132 | ${CC} ${CFLAGS} ${NOLINK} CHP/chp.c 133 | 134 | chp.py _chp.so: chp.o chp_wrap.o 135 | ${CC} ${CFLAGS} -shared chp.o chp_wrap.o -o _chp.so 136 | -------------------------------------------------------------------------------- /Makefile.MacOSX: -------------------------------------------------------------------------------- 1 | # Makefile for graphsim 2 | 3 | # This make file defines the following targets: 4 | # graphsim: The graphsim C++ library (as simple object file to link against) 5 | # and a small test program called gstest 6 | # pywrapper: Python bindings to graphsim (needs SWIG) 7 | # doc: documentation for use with C++ (needs Doxygen) 8 | # docpy: documentation for use with Python (needs Pydoc) 9 | # all: all of the above 10 | # chpcomp: compile Aaronson's CHP program to compare with this. Only for debugging 11 | # Needs subdirectory 'CHP'. 12 | # clean: Delete all generated files 13 | 14 | # Stuff for MacOSX 15 | PYTHON=/System/Library/Frameworks/Python.framework/Versions/2.3 16 | 17 | # Set these variables to 'yes' or 'no' to switch on or off debug information, 18 | # profile inpormation, and optimization 19 | DEBUG=yes 20 | PROFILE=no 21 | OPTIMIZE=yes 22 | 23 | # SWIG is a tool to generate bindings to the C++ library for script languages 24 | # (here: Python). Enter here the path to the SWIG binary. If you do not have 25 | # SWIG and do not need Python bindings, leave it empty and build only the target 26 | # 'graphsim', not 'all' 27 | SWIG=/usr/local/bin/swig 28 | 29 | # Mathlink is a part of Mathematica. It is used here to compare the computation of 30 | # graphsim with Scott Aaronson's CHP program. If you do not want to do debugging 31 | # or checking, you do not need this. Put it to 'no'. 32 | WITH_MATHLINK=no 33 | MATHLINK=/opt/local/cluster/Mathematica/5.0/AddOns/MathLink/DeveloperKit/Linux/CompilerAdditions/ 34 | 35 | # The following compiler flags are for GNU C/C++. if you have another compiler 36 | # you might have to change them 37 | CXX=g++ 38 | CC=gcc 39 | 40 | CFLAGS=-W 41 | NOLINK=-c 42 | ifeq (${DEBUG}, yes) 43 | CFLAGS += -g 44 | endif 45 | ifeq (${PROFILE}, yes) 46 | CFLAGS += -pg 47 | endif 48 | ifeq (${OPTIMIZE}, yes) 49 | CFLAGS += -O3 50 | endif 51 | 52 | # Doxygen binary. (Leave empty if you do not have Doxygen.) 53 | DOXYGEN= 54 | 55 | # End of user configurable settings. 56 | 57 | # This is for MathLink: 58 | MLLIB= 59 | MLINC= 60 | ifeq (${WITH_MATHLINK}, yes) 61 | CFLAGS += -DWITH_MATHLINK 62 | MLLIB = ${MATHLINK}/libML.a 63 | MLINC = -I${MATHLINK} 64 | endif 65 | 66 | 67 | all: gs pywrapper doc docpy 68 | 69 | gs: graphsim.o gstest 70 | 71 | pywrapper: graphsim.py _graphsim.so 72 | 73 | doc: doc/timestamp.dummy 74 | 75 | docpy: doc/graphsim_py.html 76 | 77 | chpcomp: chp.py _chp.so 78 | 79 | DELFILES=*.o _*.so gstest *_wrap.* graphsim.py \ 80 | graphsim.html chp.py chp.html *.pyc core.* 81 | clean: 82 | rm -f ${DELFILES} CHP/${DELFILES} 83 | cd doc && rm -rf * 84 | 85 | # Now the details: 86 | 87 | gstest: graphsim.o loccliff.o stabilizer.o gstest.cpp 88 | ${CXX} ${CFLAGS} -o gstest gstest.cpp graphsim.o loccliff.o stabilizer.o ${MLLIB} 89 | 90 | graphsim.o: graphsim.cpp graphsim.h cphase.tbl loccliff.h stabilizer.h 91 | ${CXX} ${CFLAGS} ${NOLINK} graphsim.cpp 92 | 93 | loccliff.o: loccliff.cpp loccliff.h 94 | ${CXX} ${CFLAGS} ${NOLINK} loccliff.cpp 95 | 96 | stabilizer.o: stabilizer.cpp stabilizer.h graphsim.h loccliff.h 97 | ${CXX} ${CFLAGS} ${NOLINK} stabilizer.cpp ${MLINC} 98 | 99 | graphsim_wrap.cxx: graphsim.h loccliff.h 100 | ${SWIG} -python ${NOLINK}++ -globals consts graphsim.h 101 | 102 | _graphsim.so: graphsim.o graphsim_wrap.o loccliff.o stabilizer.o 103 | ${CXX} ${CFLAGS} -framework Python -bundle -bundle_loader ${PYTHON}/bin/python graphsim.o graphsim_wrap.o loccliff.o \ 104 | stabilizer.o ${MLLIB} -o _graphsim.so 105 | 106 | graphsim_wrap.o: graphsim_wrap.cxx 107 | ${CXX} ${CFLAGS} ${NOLINK} -fPIC graphsim_wrap.cxx -I${PYTHON}/Headers/ 108 | 109 | loccliff.h: multtbl.tbl 110 | 111 | graphsim.py: _graphsim.so 112 | 113 | doc/graphsim_py.html: graphsim.py 114 | pydoc -w ./graphsim.py 115 | mv graphsim.html doc/graphsim_py.html 116 | 117 | doc/chp.html: chp.py 118 | pydoc -w CHP/chp.py 119 | mv chp.html doc/chp_py.html 120 | 121 | doc/timestamp.dummy: graphsim.h loccliff.h stabilizer.h 122 | touch doc/timestamp.dummy 123 | ${DOXYGEN} 124 | 125 | chp.py: _chp.so 126 | 127 | chp_wrap.o: CHP/chp_wrap.c 128 | ${CC} ${CFLAGS} ${NOLINK} -fPIC CHP/chp_wrap.c -I${PYTHON}/Headers 129 | 130 | chp_wrap.c: CHP/chp.i CHP/chp.h 131 | ${SWIG} -python CHP/chp.i 132 | 133 | chp.o: CHP/chp.c 134 | ${CC} ${CFLAGS} ${NOLINK} CHP/chp.c 135 | 136 | chp.py _chp.so: chp.o chp_wrap.o 137 | ${CC} ${CFLAGS} -framework Python -bundle -bundle_loader ${PYTHON}/bin/python chp.o chp_wrap.o -o _chp.so 138 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # GraphSim 2 | 3 | [![Build Status](https://travis-ci.org/marcusps/GraphSim.svg?branch=master)](https://travis-ci.org/marcusps/GraphSim) 4 | 5 | This is a git repository for Simon Anders' library to simulate an important class of quantum circuits. 6 | 7 | This code is not actively supported or maintained, but pull requests for minor bug fixes will be accepted. 8 | 9 | > This is GraphSim, a library do simulate stabilizer quantum circuits. 10 | > 11 | > - Author: Simon Anders, sanders@fs.tum.de, University of Innsbruck 12 | > - Version: v.10 (initial release) 13 | > - Date: 1 Feb 2005 (last change), 18 Apr 2005 (release prep) 14 | > - (c) 2005, released under GPL 15 | > 16 | > For information about this package, please read 17 | > - the paper describing the algorithm: 18 | > S. Anders, H. J. Briegel: 19 | > Fast Simulation of Stabilizer Circuits using a Graph State Formalism 20 | > quant-ph/0504117 21 | > - the documentation of the C++ library in doc/html/index.html 22 | > - the documentation of the Python bindings in doc/graphsim_py.html 23 | > - the file COPYING for the text of the GPL 24 | > 25 | > If you use this paper for scientific work, please cite the paper 26 | > referenced above in your publication. 27 | 28 | In case of problems, please submit an issue: https://github.com/marcusps/GraphSim/issues 29 | 30 | This code is not actively supported or maintained, but pull requests for minor bug fixes will be accepted. 31 | -------------------------------------------------------------------------------- /demo.py: -------------------------------------------------------------------------------- 1 | import graphsim 2 | import random 3 | 4 | # we need a quantum register with 7 qubits: 5 | gr = graphsim.GraphRegister (8) 6 | 7 | gr.hadamard (4) 8 | gr.hadamard (5) 9 | gr.hadamard (6) 10 | gr.cnot (6, 3) 11 | gr.cnot (6, 1) 12 | gr.cnot (6, 0) 13 | gr.cnot (5, 3) 14 | gr.cnot (5, 2) 15 | gr.cnot (5, 0) 16 | gr.cnot (4, 3) 17 | gr.cnot (4, 2) 18 | gr.cnot (4, 1) 19 | 20 | for i in xrange (7): 21 | gr.cnot (i, 7) 22 | 23 | print gr.measure (7) 24 | 25 | gr.print_adj_list () 26 | gr.print_stabilizer () 27 | 28 | -------------------------------------------------------------------------------- /doc/html/annotated.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | graphsim: Annotated Index 4 | 5 | 6 | 7 |
Main Page | Namespace List | Class List | File List | Class Members | File Members
8 |

graphsim Class List

Here are the classes, structs, unions and interfaces with brief descriptions: 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |
ConnectionInfo
EdgeThis structure is needed only by toggle_edges
edge_hashThis structure is needed only by toggle_edges
GraphRegisterA quantum register
LocCliffOpAn operator in the local Clifford group
QubitVertex
RightPhaseA phase, which is 0, 90, 180, or 270 degrees
StabilizerA stabilizer describing a quantum state
18 |
Generated on Mon Apr 18 16:10:12 2005 for graphsim by 19 | 20 | doxygen 21 | 1.3.4
22 | 23 | 24 | -------------------------------------------------------------------------------- /doc/html/classGraphRegister-members.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | graphsim: Member List 4 | 5 | 6 | 7 |
Main Page | Namespace List | Class List | File List | Class Members | File Members
8 |

GraphRegister Member List

This is the complete list of members for GraphRegister, including all inherited members. 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 |
bitflip(VertexIndex v)GraphRegister [inline]
cnot(VertexIndex vc, VertexIndex vt)GraphRegister
cphase(VertexIndex v1, VertexIndex v2)GraphRegister
get_full_stabilizer(void) const GraphRegister
GraphRegister(VertexIndex numQubits, int randomize=-1)GraphRegister
GraphRegister(GraphRegister &gr)GraphRegister
hadamard(VertexIndex v)GraphRegister [inline]
invert_neighborhood(VertexIndex v)GraphRegister
local_op(VertexIndex v, LocCliffOp o)GraphRegister [inline]
measure(VertexIndex v, LocCliffOp basis=lco_Z, bool *determined=NULL, int force=-1)GraphRegister
phaseflip(VertexIndex v)GraphRegister [inline]
phaserot(VertexIndex v)GraphRegister [inline]
print_adj_list(ostream &os=cout) const GraphRegister
print_adj_list_line(ostream &os, VertexIndex i) const GraphRegister
print_stabilizer(ostream &os=cout) const GraphRegister
verticesGraphRegister
~GraphRegister() (defined in GraphRegister)GraphRegister [inline]

Generated on Mon Apr 18 16:10:12 2005 for graphsim by 27 | 28 | doxygen 29 | 1.3.4
30 | 31 | 32 | -------------------------------------------------------------------------------- /doc/html/doxygen.css: -------------------------------------------------------------------------------- 1 | H1 { 2 | text-align: center; 3 | font-family: Arial, Helvetica, sans-serif; 4 | } 5 | H2 { 6 | font-family: Geneva, Arial, Helvetica, sans-serif; 7 | } 8 | CAPTION { font-weight: bold } 9 | DIV.qindex { width: 100%; 10 | background-color: #eeeeff; 11 | border: 4px solid #eeeeff; 12 | text-align: center; 13 | margin-bottom: 2px 14 | } 15 | A.qindex { text-decoration: none; font-weight: bold; color: #0000ee } 16 | A.qindex:visited { text-decoration: none; font-weight: bold; color: #0000ee } 17 | A.qindex:hover { text-decoration: none; background-color: #ddddff } 18 | A.qindexHL { text-decoration: none; font-weight: bold; 19 | background-color: #6666cc; 20 | color: #ffffff 21 | } 22 | A.qindexHL:hover { text-decoration: none; background-color: #6666cc; color: #ffffff } 23 | A.qindexHL:visited { text-decoration: none; background-color: #6666cc; color: #ffffff } 24 | A.el { text-decoration: none; font-weight: bold } 25 | A.elRef { font-weight: bold } 26 | A.code { text-decoration: none; font-weight: normal; color: #4444ee } 27 | A.codeRef { font-weight: normal; color: #4444ee } 28 | A:hover { text-decoration: none; background-color: #f2f2ff } 29 | DL.el { margin-left: -1cm } 30 | DIV.fragment { 31 | width: 98%; 32 | border: 1px solid #CCCCCC; 33 | background-color: #f5f5f5; 34 | padding-left: 4px; 35 | margin: 4px; 36 | } 37 | DIV.ah { background-color: black; font-weight: bold; color: #ffffff; margin-bottom: 3px; margin-top: 3px } 38 | TD.md { background-color: #f2f2ff; font-weight: bold; } 39 | TD.mdname1 { background-color: #f2f2ff; font-weight: bold; color: #602020; } 40 | TD.mdname { background-color: #f2f2ff; font-weight: bold; color: #602020; width: 600px; } 41 | DIV.groupHeader { margin-left: 16px; margin-top: 12px; margin-bottom: 6px; font-weight: bold } 42 | DIV.groupText { margin-left: 16px; font-style: italic; font-size: smaller } 43 | BODY { 44 | background: white; 45 | color: black; 46 | margin-right: 20px; 47 | margin-left: 20px; 48 | } 49 | TD.indexkey { 50 | background-color: #eeeeff; 51 | font-weight: bold; 52 | padding-right : 10px; 53 | padding-top : 2px; 54 | padding-left : 10px; 55 | padding-bottom : 2px; 56 | margin-left : 0px; 57 | margin-right : 0px; 58 | margin-top : 2px; 59 | margin-bottom : 2px 60 | } 61 | TD.indexvalue { 62 | background-color: #eeeeff; 63 | font-style: italic; 64 | padding-right : 10px; 65 | padding-top : 2px; 66 | padding-left : 10px; 67 | padding-bottom : 2px; 68 | margin-left : 0px; 69 | margin-right : 0px; 70 | margin-top : 2px; 71 | margin-bottom : 2px 72 | } 73 | TR.memlist { 74 | background-color: #f0f0f0; 75 | } 76 | P.formulaDsp { text-align: center; } 77 | IMG.formulaDsp { } 78 | IMG.formulaInl { vertical-align: middle; } 79 | SPAN.keyword { color: #008000 } 80 | SPAN.keywordtype { color: #604020 } 81 | SPAN.keywordflow { color: #e08000 } 82 | SPAN.comment { color: #800000 } 83 | SPAN.preprocessor { color: #806020 } 84 | SPAN.stringliteral { color: #002080 } 85 | SPAN.charliteral { color: #008080 } 86 | .mdTable { 87 | border: 1px solid #868686; 88 | background-color: #f2f2ff; 89 | } 90 | .mdRow { 91 | padding: 8px 20px; 92 | } 93 | .mdescLeft { 94 | font-size: smaller; 95 | font-family: Arial, Helvetica, sans-serif; 96 | background-color: #FAFAFA; 97 | padding-left: 8px; 98 | border-top: 1px none #E0E0E0; 99 | border-right: 1px none #E0E0E0; 100 | border-bottom: 1px none #E0E0E0; 101 | border-left: 1px none #E0E0E0; 102 | margin: 0px; 103 | } 104 | .mdescRight { 105 | font-size: smaller; 106 | font-family: Arial, Helvetica, sans-serif; 107 | font-style: italic; 108 | background-color: #FAFAFA; 109 | padding-left: 4px; 110 | border-top: 1px none #E0E0E0; 111 | border-right: 1px none #E0E0E0; 112 | border-bottom: 1px none #E0E0E0; 113 | border-left: 1px none #E0E0E0; 114 | margin: 0px; 115 | padding-bottom: 0px; 116 | padding-right: 8px; 117 | } 118 | .memItemLeft { 119 | padding: 1px 0px 0px 8px; 120 | margin: 4px; 121 | border-top-width: 1px; 122 | border-right-width: 1px; 123 | border-bottom-width: 1px; 124 | border-left-width: 1px; 125 | border-top-style: solid; 126 | border-top-color: #E0E0E0; 127 | border-right-color: #E0E0E0; 128 | border-bottom-color: #E0E0E0; 129 | border-left-color: #E0E0E0; 130 | border-right-style: none; 131 | border-bottom-style: none; 132 | border-left-style: none; 133 | background-color: #FAFAFA; 134 | font-family: Geneva, Arial, Helvetica, sans-serif; 135 | font-size: 12px; 136 | } 137 | .memItemRight { 138 | padding: 1px 0px 0px 8px; 139 | margin: 4px; 140 | border-top-width: 1px; 141 | border-right-width: 1px; 142 | border-bottom-width: 1px; 143 | border-left-width: 1px; 144 | border-top-style: solid; 145 | border-top-color: #E0E0E0; 146 | border-right-color: #E0E0E0; 147 | border-bottom-color: #E0E0E0; 148 | border-left-color: #E0E0E0; 149 | border-right-style: none; 150 | border-bottom-style: none; 151 | border-left-style: none; 152 | background-color: #FAFAFA; 153 | font-family: Geneva, Arial, Helvetica, sans-serif; 154 | font-size: 13px; 155 | } 156 | .search { color: #0000ee; 157 | font-weight: bold; 158 | } 159 | FORM.search { 160 | margin-bottom: 0px; 161 | margin-top: 0px; 162 | } 163 | INPUT.search { font-size: 75%; 164 | color: #000080; 165 | font-weight: normal; 166 | background-color: #eeeeff; 167 | } 168 | TD.tiny { font-size: 75%; 169 | } 170 | -------------------------------------------------------------------------------- /doc/html/doxygen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marcusps/GraphSim/5dd7c0464e99bda29a5ccddfbabb6b2396f3e0fe/doc/html/doxygen.png -------------------------------------------------------------------------------- /doc/html/files.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | graphsim: File Index 4 | 5 | 6 | 7 |
Main Page | Namespace List | Class List | File List | Class Members | File Members
8 |

graphsim File List

Here is a list of all documented files with brief descriptions: 9 | 10 | 11 | 12 |
graphsim.h [code]
loccliff.h [code]
stabilizer.h [code]
13 |
Generated on Mon Apr 18 16:10:12 2005 for graphsim by 14 | 15 | doxygen 16 | 1.3.4
17 | 18 | 19 | -------------------------------------------------------------------------------- /doc/html/functions.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | graphsim: Compound Member Index 4 | 5 | 6 | 7 |
Main Page | Namespace List | Class List | File List | Class Members | File Members
8 |
All | Functions | Variables
9 | 10 |

11 | Here is a list of all documented class members with links to the class documentation for each member:

41 |
Generated on Mon Apr 18 16:10:12 2005 for graphsim by 42 | 43 | doxygen 44 | 1.3.4
45 | 46 | 47 | -------------------------------------------------------------------------------- /doc/html/functions_func.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | graphsim: Compound Member Index 4 | 5 | 6 | 7 |
Main Page | Namespace List | Class List | File List | Class Members | File Members
8 |
All | Functions | Variables
9 | 10 |

11 |

36 |
Generated on Mon Apr 18 16:10:12 2005 for graphsim by 37 | 38 | doxygen 39 | 1.3.4
40 | 41 | 42 | -------------------------------------------------------------------------------- /doc/html/functions_vars.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | graphsim: Compound Member Index 4 | 5 | 6 | 7 |
Main Page | Namespace List | Class List | File List | Class Members | File Members
8 |
All | Functions | Variables
9 | 10 |

11 |

18 |
Generated on Mon Apr 18 16:10:12 2005 for graphsim by 19 | 20 | doxygen 21 | 1.3.4
22 | 23 | 24 | -------------------------------------------------------------------------------- /doc/html/globals.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | graphsim: File Member Index 4 | 5 | 6 | 7 |
Main Page | Namespace List | Class List | File List | Class Members | File Members
8 |
All | Functions | Variables | Typedefs
9 | 10 |

11 | Here is a list of all documented file members with links to the documentation:

40 |
Generated on Mon Apr 18 16:10:12 2005 for graphsim by 41 | 42 | doxygen 43 | 1.3.4
44 | 45 | 46 | -------------------------------------------------------------------------------- /doc/html/globals_func.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | graphsim: File Member Index 4 | 5 | 6 | 7 |
Main Page | Namespace List | Class List | File List | Class Members | File Members
8 |
All | Functions | Variables | Typedefs
9 | 10 |

11 |

17 |
Generated on Mon Apr 18 16:10:12 2005 for graphsim by 18 | 19 | doxygen 20 | 1.3.4
21 | 22 | 23 | -------------------------------------------------------------------------------- /doc/html/globals_type.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | graphsim: File Member Index 4 | 5 | 6 | 7 |
Main Page | Namespace List | Class List | File List | Class Members | File Members
8 |
All | Functions | Variables | Typedefs
9 | 10 |

11 |

18 |
Generated on Mon Apr 18 16:10:12 2005 for graphsim by 19 | 20 | doxygen 21 | 1.3.4
22 | 23 | 24 | -------------------------------------------------------------------------------- /doc/html/globals_vars.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | graphsim: File Member Index 4 | 5 | 6 | 7 |
Main Page | Namespace List | Class List | File List | Class Members | File Members
8 |
All | Functions | Variables | Typedefs
9 | 10 |

11 |

31 |
Generated on Mon Apr 18 16:10:12 2005 for graphsim by 32 | 33 | doxygen 34 | 1.3.4
35 | 36 | 37 | -------------------------------------------------------------------------------- /doc/html/graphsim_8h.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | graphsim: graphsim.h File Reference 4 | 5 | 6 | 7 |
Main Page | Namespace List | Class List | File List | Class Members | File Members
8 |

graphsim.h File Reference

#include <iostream>
9 | #include <stdlib.h>
10 | #include <vector>
11 | #include <cassert>
12 | #include "loccliff.h"
13 | #include "stabilizer.h"
14 | 15 |

16 | Go to the source code of this file. 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 32 | 33 | 34 | 35 | 36 | 38 | 39 | 41 | 42 | 44 | 45 | 47 | 48 |

Namespaces

namespace  std

Classes

struct  ConnectionInfo
class  GraphRegister
 A quantum register. More...

struct  QubitVertex

Defines

31 | #define DBGOUT(a)

Typedefs

typedef unsigned long VertexIndex
typedef vector< QubitVertex
37 | >::iterator 
VertexIter
typedef hash_set< VertexIndex
40 | >::iterator 
VtxIdxIter
typedef vector< QubitVertex
43 | >::const_iterator 
VertexIterConst
typedef hash_set< VertexIndex
46 | >::const_iterator 
VtxIdxIterConst
49 |


Detailed Description

50 | This header file defines the main interface of graphsim.

51 | (c) Simon Anders, University of Innsbruck, 2005 released under GPL.

52 | Note: If you have trouble compiling this, please note: This file uses the "hash_set" template, which is an extension to the Standard C++ Library and the Standard Template Library, specified by SGI. Most C++ compilers have this template. For GNU C++, the header file <ext/hash_set> hasa to be included and hash_set has to be prefixed with namespace __gnu_cxx. If you use another compiler, you might have to change the include file and the namespace identifier.


Typedef Documentation

53 |

54 | 55 | 56 | 62 | 63 |
57 | 58 | 59 |
typedef unsigned long VertexIndex 60 |
61 |
64 | 65 | 66 | 69 | 73 | 74 |
67 |   68 | 70 | 71 |

72 | All vertices in a graph state are numbered beginning with 0. To specify auch an index, the type VertexIndex (which is just unsigned long) is always used

75 |

76 | 77 | 78 | 84 | 85 |
79 | 80 | 81 |
typedef vector<QubitVertex>::iterator VertexIter 82 |
83 |
86 | 87 | 88 | 91 | 95 | 96 |
89 |   90 | 92 | 93 |

94 | As we often iterate over sublists of GraphRegister::vertices, this iterator typedef is a handy abbreviation.

97 |

98 | 99 | 100 | 106 | 107 |
101 | 102 | 103 |
typedef vector<QubitVertex>::const_iterator VertexIterConst 104 |
105 |
108 | 109 | 110 | 113 | 117 | 118 |
111 |   112 | 114 | 115 |

116 | A constant version of VertexIter

119 |

120 | 121 | 122 | 128 | 129 |
123 | 124 | 125 |
typedef hash_set<VertexIndex>::iterator VtxIdxIter 126 |
127 |
130 | 131 | 132 | 135 | 139 | 140 |
133 |   134 | 136 | 137 |

138 | Another iterator, this one for the adjacency lists QubitVertex::neigbors, and subsets.

141 |

142 | 143 | 144 | 150 | 151 |
145 | 146 | 147 |
typedef hash_set<VertexIndex>::const_iterator VtxIdxIterConst 148 |
149 |
152 | 153 | 154 | 157 | 161 | 162 |
155 |   156 | 158 | 159 |

160 | A constant version of VtxIdxIter

163 |


Generated on Mon Apr 18 16:10:12 2005 for graphsim by 164 | 165 | doxygen 166 | 1.3.4
167 | 168 | 169 | -------------------------------------------------------------------------------- /doc/html/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | graphsim: Main Page 4 | 5 | 6 | 7 |
Main Page | Namespace List | Class List | File List | Class Members | File Members
8 |

graphsim Documentation

9 |

10 | This is 'graphsim', a simulator for stabilizer quantum cuircuits using the graph state formalism.

11 | graphsim version 0.10, dated 2005-Jan-27

12 | (c) Simon Anders (sanders@fs.tum.de), University of Innsbruck

13 | See the article

14 | S. Anders, H. J. Briegel: Fast simulation of Stabilizer Circuits using a Graph States Formalism quant-ph/0504117

15 | for a description of this software.

16 | ----

17 | This file is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version.

18 | This file is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

19 | You should have received a copy of the GNU General Public License along with this file; see the file COPYING. If not, browse to http://www.fsf.org/licenses/gpl.html


Generated on Mon Apr 18 16:10:12 2005 for graphsim by 20 | 21 | doxygen 22 | 1.3.4
23 | 24 | 25 | -------------------------------------------------------------------------------- /doc/html/namespaceloccliff__tables.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | graphsim: loccliff_tables Namespace Reference 4 | 5 | 6 | 7 |
Main Page | Namespace List | Class List | File List | Class Members | File Members
8 |

loccliff_tables Namespace Reference

Inline functions and tables needed by them. Consider them as private. 9 | More... 10 |

11 | 12 | 13 | 14 | 15 | 16 | 18 | 19 | 20 | 21 | 22 | 23 |

Variables

const unsigned short meas_conj_tbl [3][num_LocCliffOps]
17 | const unsigned short lco_mult_tbl [num_LocCliffOps][num_LocCliffOps]
const short adj_tbl [24]
const short phase_tbl [4][4]
24 |


Detailed Description

25 | Inline functions and tables needed by them. Consider them as private.

Variable Documentation

26 |

27 | 28 | 29 | 35 | 36 |
30 | 31 | 32 |
const short loccliff_tables::adj_tbl[24] 33 |
34 |
37 | 38 | 39 | 42 | 53 | 54 |
40 |   41 | 43 | 44 |

45 | Initial value:

 46 |    { 0,  1,  2,  3,
 47 |      4,  6,  5,  7,
 48 |      8, 11, 10,  9,
 49 |     12, 13, 15, 14,
 50 |     20, 22, 23, 21,
 51 |     16, 19, 17, 18}
 52 | 
55 |

56 | 57 | 58 | 64 | 65 |
59 | 60 | 61 |
const unsigned short loccliff_tables::meas_conj_tbl[3][num_LocCliffOps] 62 |
63 |
66 | 67 | 68 | 71 | 79 | 80 |
69 |   70 | 72 | 73 |

74 | Initial value:

 
 75 | {{1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3}, 
 76 |  {2, 2, 2, 2, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1}, 
 77 |  {3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 2, 2, 2, 2}}
 78 | 
81 |

82 | 83 | 84 | 90 | 91 |
85 | 86 | 87 |
const short loccliff_tables::phase_tbl[4][4] 88 |
89 |
92 | 93 | 94 | 97 | 106 | 107 |
95 |   96 | 98 | 99 |

100 | Initial value:

101 |   {{0, 0, 0, 0},
102 |    {0, 0, 1, 3},
103 |    {0, 3, 0, 1},
104 |    {0, 1, 3, 0}}
105 | 
108 |


Generated on Mon Apr 18 16:10:12 2005 for graphsim by 109 | 110 | doxygen 111 | 1.3.4
112 | 113 | 114 | -------------------------------------------------------------------------------- /doc/html/namespaces.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | graphsim: Namespace Index 4 | 5 | 6 | 7 |
Main Page | Namespace List | Class List | File List | Class Members | File Members
8 |

graphsim Namespace List

Here is a list of all documented namespaces with brief descriptions: 9 | 10 |
loccliff_tablesInline functions and tables needed by them. Consider them as private
11 |
Generated on Mon Apr 18 16:10:12 2005 for graphsim by 12 | 13 | doxygen 14 | 1.3.4
15 | 16 | 17 | -------------------------------------------------------------------------------- /doc/html/stabilizer_8h-source.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | graphsim: stabilizer.h Source File 4 | 5 | 6 | 7 |
Main Page | Namespace List | Class List | File List | Class Members | File Members
8 |

stabilizer.h

Go to the documentation of this file.
00001 // stabilizer.h
 9 | 00002 
10 | 00006 #ifndef STABILIZER_H
11 | 00007 #define STABILIZER_H
12 | 00008 
13 | 00009 #include <iostream>
14 | 00010 #include <vector>
15 | 00011 #include <cassert>
16 | 00012 #include "loccliff.h"
17 | 00013 
18 | 00014 #include <ext/hash_set>
19 | 00015 #ifndef SWIG
20 | 00016 using __gnu_cxx::hash_set;
21 | 00017 #endif
22 | 00018 // See note at top of file graphsim.h in case of problems compiling
23 | 00019 // the preceding lines.
24 | 00020 
25 | 00021 
26 | 00022 #ifdef SWIG
27 | 00023 struct QState;
28 | 00024 #else
29 | 00025 extern "C" {
30 | 00026    // The following struct declaration is quoted in verbatim from Scott
31 | 00027    // Aaronson's CHP program. (Scott, I hope, you don't mind.) It is used
32 | 00028    // here to implement the functionality of comparing a stabilizer state
33 | 00029    // in CHP with a state in graphsim. This is used to compare the action
34 | 00030    // of the two programs to ensure correctness.
35 | 00031    struct QState
36 | 00032    {
37 | 00033       long n;         // # of qubits
38 | 00034       unsigned long **x; // (2n+1)*n matrix for stabilizer/destabilizer x bits (there's one "scratch row" at
39 | 00035       unsigned long **z; // (2n+1)*n matrix for z bits                                                 the bottom)
40 | 00036       int *r;         // Phase bits: 0 for +1, 1 for i, 2 for -1, 3 for -i.  Normally either 0 or 2.
41 | 00037       unsigned long pw[32]; // pw[i] = 2^i
42 | 00038       long over32; // floor(n/8)+1
43 | 00039    }; 
44 | 00040 }
45 | 00041 #endif //SWIG
46 | 00042 
47 | 00043 //forward declarations, definition in graphsim.h:
48 | 00044 
49 | 00045 typedef unsigned long VertexIndex;
50 | 00046 struct QubitVertex;
51 | 00047 class GraphRegister;
52 | 00048 
53 | 00050 /* This class is used at the moment only by GraphRegister::print_stabilizer and for
54 | 00051 the compare method (when comparing with CHP). */
55 | 00052 struct Stabilizer {
56 | 00053    VertexIndex numQubits;
57 | 00054    vector<vector<LocCliffOp> > paulis;
58 | 00055    vector<RightPhase> rowsigns;
59 | 00056    vector<VertexIndex> vtxidx;
60 | 00057    Stabilizer (const VertexIndex numQubits_);
61 | 00058    Stabilizer (const GraphRegister& gr, const hash_set<VertexIndex>& qubits);
62 | 00059    Stabilizer (QState * qs);
63 | 00060    void add_row (unsigned target, unsigned addend);
64 | 00061    void conjugate (unsigned row, unsigned col, const LocCliffOp trans);
65 | 00062    void conjugate_column (unsigned col, const LocCliffOp trans);
66 | 00063    void print (ostream &os = cout) const;
67 | 00064    bool compare (const Stabilizer &diag);
68 | 00065 };
69 | 00066 
70 | 00067 #endif //STABILIZER_H
71 | 

Generated on Mon Apr 18 16:10:12 2005 for graphsim by 72 | 73 | doxygen 74 | 1.3.4
75 | 76 | 77 | -------------------------------------------------------------------------------- /doc/html/stabilizer_8h.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | graphsim: stabilizer.h File Reference 4 | 5 | 6 | 7 |
Main Page | Namespace List | Class List | File List | Class Members | File Members
8 |

stabilizer.h File Reference

#include <iostream>
9 | #include <vector>
10 | #include <cassert>
11 | #include "loccliff.h"
12 | #include <ext/hash_set>
13 | 14 |

15 | Go to the source code of this file. 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 26 | 27 |

Classes

struct  QState
struct  Stabilizer
 A stabilizer describing a quantum state. More...


Typedefs

25 | typedef unsigned long VertexIndex
28 |


Detailed Description

29 | defines the Stabilizer class
Generated on Mon Apr 18 16:10:12 2005 for graphsim by 30 | 31 | doxygen 32 | 1.3.4
33 | 34 | 35 | -------------------------------------------------------------------------------- /doc/html/structConnectionInfo-members.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | graphsim: Member List 4 | 5 | 6 | 7 |
Main Page | Namespace List | Class List | File List | Class Members | File Members
8 |

ConnectionInfo Member List

This is the complete list of members for ConnectionInfo, including all inherited members. 9 | 10 | 11 | 12 |
non1 (defined in ConnectionInfo)ConnectionInfo
non2 (defined in ConnectionInfo)ConnectionInfo
wasEdge (defined in ConnectionInfo)ConnectionInfo

Generated on Mon Apr 18 16:10:12 2005 for graphsim by 13 | 14 | doxygen 15 | 1.3.4
16 | 17 | 18 | -------------------------------------------------------------------------------- /doc/html/structConnectionInfo.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | graphsim: ConnectionInfo struct Reference 4 | 5 | 6 | 7 |
Main Page | Namespace List | Class List | File List | Class Members | File Members
8 |

ConnectionInfo Struct Reference

#include <graphsim.h> 9 |

10 | List of all members. 11 | 12 | 13 | 15 | 16 | 18 | 19 | 21 | 22 |

Public Attributes

14 | bool wasEdge
17 | bool non1
20 | bool non2
23 |


Detailed Description

24 | This structure is only for internal use for the cphase functions. 25 |

26 |


The documentation for this struct was generated from the following file: 28 |
Generated on Mon Apr 18 16:10:12 2005 for graphsim by 29 | 30 | doxygen 31 | 1.3.4
32 | 33 | 34 | -------------------------------------------------------------------------------- /doc/html/structEdge-members.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | graphsim: Member List 4 | 5 | 6 | 7 |
Main Page | Namespace List | Class List | File List | Class Members | File Members
8 |

Edge Member List

This is the complete list of members for Edge, including all inherited members. 9 | 10 |
Edge(const VertexIndex a, const VertexIndex b) (defined in Edge)Edge [inline]

Generated on Mon Apr 18 16:10:12 2005 for graphsim by 11 | 12 | doxygen 13 | 1.3.4
14 | 15 | 16 | -------------------------------------------------------------------------------- /doc/html/structEdge.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | graphsim: Edge struct Reference 4 | 5 | 6 | 7 |
Main Page | Namespace List | Class List | File List | Class Members | File Members
8 |

Edge Struct Reference

This structure is needed only by toggle_edges. 9 | More... 10 |

11 | List of all members. 12 | 13 | 14 | 16 | 17 |

Public Member Functions

15 |  Edge (const VertexIndex a, const VertexIndex b)
18 |


Detailed Description

19 | This structure is needed only by toggle_edges. 20 |

21 |


The documentation for this struct was generated from the following file: 23 |
Generated on Mon Apr 18 16:10:12 2005 for graphsim by 24 | 25 | doxygen 26 | 1.3.4
27 | 28 | 29 | -------------------------------------------------------------------------------- /doc/html/structLocCliffOp-members.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | graphsim: Member List 4 | 5 | 6 | 7 |
Main Page | Namespace List | Class List | File List | Class Members | File Members
8 |

LocCliffOp Member List

This is the complete list of members for LocCliffOp, including all inherited members. 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 |
conjugate(const LocCliffOp trans)LocCliffOp
get_matrix(void) const (defined in LocCliffOp)LocCliffOp
get_name(void) const LocCliffOp
herm_adjoint(void) const LocCliffOp [inline]
is_diagonal(void) const LocCliffOp [inline]
isXY(void) const LocCliffOp [inline]
LocCliffOp(unsigned short int op_)LocCliffOp [inline]
LocCliffOp(unsigned short int signsymb, unsigned short int permsymb)LocCliffOp [inline]
mult_phase(LocCliffOp op1, LocCliffOp op2)LocCliffOp [inline, static]
opLocCliffOp

Generated on Mon Apr 18 16:10:12 2005 for graphsim by 20 | 21 | doxygen 22 | 1.3.4
23 | 24 | 25 | -------------------------------------------------------------------------------- /doc/html/structLocCliffOp.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | graphsim: LocCliffOp struct Reference 4 | 5 | 6 | 7 |
Main Page | Namespace List | Class List | File List | Class Members | File Members
8 |

LocCliffOp Struct Reference

An operator in the local Clifford group. 9 | More... 10 |

11 | #include <loccliff.h> 12 |

13 | List of all members. 14 | 15 | 16 | 18 | 19 | 20 | 21 | 22 | 23 | 25 | 26 | 27 | 28 | 29 | 30 | 32 | 33 | 34 | 36 | 37 | 38 | 40 | 41 | 42 | 44 | 45 | 46 | 48 | 49 | 50 | 51 | 52 | 53 |

Public Member Functions

17 |  LocCliffOp (unsigned short int op_)
 constructor, takes an integer in 0..23.

 LocCliffOp (unsigned short int signsymb, unsigned short int permsymb)
 constructor, takes a sign symbol in 0..3 (for I, X, Y, Z) and a

24 | string get_name (void) const
 returns something like e.g. "YC" for Hadamard=Y^C

RightPhase conjugate (const LocCliffOp trans)
 replaces op by trans * op * trans^dagger and returns a phase,

31 | LocCliffOp herm_adjoint (void) const
 returns the Hermitian adjoint of op

35 | bool isXY (void) const
 returns True if op is XA or YA.

39 | bool is_diagonal (void) const
 returns True if op is an operator diagonal in the computational basis

43 | RightMatrix get_matrix (void) const

Static Public Member Functions

47 | RightPhase mult_phase (LocCliffOp op1, LocCliffOp op2)
 returns the phase of the multiplication of op1 * op2


Public Attributes

unsigned short op
54 |


Detailed Description

55 | An operator in the local Clifford group. 56 |

57 |


Constructor & Destructor Documentation

58 |

59 | 60 | 61 | 83 | 84 |
62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 |
LocCliffOp::LocCliffOp unsigned short int  signsymb,
unsigned short int  permsymb
[inline]
82 |
85 | 86 | 87 | 90 | 96 | 97 |
88 |   89 | 91 | 92 |

93 | constructor, takes a sign symbol in 0..3 (for I, X, Y, Z) and a 94 |

95 | permutation symbol 0..5 (for A, B, ..., F)

98 |


Member Function Documentation

99 |

100 | 101 | 102 | 115 | 116 |
103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 |
RightPhase LocCliffOp::conjugate const LocCliffOp  trans  ) 
114 |
117 | 118 | 119 | 122 | 128 | 129 |
120 |   121 | 123 | 124 |

125 | replaces op by trans * op * trans^dagger and returns a phase, 126 |

127 | either +1 or -1 (as RightPhase(0) or RightPhase(2))

130 |


Member Data Documentation

131 |

132 | 133 | 134 | 140 | 141 |
135 | 136 | 137 |
unsigned short LocCliffOp::op 138 |
139 |
142 | 143 | 144 | 147 | 151 | 152 |
145 |   146 | 148 | 149 |

150 | The field 'op' identifies the operator. 0 is identity I, 1 is Pauli X, 2 is Pauli Y, 3 is Pauli Z, 4 is I^B, 5 is I^C etc.

153 |


The documentation for this struct was generated from the following files: 155 |
Generated on Mon Apr 18 16:10:12 2005 for graphsim by 156 | 157 | doxygen 158 | 1.3.4
159 | 160 | 161 | -------------------------------------------------------------------------------- /doc/html/structQubitVertex-members.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | graphsim: Member List 4 | 5 | 6 | 7 |
Main Page | Namespace List | Class List | File List | Class Members | File Members
8 |

QubitVertex Member List

This is the complete list of members for QubitVertex, including all inherited members. 9 | 10 | 11 | 12 |
byprodQubitVertex
neighborsQubitVertex
QubitVertex(void)QubitVertex [inline]

Generated on Mon Apr 18 16:10:12 2005 for graphsim by 13 | 14 | doxygen 15 | 1.3.4
16 | 17 | 18 | -------------------------------------------------------------------------------- /doc/html/structQubitVertex.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | graphsim: QubitVertex struct Reference 4 | 5 | 6 | 7 |
Main Page | Namespace List | Class List | File List | Class Members | File Members
8 |

QubitVertex Struct Reference

#include <graphsim.h> 9 |

10 | List of all members. 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |

Public Member Functions

 QubitVertex (void)

Public Attributes

LocCliffOp byprod
hash_set< VertexIndexneighbors
21 |


Detailed Description

22 | A GraphRegister object maintains a list of its vertices (qubits), each described by an object of the class QubitVertex described here. 23 |

24 |


Constructor & Destructor Documentation

25 |

26 | 27 | 28 | 41 | 42 |
29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 |
QubitVertex::QubitVertex void   )  [inline]
40 |
43 | 44 | 45 | 48 | 52 | 53 |
46 |   47 | 49 | 50 |

51 | Upon construction, a qubit vertex is initialised with the Hadamard operation as VOp, and with wmpty neighbor list. This makes it represent a |0>.

54 |


Member Data Documentation

55 |

56 | 57 | 58 | 64 | 65 |
59 | 60 | 61 |
LocCliffOp QubitVertex::byprod 62 |
63 |
66 | 67 | 68 | 71 | 75 | 76 |
69 |   70 | 72 | 73 |

74 | byprod is the vertex operator (VOp) associated with the qubit (the name stems from the term 'byproduct operator' used for the similar concept in the one-way quantum computer.

77 |

78 | 79 | 80 | 86 | 87 |
81 | 82 | 83 |
hash_set<VertexIndex> QubitVertex::neighbors 84 |
85 |
88 | 89 | 90 | 93 | 97 | 98 |
91 |   92 | 94 | 95 |

96 | neigbors is the adjacency list for this vertex

99 |


The documentation for this struct was generated from the following file: 101 |
Generated on Mon Apr 18 16:10:12 2005 for graphsim by 102 | 103 | doxygen 104 | 1.3.4
105 | 106 | 107 | -------------------------------------------------------------------------------- /doc/html/structRightPhase-members.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | graphsim: Member List 4 | 5 | 6 | 7 |
Main Page | Namespace List | Class List | File List | Class Members | File Members
8 |

RightPhase Member List

This is the complete list of members for RightPhase, including all inherited members. 9 | 10 | 11 | 12 | 13 |
get_name(void) const RightPhase
phRightPhase
RightPhase(void)RightPhase [inline]
RightPhase(unsigned short ph_)RightPhase [inline]

Generated on Mon Apr 18 16:10:12 2005 for graphsim by 14 | 15 | doxygen 16 | 1.3.4
17 | 18 | 19 | -------------------------------------------------------------------------------- /doc/html/structRightPhase.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | graphsim: RightPhase struct Reference 4 | 5 | 6 | 7 |
Main Page | Namespace List | Class List | File List | Class Members | File Members
8 |

RightPhase Struct Reference

A phase, which is 0, 90, 180, or 270 degrees. 9 | More... 10 |

11 | #include <loccliff.h> 12 |

13 | List of all members. 14 | 15 | 16 | 18 | 19 | 20 | 22 | 23 | 24 | 26 | 27 | 28 | 29 | 30 | 31 |

Public Member Functions

17 |  RightPhase (void)
 initializes as 0 degrees

21 |  RightPhase (unsigned short ph_)
 takes 0..3 as argument and writes it to ph

25 | string get_name (void) const
 returns " +", " i", " -", or "-i"


Public Attributes

unsigned short ph
32 |


Detailed Description

33 | A phase, which is 0, 90, 180, or 270 degrees. 34 |

35 |


Member Data Documentation

36 |

37 | 38 | 39 | 45 | 46 |
40 | 41 | 42 |
unsigned short RightPhase::ph 43 |
44 |
47 | 48 | 49 | 52 | 56 | 57 |
50 |   51 | 53 | 54 |

55 | to be read modulo 4, i.e. & 0x03 The field 'ph' indicated the angle with a value 0, 1, 2, or 3, corresponding to 0, 90, 180, or 270 degrees Do not rely on ph<3, always read it out anded with 0x03.

58 |


The documentation for this struct was generated from the following files: 60 |
Generated on Mon Apr 18 16:10:12 2005 for graphsim by 61 | 62 | doxygen 63 | 1.3.4
64 | 65 | 66 | -------------------------------------------------------------------------------- /doc/html/structStabilizer-members.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | graphsim: Member List 4 | 5 | 6 | 7 |
Main Page | Namespace List | Class List | File List | Class Members | File Members
8 |

Stabilizer Member List

This is the complete list of members for Stabilizer, including all inherited members. 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 |
add_row(unsigned target, unsigned addend) (defined in Stabilizer)Stabilizer
compare(const Stabilizer &diag) (defined in Stabilizer)Stabilizer
conjugate(unsigned row, unsigned col, const LocCliffOp trans) (defined in Stabilizer)Stabilizer
conjugate_column(unsigned col, const LocCliffOp trans) (defined in Stabilizer)Stabilizer
numQubits (defined in Stabilizer)Stabilizer
paulis (defined in Stabilizer)Stabilizer
print(ostream &os=cout) const (defined in Stabilizer)Stabilizer
rowsigns (defined in Stabilizer)Stabilizer
Stabilizer(const VertexIndex numQubits_) (defined in Stabilizer)Stabilizer
Stabilizer(const GraphRegister &gr, const hash_set< VertexIndex > &qubits) (defined in Stabilizer)Stabilizer
Stabilizer(QState *qs) (defined in Stabilizer)Stabilizer
vtxidx (defined in Stabilizer)Stabilizer

Generated on Mon Apr 18 16:10:12 2005 for graphsim by 22 | 23 | doxygen 24 | 1.3.4
25 | 26 | 27 | -------------------------------------------------------------------------------- /doc/html/structStabilizer.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | graphsim: Stabilizer struct Reference 4 | 5 | 6 | 7 |
Main Page | Namespace List | Class List | File List | Class Members | File Members
8 |

Stabilizer Struct Reference

A stabilizer describing a quantum state. 9 | More... 10 |

11 | #include <stabilizer.h> 12 |

13 | List of all members. 14 | 15 | 16 | 18 | 19 | 21 | 22 | 24 | 25 | 27 | 28 | 30 | 31 | 33 | 34 | 36 | 37 | 39 | 40 | 41 | 43 | 44 | 46 | 47 | 49 | 50 | 52 | 53 |

Public Member Functions

17 |  Stabilizer (const VertexIndex numQubits_)
20 |  Stabilizer (const GraphRegister &gr, const hash_set< VertexIndex > &qubits)
23 |  Stabilizer (QState *qs)
26 | void add_row (unsigned target, unsigned addend)
29 | void conjugate (unsigned row, unsigned col, const LocCliffOp trans)
32 | void conjugate_column (unsigned col, const LocCliffOp trans)
35 | void print (ostream &os=cout) const
38 | bool compare (const Stabilizer &diag)

Public Attributes

42 | VertexIndex numQubits
45 | vector< vector< LocCliffOp > > paulis
48 | vector< RightPhaserowsigns
51 | vector< VertexIndexvtxidx
54 |


Detailed Description

55 | A stabilizer describing a quantum state. 56 |

57 |


The documentation for this struct was generated from the following files: 59 |
Generated on Mon Apr 18 16:10:12 2005 for graphsim by 60 | 61 | doxygen 62 | 1.3.4
63 | 64 | 65 | -------------------------------------------------------------------------------- /doc/html/structedge__hash-members.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | graphsim: Member List 4 | 5 | 6 | 7 |
Main Page | Namespace List | Class List | File List | Class Members | File Members
8 |

edge_hash Member List

This is the complete list of members for edge_hash, including all inherited members. 9 | 10 |
operator()(const Edge &e) const (defined in edge_hash)edge_hash [inline]

Generated on Mon Apr 18 16:10:12 2005 for graphsim by 11 | 12 | doxygen 13 | 1.3.4
14 | 15 | 16 | -------------------------------------------------------------------------------- /doc/html/structedge__hash.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | graphsim: edge_hash struct Reference 4 | 5 | 6 | 7 |
Main Page | Namespace List | Class List | File List | Class Members | File Members
8 |

edge_hash Struct Reference

This structure is needed only by toggle_edges. 9 | More... 10 |

11 | List of all members. 12 | 13 | 14 | 16 | 17 |

Public Member Functions

15 | size_t operator() (const Edge &e) const
18 |


Detailed Description

19 | This structure is needed only by toggle_edges. 20 |

21 |


The documentation for this struct was generated from the following file: 23 |
Generated on Mon Apr 18 16:10:12 2005 for graphsim by 24 | 25 | doxygen 26 | 1.3.4
27 | 28 | 29 | -------------------------------------------------------------------------------- /doc/latex/Makefile: -------------------------------------------------------------------------------- 1 | all: refman.dvi 2 | 3 | ps: refman.ps 4 | 5 | pdf: refman.pdf 6 | 7 | ps_2on1: refman_2on1.ps 8 | 9 | pdf_2on1: refman_2on1.pdf 10 | 11 | refman.ps: refman.dvi 12 | dvips -o refman.ps refman.dvi 13 | 14 | refman.pdf: refman.ps 15 | ps2pdf refman.ps refman.pdf 16 | 17 | refman.dvi: refman.tex doxygen.sty 18 | echo "Running latex..." 19 | latex refman.tex 20 | echo "Running makeindex..." 21 | makeindex refman.idx 22 | echo "Rerunning latex...." 23 | latex refman.tex 24 | latex_count=5 ; \ 25 | while egrep -s 'Rerun (LaTeX|to get cross-references right)' refman.log && [ $$latex_count -gt 0 ] ;\ 26 | do \ 27 | echo "Rerunning latex...." ;\ 28 | latex refman.tex ;\ 29 | latex_count=`expr $$latex_count - 1` ;\ 30 | done 31 | 32 | refman_2on1.ps: refman.ps 33 | psnup -2 refman.ps >refman_2on1.ps 34 | 35 | refman_2on1.pdf: refman_2on1.ps 36 | ps2pdf refman_2on1.ps refman_2on1.pdf 37 | 38 | clean: 39 | rm -f *.ps *.dvi *.aux *.toc *.idx *.ind *.ilg *.log *.out *.pdf 40 | -------------------------------------------------------------------------------- /doc/latex/annotated.tex: -------------------------------------------------------------------------------- 1 | \section{graphsim Class List} 2 | Here are the classes, structs, unions and interfaces with brief descriptions:\begin{CompactList} 3 | \item\contentsline{section}{{\bf Connection\-Info} }{\pageref{structConnectionInfo}}{} 4 | \item\contentsline{section}{{\bf Edge} (This structure is needed only by toggle\_\-edges )}{\pageref{structEdge}}{} 5 | \item\contentsline{section}{{\bf edge\_\-hash} (This structure is needed only by toggle\_\-edges )}{\pageref{structedge__hash}}{} 6 | \item\contentsline{section}{{\bf Graph\-Register} (A quantum register )}{\pageref{classGraphRegister}}{} 7 | \item\contentsline{section}{{\bf Loc\-Cliff\-Op} (An operator in the local Clifford group )}{\pageref{structLocCliffOp}}{} 8 | \item\contentsline{section}{{\bf Qubit\-Vertex} }{\pageref{structQubitVertex}}{} 9 | \item\contentsline{section}{{\bf Right\-Phase} (A phase, which is 0, 90, 180, or 270 degrees )}{\pageref{structRightPhase}}{} 10 | \item\contentsline{section}{{\bf Stabilizer} (A stabilizer describing a quantum state )}{\pageref{structStabilizer}}{} 11 | \end{CompactList} 12 | -------------------------------------------------------------------------------- /doc/latex/classGraphRegister.tex: -------------------------------------------------------------------------------- 1 | \section{Graph\-Register Class Reference} 2 | \label{classGraphRegister}\index{GraphRegister@{GraphRegister}} 3 | A quantum register. 4 | 5 | 6 | {\tt \#include $<$graphsim.h$>$} 7 | 8 | \subsection*{Public Member Functions} 9 | \begin{CompactItemize} 10 | \item 11 | {\bf Graph\-Register} ({\bf Vertex\-Index} num\-Qubits, int randomize=-1) 12 | \begin{CompactList}\small\item\em Instantiate a quantum register with 'num\-Qubits' qubits, initally all in state $|$0$>$. \item\end{CompactList}\item 13 | {\bf Graph\-Register} ({\bf Graph\-Register} \&gr) 14 | \begin{CompactList}\small\item\em Copy constructor. \item\end{CompactList}\item 15 | void {\bf local\_\-op} ({\bf Vertex\-Index} v, {\bf Loc\-Cliff\-Op} o) 16 | \item 17 | void {\bf hadamard} ({\bf Vertex\-Index} v) 18 | \item 19 | void {\bf phaserot} ({\bf Vertex\-Index} v) 20 | \item 21 | void {\bf bitflip} ({\bf Vertex\-Index} v) 22 | \item 23 | void {\bf phaseflip} ({\bf Vertex\-Index} v) 24 | \item 25 | void {\bf cphase} ({\bf Vertex\-Index} v1, {\bf Vertex\-Index} v2)\label{classGraphRegister_a8} 26 | 27 | \begin{CompactList}\small\item\em Do a conditional phase gate between the two qubits. \item\end{CompactList}\item 28 | void {\bf cnot} ({\bf Vertex\-Index} vc, {\bf Vertex\-Index} vt)\label{classGraphRegister_a9} 29 | 30 | \begin{CompactList}\small\item\em Do a controlled not gate between the vertices vc (control) and vt (target). \item\end{CompactList}\item 31 | int {\bf measure} ({\bf Vertex\-Index} v, {\bf Loc\-Cliff\-Op} basis={\bf lco\_\-Z}, bool $\ast$determined=NULL, int force=-1)\label{classGraphRegister_a10} 32 | 33 | \begin{CompactList}\small\item\em Measure qubit v in basis 'basis'. \item\end{CompactList}\item 34 | {\bf Stabilizer} \& {\bf get\_\-full\_\-stabilizer} (void) const 35 | \begin{CompactList}\small\item\em Create the {\bf Stabilizer}{\rm (p.\,\pageref{structStabilizer})} of the state. \item\end{CompactList}\item 36 | void {\bf invert\_\-neighborhood} ({\bf Vertex\-Index} v)\label{classGraphRegister_a12} 37 | 38 | \begin{CompactList}\small\item\em Do a neighborhood inversion (i.e. local complementation) about vertex v. \item\end{CompactList}\item 39 | void {\bf print\_\-adj\_\-list} (ostream \&os=cout) const 40 | \begin{CompactList}\small\item\em Prints out the description of the current state. \item\end{CompactList}\item 41 | void {\bf print\_\-adj\_\-list\_\-line} (ostream \&os, {\bf Vertex\-Index} i) const \label{classGraphRegister_a14} 42 | 43 | \begin{CompactList}\small\item\em Prints the line for Vertex i in the adjacency list representation of the state. \item\end{CompactList}\item 44 | void {\bf print\_\-stabilizer} (ostream \&os=cout) const \label{classGraphRegister_a15} 45 | 46 | \begin{CompactList}\small\item\em Print the current state in stabilizer representation. \item\end{CompactList}\end{CompactItemize} 47 | \subsection*{Public Attributes} 48 | \begin{CompactItemize} 49 | \item 50 | vector$<$ {\bf Qubit\-Vertex} $>$ {\bf vertices} 51 | \end{CompactItemize} 52 | 53 | 54 | \subsection{Detailed Description} 55 | A quantum register. 56 | 57 | Graph\-Register is the central class of graphsim. It represents a register of qubits that can be entangled with each other. It offers functions to initialize the register, let gates operate on the qubits, do measurements and print out the state. 58 | 59 | 60 | 61 | \subsection{Constructor \& Destructor Documentation} 62 | \index{GraphRegister@{Graph\-Register}!GraphRegister@{GraphRegister}} 63 | \index{GraphRegister@{GraphRegister}!GraphRegister@{Graph\-Register}} 64 | \subsubsection{\setlength{\rightskip}{0pt plus 5cm}Graph\-Register::Graph\-Register ({\bf Vertex\-Index} {\em num\-Qubits}, int {\em randomize} = -1)}\label{classGraphRegister_a0} 65 | 66 | 67 | Instantiate a quantum register with 'num\-Qubits' qubits, initally all in state $|$0$>$. 68 | 69 | If randomize $>$ -1 the RNG will be seeded with the current time plus the value of randomize. (Otherwise, it is not seeded.) That the value of randomize is added to the seed is useful in parallel processing settings where you want to ensure different seeds. (If you call this from Python, remember, that Python's RNG is not seeded.) \index{GraphRegister@{Graph\-Register}!GraphRegister@{GraphRegister}} 70 | \index{GraphRegister@{GraphRegister}!GraphRegister@{Graph\-Register}} 71 | \subsubsection{\setlength{\rightskip}{0pt plus 5cm}Graph\-Register::Graph\-Register ({\bf Graph\-Register} \& {\em gr})}\label{classGraphRegister_a1} 72 | 73 | 74 | Copy constructor. 75 | 76 | Clones a register 77 | 78 | \subsection{Member Function Documentation} 79 | \index{GraphRegister@{Graph\-Register}!bitflip@{bitflip}} 80 | \index{bitflip@{bitflip}!GraphRegister@{Graph\-Register}} 81 | \subsubsection{\setlength{\rightskip}{0pt plus 5cm}void Graph\-Register::bitflip ({\bf Vertex\-Index} {\em v})\hspace{0.3cm}{\tt [inline]}}\label{classGraphRegister_a6} 82 | 83 | 84 | Apply a bitflip gate (i.e. a Pauli X) on vertex v \index{GraphRegister@{Graph\-Register}!get_full_stabilizer@{get\_\-full\_\-stabilizer}} 85 | \index{get_full_stabilizer@{get\_\-full\_\-stabilizer}!GraphRegister@{Graph\-Register}} 86 | \subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf Stabilizer} \& Graph\-Register::get\_\-full\_\-stabilizer (void) const}\label{classGraphRegister_a11} 87 | 88 | 89 | Create the {\bf Stabilizer}{\rm (p.\,\pageref{structStabilizer})} of the state. 90 | 91 | This is useful to print out the stabilizer (or to compare with CHP). You can also use print\_\-stabilizer. \index{GraphRegister@{Graph\-Register}!hadamard@{hadamard}} 92 | \index{hadamard@{hadamard}!GraphRegister@{Graph\-Register}} 93 | \subsubsection{\setlength{\rightskip}{0pt plus 5cm}void Graph\-Register::hadamard ({\bf Vertex\-Index} {\em v})\hspace{0.3cm}{\tt [inline]}}\label{classGraphRegister_a4} 94 | 95 | 96 | Apply a Hadamard gate on vertex v \index{GraphRegister@{Graph\-Register}!local_op@{local\_\-op}} 97 | \index{local_op@{local\_\-op}!GraphRegister@{Graph\-Register}} 98 | \subsubsection{\setlength{\rightskip}{0pt plus 5cm}void Graph\-Register::local\_\-op ({\bf Vertex\-Index} {\em v}, {\bf Loc\-Cliff\-Op} {\em o})\hspace{0.3cm}{\tt [inline]}}\label{classGraphRegister_a3} 99 | 100 | 101 | Apply the local (i.e. single-qubit) operation o on vertex v. \index{GraphRegister@{Graph\-Register}!phaseflip@{phaseflip}} 102 | \index{phaseflip@{phaseflip}!GraphRegister@{Graph\-Register}} 103 | \subsubsection{\setlength{\rightskip}{0pt plus 5cm}void Graph\-Register::phaseflip ({\bf Vertex\-Index} {\em v})\hspace{0.3cm}{\tt [inline]}}\label{classGraphRegister_a7} 104 | 105 | 106 | Apply a phaseflip gate (i.e. a Pauli Z) on vertex v \index{GraphRegister@{Graph\-Register}!phaserot@{phaserot}} 107 | \index{phaserot@{phaserot}!GraphRegister@{Graph\-Register}} 108 | \subsubsection{\setlength{\rightskip}{0pt plus 5cm}void Graph\-Register::phaserot ({\bf Vertex\-Index} {\em v})\hspace{0.3cm}{\tt [inline]}}\label{classGraphRegister_a5} 109 | 110 | 111 | Apply a phaserot gate on vertex v. Phaserot means the gate S = $|$0$>$$<$0$|$ + i $|$1$>$$<$1$|$. \index{GraphRegister@{Graph\-Register}!print_adj_list@{print\_\-adj\_\-list}} 112 | \index{print_adj_list@{print\_\-adj\_\-list}!GraphRegister@{Graph\-Register}} 113 | \subsubsection{\setlength{\rightskip}{0pt plus 5cm}void Graph\-Register::print\_\-adj\_\-list (ostream \& {\em os} = cout) const}\label{classGraphRegister_a13} 114 | 115 | 116 | Prints out the description of the current state. 117 | 118 | in terms of adjacency lists of the graph and the VOps. 119 | 120 | \subsection{Member Data Documentation} 121 | \index{GraphRegister@{Graph\-Register}!vertices@{vertices}} 122 | \index{vertices@{vertices}!GraphRegister@{Graph\-Register}} 123 | \subsubsection{\setlength{\rightskip}{0pt plus 5cm}vector$<${\bf Qubit\-Vertex}$>$ {\bf Graph\-Register::vertices}}\label{classGraphRegister_o0} 124 | 125 | 126 | This vector stores all the qubits, represented as {\bf Qubit\-Vertex}{\rm (p.\,\pageref{structQubitVertex})} objects. The index of the vector is usually taken as of type Vertex\-Index. 127 | 128 | The documentation for this class was generated from the following files:\begin{CompactItemize} 129 | \item 130 | {\bf graphsim.h}\item 131 | graphsim.cpp\end{CompactItemize} 132 | -------------------------------------------------------------------------------- /doc/latex/doxygen.sty: -------------------------------------------------------------------------------- 1 | \NeedsTeXFormat{LaTeX2e} 2 | \ProvidesPackage{doxygen} 3 | \RequirePackage{calc} 4 | \RequirePackage{array} 5 | \pagestyle{fancyplain} 6 | \newcommand{\clearemptydoublepage}{\newpage{\pagestyle{empty}\cleardoublepage}} 7 | \renewcommand{\chaptermark}[1]{\markboth{#1}{}} 8 | \renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}} 9 | \lhead[\fancyplain{}{\bfseries\thepage}] 10 | {\fancyplain{}{\bfseries\rightmark}} 11 | \rhead[\fancyplain{}{\bfseries\leftmark}] 12 | {\fancyplain{}{\bfseries\thepage}} 13 | \rfoot[\fancyplain{}{\bfseries\scriptsize Generated on Mon Apr 18 16:10:12 2005 for graphsim by Doxygen }]{} 14 | \lfoot[]{\fancyplain{}{\bfseries\scriptsize Generated on Mon Apr 18 16:10:12 2005 for graphsim by Doxygen }} 15 | \cfoot{} 16 | \newenvironment{CompactList} 17 | {\begin{list}{}{ 18 | \setlength{\leftmargin}{0.5cm} 19 | \setlength{\itemsep}{0pt} 20 | \setlength{\parsep}{0pt} 21 | \setlength{\topsep}{0pt} 22 | \renewcommand{\makelabel}{}}} 23 | {\end{list}} 24 | \newenvironment{CompactItemize} 25 | { 26 | \begin{itemize} 27 | \setlength{\itemsep}{-3pt} 28 | \setlength{\parsep}{0pt} 29 | \setlength{\topsep}{0pt} 30 | \setlength{\partopsep}{0pt} 31 | } 32 | {\end{itemize}} 33 | \newcommand{\PBS}[1]{\let\temp=\\#1\let\\=\temp} 34 | \newlength{\tmplength} 35 | \newenvironment{TabularC}[1] 36 | { 37 | \setlength{\tmplength} 38 | {\linewidth/(#1)-\tabcolsep*2-\arrayrulewidth*(#1+1)/(#1)} 39 | \par\begin{tabular*}{\linewidth} 40 | {*{#1}{|>{\PBS\raggedright\hspace{0pt}}p{\the\tmplength}}|} 41 | } 42 | {\end{tabular*}\par} 43 | \newcommand{\entrylabel}[1]{ 44 | {\parbox[b]{\labelwidth-4pt}{\makebox[0pt][l]{\textbf{#1}}\\}}} 45 | \newenvironment{Desc} 46 | {\begin{list}{} 47 | { 48 | \settowidth{\labelwidth}{40pt} 49 | \setlength{\leftmargin}{\labelwidth} 50 | \setlength{\parsep}{0pt} 51 | \setlength{\itemsep}{-4pt} 52 | \renewcommand{\makelabel}{\entrylabel} 53 | } 54 | } 55 | {\end{list}} 56 | \newenvironment{Indent} 57 | {\begin{list}{}{\setlength{\leftmargin}{0.5cm}} 58 | \item[]\ignorespaces} 59 | {\unskip\end{list}} 60 | \setlength{\parindent}{0cm} 61 | \setlength{\parskip}{0.2cm} 62 | \addtocounter{secnumdepth}{1} 63 | \sloppy 64 | \usepackage[T1]{fontenc} 65 | -------------------------------------------------------------------------------- /doc/latex/files.tex: -------------------------------------------------------------------------------- 1 | \section{graphsim File List} 2 | Here is a list of all documented files with brief descriptions:\begin{CompactList} 3 | \item\contentsline{section}{{\bf graphsim.h} }{\pageref{graphsim_8h}}{} 4 | \item\contentsline{section}{{\bf loccliff.h} }{\pageref{loccliff_8h}}{} 5 | \item\contentsline{section}{{\bf stabilizer.h} }{\pageref{stabilizer_8h}}{} 6 | \end{CompactList} 7 | -------------------------------------------------------------------------------- /doc/latex/graphsim_8h.tex: -------------------------------------------------------------------------------- 1 | \section{graphsim.h File Reference} 2 | \label{graphsim_8h}\index{graphsim.h@{graphsim.h}} 3 | {\tt \#include $<$iostream$>$}\par 4 | {\tt \#include $<$stdlib.h$>$}\par 5 | {\tt \#include $<$vector$>$}\par 6 | {\tt \#include $<$cassert$>$}\par 7 | {\tt \#include \char`\"{}loccliff.h\char`\"{}}\par 8 | {\tt \#include \char`\"{}stabilizer.h\char`\"{}}\par 9 | \subsection*{Namespaces} 10 | \begin{CompactItemize} 11 | \item 12 | namespace {\bf std} 13 | \end{CompactItemize} 14 | \subsection*{Classes} 15 | \begin{CompactItemize} 16 | \item 17 | struct {\bf Connection\-Info} 18 | \item 19 | class {\bf Graph\-Register} 20 | \begin{CompactList}\small\item\em A quantum register. \item\end{CompactList}\item 21 | struct {\bf Qubit\-Vertex} 22 | \end{CompactItemize} 23 | \subsection*{Defines} 24 | \begin{CompactItemize} 25 | \item 26 | \#define {\bf DBGOUT}(a)\label{graphsim_8h_a0} 27 | 28 | \end{CompactItemize} 29 | \subsection*{Typedefs} 30 | \begin{CompactItemize} 31 | \item 32 | typedef unsigned long {\bf Vertex\-Index} 33 | \item 34 | typedef vector$<$ {\bf Qubit\-Vertex} $>$::iterator {\bf Vertex\-Iter} 35 | \item 36 | typedef hash\_\-set$<$ {\bf Vertex\-Index} $>$::iterator {\bf Vtx\-Idx\-Iter} 37 | \item 38 | typedef vector$<$ {\bf Qubit\-Vertex} $>$::const\_\-iterator {\bf Vertex\-Iter\-Const} 39 | \item 40 | typedef hash\_\-set$<$ {\bf Vertex\-Index} $>$::const\_\-iterator {\bf Vtx\-Idx\-Iter\-Const} 41 | \end{CompactItemize} 42 | 43 | 44 | \subsection{Detailed Description} 45 | This header file defines the main interface of graphsim. 46 | 47 | (c) Simon Anders, University of Innsbruck, 2005 released under GPL. 48 | 49 | Note: If you have trouble compiling this, please note: This file uses the \char`\"{}hash\_\-set\char`\"{} template, which is an extension to the Standard C++ Library and the Standard Template Library, specified by SGI. Most C++ compilers have this template. For GNU C++, the header file $<$ext/hash\_\-set$>$ hasa to be included and hash\_\-set has to be prefixed with namespace \_\-\_\-gnu\_\-cxx. If you use another compiler, you might have to change the include file and the namespace identifier. 50 | 51 | \subsection{Typedef Documentation} 52 | \index{graphsim.h@{graphsim.h}!VertexIndex@{VertexIndex}} 53 | \index{VertexIndex@{VertexIndex}!graphsim.h@{graphsim.h}} 54 | \subsubsection{\setlength{\rightskip}{0pt plus 5cm}typedef unsigned long {\bf Vertex\-Index}}\label{graphsim_8h_a1} 55 | 56 | 57 | All vertices in a graph state are numbered beginning with 0. To specify auch an index, the type Vertex\-Index (which is just unsigned long) is always used \index{graphsim.h@{graphsim.h}!VertexIter@{VertexIter}} 58 | \index{VertexIter@{VertexIter}!graphsim.h@{graphsim.h}} 59 | \subsubsection{\setlength{\rightskip}{0pt plus 5cm}typedef vector$<${\bf Qubit\-Vertex}$>$::iterator {\bf Vertex\-Iter}}\label{graphsim_8h_a2} 60 | 61 | 62 | As we often iterate over sublists of {\bf Graph\-Register::vertices}{\rm (p.\,\pageref{classGraphRegister_o0})}, this iterator typedef is a handy abbreviation. \index{graphsim.h@{graphsim.h}!VertexIterConst@{VertexIterConst}} 63 | \index{VertexIterConst@{VertexIterConst}!graphsim.h@{graphsim.h}} 64 | \subsubsection{\setlength{\rightskip}{0pt plus 5cm}typedef vector$<${\bf Qubit\-Vertex}$>$::const\_\-iterator {\bf Vertex\-Iter\-Const}}\label{graphsim_8h_a4} 65 | 66 | 67 | A constant version of Vertex\-Iter \index{graphsim.h@{graphsim.h}!VtxIdxIter@{VtxIdxIter}} 68 | \index{VtxIdxIter@{VtxIdxIter}!graphsim.h@{graphsim.h}} 69 | \subsubsection{\setlength{\rightskip}{0pt plus 5cm}typedef hash\_\-set$<${\bf Vertex\-Index}$>$::iterator {\bf Vtx\-Idx\-Iter}}\label{graphsim_8h_a3} 70 | 71 | 72 | Another iterator, this one for the adjacency lists Qubit\-Vertex::neigbors, and subsets. \index{graphsim.h@{graphsim.h}!VtxIdxIterConst@{VtxIdxIterConst}} 73 | \index{VtxIdxIterConst@{VtxIdxIterConst}!graphsim.h@{graphsim.h}} 74 | \subsubsection{\setlength{\rightskip}{0pt plus 5cm}typedef hash\_\-set$<${\bf Vertex\-Index}$>$::const\_\-iterator {\bf Vtx\-Idx\-Iter\-Const}}\label{graphsim_8h_a5} 75 | 76 | 77 | A constant version of Vtx\-Idx\-Iter -------------------------------------------------------------------------------- /doc/latex/index.tex: -------------------------------------------------------------------------------- 1 | This is 'graphsim', a simulator for stabilizer quantum cuircuits using the graph state formalism. 2 | 3 | graphsim version 0.10, dated 2005-Jan-27 4 | 5 | (c) Simon Anders ({\tt sanders@fs.tum.de}), University of Innsbruck 6 | 7 | See the article 8 | 9 | S. Anders, H. J. Briegel: Fast simulation of {\bf Stabilizer}{\rm (p.\,\pageref{structStabilizer})} Circuits using a Graph States Formalism quant-ph/0504117 10 | 11 | for a description of this software. 12 | 13 | ---- 14 | 15 | This file is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. 16 | 17 | This file is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License along with this file; see the file COPYING. If not, browse to {\tt http://www.fsf.org/licenses/gpl.html} -------------------------------------------------------------------------------- /doc/latex/loccliff_8h.tex: -------------------------------------------------------------------------------- 1 | \section{loccliff.h File Reference} 2 | \label{loccliff_8h}\index{loccliff.h@{loccliff.h}} 3 | {\tt \#include $<$string$>$}\par 4 | {\tt \#include $<$vector$>$}\par 5 | {\tt \#include \char`\"{}multtbl.tbl\char`\"{}}\par 6 | \subsection*{Namespaces} 7 | \begin{CompactItemize} 8 | \item 9 | namespace {\bf loccliff\_\-tables} 10 | \end{CompactItemize} 11 | \subsection*{Classes} 12 | \begin{CompactItemize} 13 | \item 14 | struct {\bf Loc\-Cliff\-Op} 15 | \begin{CompactList}\small\item\em An operator in the local Clifford group. \item\end{CompactList}\item 16 | struct {\bf Right\-Matrix} 17 | \item 18 | struct {\bf Right\-Phase} 19 | \begin{CompactList}\small\item\em A phase, which is 0, 90, 180, or 270 degrees. \item\end{CompactList}\end{CompactItemize} 20 | \subsection*{Functions} 21 | \begin{CompactItemize} 22 | \item 23 | {\bf Loc\-Cliff\-Op} {\bf operator $\ast$} ({\bf Loc\-Cliff\-Op} a, {\bf Loc\-Cliff\-Op} b)\label{loccliff_8h_a18} 24 | 25 | \begin{CompactList}\small\item\em muliplies two local Clifford operators. Not commutative! \item\end{CompactList}\item 26 | bool {\bf operator==} ({\bf Loc\-Cliff\-Op} a, {\bf Loc\-Cliff\-Op} b)\label{loccliff_8h_a19} 27 | 28 | \begin{CompactList}\small\item\em Check two LC operators for equality. \item\end{CompactList}\item 29 | bool {\bf operator!=} ({\bf Loc\-Cliff\-Op} a, {\bf Loc\-Cliff\-Op} b)\label{loccliff_8h_a20} 30 | 31 | \begin{CompactList}\small\item\em Check two LC operators for inequality. \item\end{CompactList}\item 32 | {\bf Right\-Phase} {\bf operator+} ({\bf Right\-Phase} ph1, {\bf Right\-Phase} ph2)\label{loccliff_8h_a21} 33 | 34 | \begin{CompactList}\small\item\em Adds two phases (modulo 4). \item\end{CompactList}\item 35 | bool {\bf operator==} ({\bf Right\-Phase} ph1, {\bf Right\-Phase} ph2)\label{loccliff_8h_a22} 36 | 37 | \begin{CompactList}\small\item\em Check two phases for equality. \item\end{CompactList}\item 38 | bool {\bf operator!=} ({\bf Right\-Phase} ph1, {\bf Right\-Phase} ph2)\label{loccliff_8h_a23} 39 | 40 | \begin{CompactList}\small\item\em Check two phases for inequality. \item\end{CompactList}\end{CompactItemize} 41 | \subsection*{Variables} 42 | \begin{CompactItemize} 43 | \item 44 | const unsigned short {\bf num\_\-Loc\-Cliff\-Ops} = 24\label{loccliff_8h_a0} 45 | 46 | \begin{CompactList}\small\item\em There are 24 local Clifford operators. \item\end{CompactList}\item 47 | const {\bf Loc\-Cliff\-Op} {\bf lco\_\-Id} = 0\label{loccliff_8h_a1} 48 | 49 | \begin{CompactList}\small\item\em Identity. \item\end{CompactList}\item 50 | const {\bf Loc\-Cliff\-Op} {\bf lco\_\-X} = 1\label{loccliff_8h_a2} 51 | 52 | \begin{CompactList}\small\item\em Pauli X. \item\end{CompactList}\item 53 | const {\bf Loc\-Cliff\-Op} {\bf lco\_\-Y} = 2\label{loccliff_8h_a3} 54 | 55 | \begin{CompactList}\small\item\em Pauli Y. \item\end{CompactList}\item 56 | const {\bf Loc\-Cliff\-Op} {\bf lco\_\-Z} = 3\label{loccliff_8h_a4} 57 | 58 | \begin{CompactList}\small\item\em Pauli Z. \item\end{CompactList}\item 59 | const {\bf Loc\-Cliff\-Op} {\bf lco\_\-H} = 10\label{loccliff_8h_a5} 60 | 61 | \begin{CompactList}\small\item\em Hadamard. \item\end{CompactList}\item 62 | const {\bf Loc\-Cliff\-Op} {\bf lco\_\-spi\-Z} = 5\label{loccliff_8h_a6} 63 | 64 | \begin{CompactList}\small\item\em Sqrt (+i\-Z). \item\end{CompactList}\item 65 | const {\bf Loc\-Cliff\-Op} {\bf lco\_\-smi\-Z} = 6\label{loccliff_8h_a7} 66 | 67 | \begin{CompactList}\small\item\em Sqrt (-i\-Z). \item\end{CompactList}\item 68 | const {\bf Loc\-Cliff\-Op} {\bf lco\_\-spi\-Y} = 11\label{loccliff_8h_a8} 69 | 70 | \begin{CompactList}\small\item\em Sqrt (+i\-Y). \item\end{CompactList}\item 71 | const {\bf Loc\-Cliff\-Op} {\bf lco\_\-smi\-Y} = 9\label{loccliff_8h_a9} 72 | 73 | \begin{CompactList}\small\item\em Sqrt (-i\-Y). \item\end{CompactList}\item 74 | const {\bf Loc\-Cliff\-Op} {\bf lco\_\-spi\-X} = 14\label{loccliff_8h_a10} 75 | 76 | \begin{CompactList}\small\item\em Sqrt (+i\-X). \item\end{CompactList}\item 77 | const {\bf Loc\-Cliff\-Op} {\bf lco\_\-smi\-X} = 15\label{loccliff_8h_a11} 78 | 79 | \begin{CompactList}\small\item\em Sqrt (-i\-X). \item\end{CompactList}\item 80 | const {\bf Loc\-Cliff\-Op} {\bf lco\_\-S} = {\bf lco\_\-smi\-Z}\label{loccliff_8h_a12} 81 | 82 | \begin{CompactList}\small\item\em Pi/4 phase rot. \item\end{CompactList}\item 83 | const {\bf Loc\-Cliff\-Op} {\bf lco\_\-Sh} = {\bf lco\_\-spi\-Z}\label{loccliff_8h_a13} 84 | 85 | \begin{CompactList}\small\item\em herm. conj. of Pi/4 phase rot \item\end{CompactList}\item 86 | const {\bf Right\-Phase} {\bf rp\_\-p1} = 0\label{loccliff_8h_a14} 87 | 88 | \begin{CompactList}\small\item\em +1 \item\end{CompactList}\item 89 | const {\bf Right\-Phase} {\bf rp\_\-p\-I} = 1\label{loccliff_8h_a15} 90 | 91 | \begin{CompactList}\small\item\em +i \item\end{CompactList}\item 92 | const {\bf Right\-Phase} {\bf rp\_\-m1} = 2\label{loccliff_8h_a16} 93 | 94 | \begin{CompactList}\small\item\em -1 \item\end{CompactList}\item 95 | const {\bf Right\-Phase} {\bf rp\_\-m\-I} = 3\label{loccliff_8h_a17} 96 | 97 | \begin{CompactList}\small\item\em -i \item\end{CompactList}\end{CompactItemize} 98 | 99 | 100 | \subsection{Detailed Description} 101 | {\bf loccliff.h}{\rm (p.\,\pageref{loccliff_8h})} -- a class for operators in the Clifford group 102 | 103 | version v0.11, of 2005-01-27 104 | 105 | Copyright (C) 2004 Simon Anders $<${\tt sanders@fs.tum.de}$>$ Institute of Theoretical Physics, University of Innsbruck, Austria 106 | 107 | ---------- 108 | 109 | This file is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. 110 | 111 | This file is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 112 | 113 | You should have received a copy of the GNU General Public License along with this file; see the file COPYING. If not, browse to {\tt http://www.fsf.org/licenses/gpl.html} 114 | 115 | ---------- -------------------------------------------------------------------------------- /doc/latex/namespaceloccliff__tables.tex: -------------------------------------------------------------------------------- 1 | \section{loccliff\_\-tables Namespace Reference} 2 | \label{namespaceloccliff__tables}\index{loccliff_tables@{loccliff\_\-tables}} 3 | Inline functions and tables needed by them. Consider them as private. 4 | 5 | 6 | \subsection*{Variables} 7 | \begin{CompactItemize} 8 | \item 9 | const unsigned short {\bf meas\_\-conj\_\-tbl} [3][{\bf num\_\-Loc\-Cliff\-Ops}] 10 | \item 11 | const unsigned short {\bf lco\_\-mult\_\-tbl} [{\bf num\_\-Loc\-Cliff\-Ops}][{\bf num\_\-Loc\-Cliff\-Ops}]\label{namespaceloccliff__tables_a1} 12 | 13 | \item 14 | const short {\bf adj\_\-tbl} [24] 15 | \item 16 | const short {\bf phase\_\-tbl} [4][4] 17 | \end{CompactItemize} 18 | 19 | 20 | \subsection{Detailed Description} 21 | Inline functions and tables needed by them. Consider them as private. 22 | 23 | \subsection{Variable Documentation} 24 | \index{loccliff_tables@{loccliff\_\-tables}!adj_tbl@{adj\_\-tbl}} 25 | \index{adj_tbl@{adj\_\-tbl}!loccliff_tables@{loccliff\_\-tables}} 26 | \subsubsection{\setlength{\rightskip}{0pt plus 5cm}const short loccliff\_\-tables::adj\_\-tbl[24]}\label{namespaceloccliff__tables_a2} 27 | 28 | 29 | {\bf Initial value:} 30 | 31 | \footnotesize\begin{verbatim} 32 | { 0, 1, 2, 3, 33 | 4, 6, 5, 7, 34 | 8, 11, 10, 9, 35 | 12, 13, 15, 14, 36 | 20, 22, 23, 21, 37 | 16, 19, 17, 18} 38 | \end{verbatim}\normalsize 39 | \index{loccliff_tables@{loccliff\_\-tables}!meas_conj_tbl@{meas\_\-conj\_\-tbl}} 40 | \index{meas_conj_tbl@{meas\_\-conj\_\-tbl}!loccliff_tables@{loccliff\_\-tables}} 41 | \subsubsection{\setlength{\rightskip}{0pt plus 5cm}const unsigned short loccliff\_\-tables::meas\_\-conj\_\-tbl[3][{\bf num\_\-Loc\-Cliff\-Ops}]}\label{namespaceloccliff__tables_a0} 42 | 43 | 44 | {\bf Initial value:} 45 | 46 | \footnotesize\begin{verbatim} 47 | {{1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3}, 48 | {2, 2, 2, 2, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1}, 49 | {3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 2, 2, 2, 2}} 50 | \end{verbatim}\normalsize 51 | \index{loccliff_tables@{loccliff\_\-tables}!phase_tbl@{phase\_\-tbl}} 52 | \index{phase_tbl@{phase\_\-tbl}!loccliff_tables@{loccliff\_\-tables}} 53 | \subsubsection{\setlength{\rightskip}{0pt plus 5cm}const short loccliff\_\-tables::phase\_\-tbl[4][4]}\label{namespaceloccliff__tables_a3} 54 | 55 | 56 | {\bf Initial value:} 57 | 58 | \footnotesize\begin{verbatim} 59 | {{0, 0, 0, 0}, 60 | {0, 0, 1, 3}, 61 | {0, 3, 0, 1}, 62 | {0, 1, 3, 0}} 63 | \end{verbatim}\normalsize 64 | -------------------------------------------------------------------------------- /doc/latex/namespaces.tex: -------------------------------------------------------------------------------- 1 | \section{graphsim Namespace List} 2 | Here is a list of all documented namespaces with brief descriptions:\begin{CompactList} 3 | \item\contentsline{section}{{\bf loccliff\_\-tables} (Inline functions and tables needed by them. Consider them as private )}{\pageref{namespaceloccliff__tables}}{} 4 | \end{CompactList} 5 | -------------------------------------------------------------------------------- /doc/latex/refman.tex: -------------------------------------------------------------------------------- 1 | \documentclass[a4paper]{book} 2 | \usepackage{a4wide} 3 | \usepackage{makeidx} 4 | \usepackage{fancyhdr} 5 | \usepackage{graphicx} 6 | \usepackage{multicol} 7 | \usepackage{float} 8 | \usepackage{textcomp} 9 | \usepackage{alltt} 10 | \usepackage{doxygen} 11 | \makeindex 12 | \setcounter{tocdepth}{1} 13 | \renewcommand{\footrulewidth}{0.4pt} 14 | \begin{document} 15 | \begin{titlepage} 16 | \vspace*{7cm} 17 | \begin{center} 18 | {\Large graphsim Reference Manual}\\ 19 | \vspace*{1cm} 20 | {\large Generated by Doxygen 1.3.4}\\ 21 | \vspace*{0.5cm} 22 | {\small Mon Apr 18 16:10:12 2005}\\ 23 | \end{center} 24 | \end{titlepage} 25 | \clearemptydoublepage 26 | \pagenumbering{roman} 27 | \tableofcontents 28 | \clearemptydoublepage 29 | \pagenumbering{arabic} 30 | \chapter{graphsim Main Page} 31 | \label{index}\input{index} 32 | \chapter{graphsim Namespace Index} 33 | \input{namespaces} 34 | \chapter{graphsim Class Index} 35 | \input{annotated} 36 | \chapter{graphsim File Index} 37 | \input{files} 38 | \chapter{graphsim Namespace Documentation} 39 | \input{namespaceloccliff__tables} 40 | \chapter{graphsim Class Documentation} 41 | \input{structConnectionInfo} 42 | \include{structEdge} 43 | \include{structedge__hash} 44 | \include{classGraphRegister} 45 | \include{structLocCliffOp} 46 | \include{structQubitVertex} 47 | \include{structRightPhase} 48 | \include{structStabilizer} 49 | \chapter{graphsim File Documentation} 50 | \input{graphsim_8h} 51 | \include{loccliff_8h} 52 | \include{stabilizer_8h} 53 | \printindex 54 | \end{document} 55 | -------------------------------------------------------------------------------- /doc/latex/stabilizer_8h.tex: -------------------------------------------------------------------------------- 1 | \section{stabilizer.h File Reference} 2 | \label{stabilizer_8h}\index{stabilizer.h@{stabilizer.h}} 3 | {\tt \#include $<$iostream$>$}\par 4 | {\tt \#include $<$vector$>$}\par 5 | {\tt \#include $<$cassert$>$}\par 6 | {\tt \#include \char`\"{}loccliff.h\char`\"{}}\par 7 | {\tt \#include $<$ext/hash\_\-set$>$}\par 8 | \subsection*{Classes} 9 | \begin{CompactItemize} 10 | \item 11 | struct {\bf QState} 12 | \item 13 | struct {\bf Stabilizer} 14 | \begin{CompactList}\small\item\em A stabilizer describing a quantum state. \item\end{CompactList}\end{CompactItemize} 15 | \subsection*{Typedefs} 16 | \begin{CompactItemize} 17 | \item 18 | typedef unsigned long {\bf Vertex\-Index}\label{stabilizer_8h_a0} 19 | 20 | \end{CompactItemize} 21 | 22 | 23 | \subsection{Detailed Description} 24 | defines the {\bf Stabilizer}{\rm (p.\,\pageref{structStabilizer})} class -------------------------------------------------------------------------------- /doc/latex/structConnectionInfo.tex: -------------------------------------------------------------------------------- 1 | \section{Connection\-Info Struct Reference} 2 | \label{structConnectionInfo}\index{ConnectionInfo@{ConnectionInfo}} 3 | {\tt \#include $<$graphsim.h$>$} 4 | 5 | \subsection*{Public Attributes} 6 | \begin{CompactItemize} 7 | \item 8 | bool {\bf was\-Edge}\label{structConnectionInfo_o0} 9 | 10 | \item 11 | bool {\bf non1}\label{structConnectionInfo_o1} 12 | 13 | \item 14 | bool {\bf non2}\label{structConnectionInfo_o2} 15 | 16 | \end{CompactItemize} 17 | 18 | 19 | \subsection{Detailed Description} 20 | This structure is only for internal use for the cphase functions. 21 | 22 | 23 | 24 | The documentation for this struct was generated from the following file:\begin{CompactItemize} 25 | \item 26 | {\bf graphsim.h}\end{CompactItemize} 27 | -------------------------------------------------------------------------------- /doc/latex/structEdge.tex: -------------------------------------------------------------------------------- 1 | \section{Edge Struct Reference} 2 | \label{structEdge}\index{Edge@{Edge}} 3 | This structure is needed only by toggle\_\-edges. 4 | 5 | 6 | \subsection*{Public Member Functions} 7 | \begin{CompactItemize} 8 | \item 9 | {\bf Edge} (const {\bf Vertex\-Index} a, const {\bf Vertex\-Index} b)\label{structEdge_a0} 10 | 11 | \end{CompactItemize} 12 | 13 | 14 | \subsection{Detailed Description} 15 | This structure is needed only by toggle\_\-edges. 16 | 17 | 18 | 19 | The documentation for this struct was generated from the following file:\begin{CompactItemize} 20 | \item 21 | graphsim.cpp\end{CompactItemize} 22 | -------------------------------------------------------------------------------- /doc/latex/structLocCliffOp.tex: -------------------------------------------------------------------------------- 1 | \section{Loc\-Cliff\-Op Struct Reference} 2 | \label{structLocCliffOp}\index{LocCliffOp@{LocCliffOp}} 3 | An operator in the local Clifford group. 4 | 5 | 6 | {\tt \#include $<$loccliff.h$>$} 7 | 8 | \subsection*{Public Member Functions} 9 | \begin{CompactItemize} 10 | \item 11 | {\bf Loc\-Cliff\-Op} (unsigned short int op\_\-)\label{structLocCliffOp_a0} 12 | 13 | \begin{CompactList}\small\item\em constructor, takes an integer in 0..23. \item\end{CompactList}\item 14 | {\bf Loc\-Cliff\-Op} (unsigned short int signsymb, unsigned short int permsymb) 15 | \begin{CompactList}\small\item\em constructor, takes a sign symbol in 0..3 (for I, X, Y, Z) and a \item\end{CompactList}\item 16 | string {\bf get\_\-name} (void) const \label{structLocCliffOp_a2} 17 | 18 | \begin{CompactList}\small\item\em returns something like e.g. \char`\"{}YC\char`\"{} for Hadamard=Y$^\wedge$C \item\end{CompactList}\item 19 | {\bf Right\-Phase} {\bf conjugate} (const {\bf Loc\-Cliff\-Op} trans) 20 | \begin{CompactList}\small\item\em replaces op by trans $\ast$ op $\ast$ trans$^\wedge$dagger and returns a phase, \item\end{CompactList}\item 21 | {\bf Loc\-Cliff\-Op} {\bf herm\_\-adjoint} (void) const \label{structLocCliffOp_a4} 22 | 23 | \begin{CompactList}\small\item\em returns the Hermitian adjoint of op \item\end{CompactList}\item 24 | bool {\bf is\-XY} (void) const \label{structLocCliffOp_a5} 25 | 26 | \begin{CompactList}\small\item\em returns True if op is XA or YA. \item\end{CompactList}\item 27 | bool {\bf is\_\-diagonal} (void) const \label{structLocCliffOp_a6} 28 | 29 | \begin{CompactList}\small\item\em returns True if op is an operator diagonal in the computational basis \item\end{CompactList}\item 30 | Right\-Matrix {\bf get\_\-matrix} (void) const \label{structLocCliffOp_a7} 31 | 32 | \end{CompactItemize} 33 | \subsection*{Static Public Member Functions} 34 | \begin{CompactItemize} 35 | \item 36 | {\bf Right\-Phase} {\bf mult\_\-phase} ({\bf Loc\-Cliff\-Op} op1, {\bf Loc\-Cliff\-Op} op2)\label{structLocCliffOp_e0} 37 | 38 | \begin{CompactList}\small\item\em returns the phase of the multiplication of op1 $\ast$ op2 \item\end{CompactList}\end{CompactItemize} 39 | \subsection*{Public Attributes} 40 | \begin{CompactItemize} 41 | \item 42 | unsigned short {\bf op} 43 | \end{CompactItemize} 44 | 45 | 46 | \subsection{Detailed Description} 47 | An operator in the local Clifford group. 48 | 49 | 50 | 51 | \subsection{Constructor \& Destructor Documentation} 52 | \index{LocCliffOp@{Loc\-Cliff\-Op}!LocCliffOp@{LocCliffOp}} 53 | \index{LocCliffOp@{LocCliffOp}!LocCliffOp@{Loc\-Cliff\-Op}} 54 | \subsubsection{\setlength{\rightskip}{0pt plus 5cm}Loc\-Cliff\-Op::Loc\-Cliff\-Op (unsigned short int {\em signsymb}, unsigned short int {\em permsymb})\hspace{0.3cm}{\tt [inline]}}\label{structLocCliffOp_a1} 55 | 56 | 57 | constructor, takes a sign symbol in 0..3 (for I, X, Y, Z) and a 58 | 59 | permutation symbol 0..5 (for A, B, ..., F) 60 | 61 | \subsection{Member Function Documentation} 62 | \index{LocCliffOp@{Loc\-Cliff\-Op}!conjugate@{conjugate}} 63 | \index{conjugate@{conjugate}!LocCliffOp@{Loc\-Cliff\-Op}} 64 | \subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf Right\-Phase} Loc\-Cliff\-Op::conjugate (const {\bf Loc\-Cliff\-Op} {\em trans})}\label{structLocCliffOp_a3} 65 | 66 | 67 | replaces op by trans $\ast$ op $\ast$ trans$^\wedge$dagger and returns a phase, 68 | 69 | either +1 or -1 (as Right\-Phase(0) or Right\-Phase(2)) 70 | 71 | \subsection{Member Data Documentation} 72 | \index{LocCliffOp@{Loc\-Cliff\-Op}!op@{op}} 73 | \index{op@{op}!LocCliffOp@{Loc\-Cliff\-Op}} 74 | \subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned short {\bf Loc\-Cliff\-Op::op}}\label{structLocCliffOp_o0} 75 | 76 | 77 | The field 'op' identifies the operator. 0 is identity I, 1 is Pauli X, 2 is Pauli Y, 3 is Pauli Z, 4 is I$^\wedge$B, 5 is I$^\wedge$C etc. 78 | 79 | The documentation for this struct was generated from the following files:\begin{CompactItemize} 80 | \item 81 | {\bf loccliff.h}\item 82 | loccliff.cpp\end{CompactItemize} 83 | -------------------------------------------------------------------------------- /doc/latex/structQubitVertex.tex: -------------------------------------------------------------------------------- 1 | \section{Qubit\-Vertex Struct Reference} 2 | \label{structQubitVertex}\index{QubitVertex@{QubitVertex}} 3 | {\tt \#include $<$graphsim.h$>$} 4 | 5 | \subsection*{Public Member Functions} 6 | \begin{CompactItemize} 7 | \item 8 | {\bf Qubit\-Vertex} (void) 9 | \end{CompactItemize} 10 | \subsection*{Public Attributes} 11 | \begin{CompactItemize} 12 | \item 13 | {\bf Loc\-Cliff\-Op} {\bf byprod} 14 | \item 15 | hash\_\-set$<$ {\bf Vertex\-Index} $>$ {\bf neighbors} 16 | \end{CompactItemize} 17 | 18 | 19 | \subsection{Detailed Description} 20 | A {\bf Graph\-Register}{\rm (p.\,\pageref{classGraphRegister})} object maintains a list of its vertices (qubits), each described by an object of the class Qubit\-Vertex described here. 21 | 22 | 23 | 24 | \subsection{Constructor \& Destructor Documentation} 25 | \index{QubitVertex@{Qubit\-Vertex}!QubitVertex@{QubitVertex}} 26 | \index{QubitVertex@{QubitVertex}!QubitVertex@{Qubit\-Vertex}} 27 | \subsubsection{\setlength{\rightskip}{0pt plus 5cm}Qubit\-Vertex::Qubit\-Vertex (void)\hspace{0.3cm}{\tt [inline]}}\label{structQubitVertex_a0} 28 | 29 | 30 | Upon construction, a qubit vertex is initialised with the Hadamard operation as VOp, and with wmpty neighbor list. This makes it represent a $|$0$>$. 31 | 32 | \subsection{Member Data Documentation} 33 | \index{QubitVertex@{Qubit\-Vertex}!byprod@{byprod}} 34 | \index{byprod@{byprod}!QubitVertex@{Qubit\-Vertex}} 35 | \subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf Loc\-Cliff\-Op} {\bf Qubit\-Vertex::byprod}}\label{structQubitVertex_o0} 36 | 37 | 38 | byprod is the vertex operator (VOp) associated with the qubit (the name stems from the term 'byproduct operator' used for the similar concept in the one-way quantum computer. \index{QubitVertex@{Qubit\-Vertex}!neighbors@{neighbors}} 39 | \index{neighbors@{neighbors}!QubitVertex@{Qubit\-Vertex}} 40 | \subsubsection{\setlength{\rightskip}{0pt plus 5cm}hash\_\-set$<${\bf Vertex\-Index}$>$ {\bf Qubit\-Vertex::neighbors}}\label{structQubitVertex_o1} 41 | 42 | 43 | neigbors is the adjacency list for this vertex 44 | 45 | The documentation for this struct was generated from the following file:\begin{CompactItemize} 46 | \item 47 | {\bf graphsim.h}\end{CompactItemize} 48 | -------------------------------------------------------------------------------- /doc/latex/structRightPhase.tex: -------------------------------------------------------------------------------- 1 | \section{Right\-Phase Struct Reference} 2 | \label{structRightPhase}\index{RightPhase@{RightPhase}} 3 | A phase, which is 0, 90, 180, or 270 degrees. 4 | 5 | 6 | {\tt \#include $<$loccliff.h$>$} 7 | 8 | \subsection*{Public Member Functions} 9 | \begin{CompactItemize} 10 | \item 11 | {\bf Right\-Phase} (void)\label{structRightPhase_a0} 12 | 13 | \begin{CompactList}\small\item\em initializes as 0 degrees \item\end{CompactList}\item 14 | {\bf Right\-Phase} (unsigned short ph\_\-)\label{structRightPhase_a1} 15 | 16 | \begin{CompactList}\small\item\em takes 0..3 as argument and writes it to ph \item\end{CompactList}\item 17 | string {\bf get\_\-name} (void) const \label{structRightPhase_a2} 18 | 19 | \begin{CompactList}\small\item\em returns \char`\"{} +\char`\"{}, \char`\"{} i\char`\"{}, \char`\"{} -\char`\"{}, or \char`\"{}-i\char`\"{} \item\end{CompactList}\end{CompactItemize} 20 | \subsection*{Public Attributes} 21 | \begin{CompactItemize} 22 | \item 23 | unsigned short {\bf ph} 24 | \end{CompactItemize} 25 | 26 | 27 | \subsection{Detailed Description} 28 | A phase, which is 0, 90, 180, or 270 degrees. 29 | 30 | 31 | 32 | \subsection{Member Data Documentation} 33 | \index{RightPhase@{Right\-Phase}!ph@{ph}} 34 | \index{ph@{ph}!RightPhase@{Right\-Phase}} 35 | \subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned short {\bf Right\-Phase::ph}}\label{structRightPhase_o0} 36 | 37 | 38 | to be read modulo 4, i.e. \& 0x03 The field 'ph' indicated the angle with a value 0, 1, 2, or 3, corresponding to 0, 90, 180, or 270 degrees Do not rely on ph$<$3, always read it out anded with 0x03. 39 | 40 | The documentation for this struct was generated from the following files:\begin{CompactItemize} 41 | \item 42 | {\bf loccliff.h}\item 43 | loccliff.cpp\end{CompactItemize} 44 | -------------------------------------------------------------------------------- /doc/latex/structStabilizer.tex: -------------------------------------------------------------------------------- 1 | \section{Stabilizer Struct Reference} 2 | \label{structStabilizer}\index{Stabilizer@{Stabilizer}} 3 | A stabilizer describing a quantum state. 4 | 5 | 6 | {\tt \#include $<$stabilizer.h$>$} 7 | 8 | \subsection*{Public Member Functions} 9 | \begin{CompactItemize} 10 | \item 11 | {\bf Stabilizer} (const {\bf Vertex\-Index} num\-Qubits\_\-)\label{structStabilizer_a0} 12 | 13 | \item 14 | {\bf Stabilizer} (const {\bf Graph\-Register} \&gr, const hash\_\-set$<$ {\bf Vertex\-Index} $>$ \&qubits)\label{structStabilizer_a1} 15 | 16 | \item 17 | {\bf Stabilizer} (QState $\ast$qs)\label{structStabilizer_a2} 18 | 19 | \item 20 | void {\bf add\_\-row} (unsigned target, unsigned addend)\label{structStabilizer_a3} 21 | 22 | \item 23 | void {\bf conjugate} (unsigned row, unsigned col, const {\bf Loc\-Cliff\-Op} trans)\label{structStabilizer_a4} 24 | 25 | \item 26 | void {\bf conjugate\_\-column} (unsigned col, const {\bf Loc\-Cliff\-Op} trans)\label{structStabilizer_a5} 27 | 28 | \item 29 | void {\bf print} (ostream \&os=cout) const \label{structStabilizer_a6} 30 | 31 | \item 32 | bool {\bf compare} (const {\bf Stabilizer} \&diag)\label{structStabilizer_a7} 33 | 34 | \end{CompactItemize} 35 | \subsection*{Public Attributes} 36 | \begin{CompactItemize} 37 | \item 38 | {\bf Vertex\-Index} {\bf num\-Qubits}\label{structStabilizer_o0} 39 | 40 | \item 41 | vector$<$ vector$<$ {\bf Loc\-Cliff\-Op} $>$ $>$ {\bf paulis}\label{structStabilizer_o1} 42 | 43 | \item 44 | vector$<$ {\bf Right\-Phase} $>$ {\bf rowsigns}\label{structStabilizer_o2} 45 | 46 | \item 47 | vector$<$ {\bf Vertex\-Index} $>$ {\bf vtxidx}\label{structStabilizer_o3} 48 | 49 | \end{CompactItemize} 50 | 51 | 52 | \subsection{Detailed Description} 53 | A stabilizer describing a quantum state. 54 | 55 | 56 | 57 | The documentation for this struct was generated from the following files:\begin{CompactItemize} 58 | \item 59 | {\bf stabilizer.h}\item 60 | stabilizer.cpp\end{CompactItemize} 61 | -------------------------------------------------------------------------------- /doc/latex/structedge__hash.tex: -------------------------------------------------------------------------------- 1 | \section{edge\_\-hash Struct Reference} 2 | \label{structedge__hash}\index{edge_hash@{edge\_\-hash}} 3 | This structure is needed only by toggle\_\-edges. 4 | 5 | 6 | \subsection*{Public Member Functions} 7 | \begin{CompactItemize} 8 | \item 9 | size\_\-t {\bf operator()} (const {\bf Edge} \&e) const \label{structedge__hash_a0} 10 | 11 | \end{CompactItemize} 12 | 13 | 14 | \subsection{Detailed Description} 15 | This structure is needed only by toggle\_\-edges. 16 | 17 | 18 | 19 | The documentation for this struct was generated from the following file:\begin{CompactItemize} 20 | \item 21 | graphsim.cpp\end{CompactItemize} 22 | -------------------------------------------------------------------------------- /doc/timestamp.dummy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marcusps/GraphSim/5dd7c0464e99bda29a5ccddfbabb6b2396f3e0fe/doc/timestamp.dummy -------------------------------------------------------------------------------- /doc/xml/index.xsd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /doc/xml/indexpage.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | index 5 | 6 | 7 | This is 'graphsim', a simulator for stabilizer quantum cuircuits using the graph state formalism.graphsim version 0.10, dated 2005-Jan-27(c) Simon Anders (sanders@fs.tum.de), University of InnsbruckSee the articleS. Anders, H. J. Briegel: Fast simulation of Stabilizer Circuits using a Graph States Formalism quant-ph/0504117for a description of this software.----This file is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version.This file is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.You should have received a copy of the GNU General Public License along with this file; see the file COPYING. If not, browse to http://www.fsf.org/licenses/gpl.html 8 | 9 | 10 | -------------------------------------------------------------------------------- /doc/xml/namespaceloccliff__tables.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | loccliff_tables 5 | 6 | 7 | const unsigned short 8 | const unsigned short loccliff_tables::meas_conj_tbl[3][num_LocCliffOps] 9 | [3][num_LocCliffOps] 10 | meas_conj_tbl 11 | 12 | {{1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3}, 13 | {2, 2, 2, 2, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1}, 14 | {3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 2, 2, 2, 2}} 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | const unsigned short 23 | const unsigned short loccliff_tables::lco_mult_tbl[num_LocCliffOps][num_LocCliffOps] 24 | [num_LocCliffOps][num_LocCliffOps] 25 | lco_mult_tbl 26 | 27 | {{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 28 | 19, 20, 21, 22, 23}, {1, 0, 3, 2, 6, 7, 4, 5, 11, 10, 9, 8, 13, 12, 15, 29 | 14, 19, 18, 17, 16, 22, 23, 20, 21}, {2, 3, 0, 1, 5, 4, 7, 6, 10, 11, 30 | 8, 9, 15, 14, 13, 12, 17, 16, 19, 18, 23, 22, 21, 20}, 31 | {3, 2, 1, 0, 7, 6, 5, 4, 9, 8, 11, 10, 14, 15, 12, 13, 18, 19, 16, 17, 32 | 21, 20, 23, 22}, {4, 5, 6, 7, 0, 1, 2, 3, 20, 21, 22, 23, 16, 17, 18, 33 | 19, 12, 13, 14, 15, 8, 9, 10, 11}, {5, 4, 7, 6, 2, 3, 0, 1, 23, 22, 21, 34 | 20, 17, 16, 19, 18, 15, 14, 13, 12, 10, 11, 8, 9}, 35 | {6, 7, 4, 5, 1, 0, 3, 2, 22, 23, 20, 21, 19, 18, 17, 16, 13, 12, 15, 14, 36 | 11, 10, 9, 8}, {7, 6, 5, 4, 3, 2, 1, 0, 21, 20, 23, 22, 18, 19, 16, 17, 37 | 14, 15, 12, 13, 9, 8, 11, 10}, {8, 9, 10, 11, 16, 17, 18, 19, 0, 1, 2, 38 | 3, 20, 21, 22, 23, 4, 5, 6, 7, 12, 13, 14, 15}, 39 | {9, 8, 11, 10, 18, 19, 16, 17, 3, 2, 1, 0, 21, 20, 23, 22, 7, 6, 5, 4, 40 | 14, 15, 12, 13}, {10, 11, 8, 9, 17, 16, 19, 18, 2, 3, 0, 1, 23, 22, 21, 41 | 20, 5, 4, 7, 6, 15, 14, 13, 12}, {11, 10, 9, 8, 19, 18, 17, 16, 1, 0, 42 | 3, 2, 22, 23, 20, 21, 6, 7, 4, 5, 13, 12, 15, 14}, 43 | {12, 13, 14, 15, 20, 21, 22, 23, 16, 17, 18, 19, 0, 1, 2, 3, 8, 9, 10, 44 | 11, 4, 5, 6, 7}, {13, 12, 15, 14, 22, 23, 20, 21, 19, 18, 17, 16, 1, 0, 45 | 3, 2, 11, 10, 9, 8, 6, 7, 4, 5}, {14, 15, 12, 13, 21, 20, 23, 22, 18, 46 | 19, 16, 17, 3, 2, 1, 0, 9, 8, 11, 10, 7, 6, 5, 4}, 47 | {15, 14, 13, 12, 23, 22, 21, 20, 17, 16, 19, 18, 2, 3, 0, 1, 10, 11, 8, 48 | 9, 5, 4, 7, 6}, {16, 17, 18, 19, 8, 9, 10, 11, 12, 13, 14, 15, 4, 5, 6, 49 | 7, 20, 21, 22, 23, 0, 1, 2, 3}, {17, 16, 19, 18, 10, 11, 8, 9, 15, 14, 50 | 13, 12, 5, 4, 7, 6, 23, 22, 21, 20, 2, 3, 0, 1}, 51 | {18, 19, 16, 17, 9, 8, 11, 10, 14, 15, 12, 13, 7, 6, 5, 4, 21, 20, 23, 52 | 22, 3, 2, 1, 0}, {19, 18, 17, 16, 11, 10, 9, 8, 13, 12, 15, 14, 6, 7, 53 | 4, 5, 22, 23, 20, 21, 1, 0, 3, 2}, {20, 21, 22, 23, 12, 13, 14, 15, 4, 54 | 5, 6, 7, 8, 9, 10, 11, 0, 1, 2, 3, 16, 17, 18, 19}, 55 | {21, 20, 23, 22, 14, 15, 12, 13, 7, 6, 5, 4, 9, 8, 11, 10, 3, 2, 1, 0, 56 | 18, 19, 16, 17}, {22, 23, 20, 21, 13, 12, 15, 14, 6, 7, 4, 5, 11, 10, 57 | 9, 8, 1, 0, 3, 2, 19, 18, 17, 16}, {23, 22, 21, 20, 15, 14, 13, 12, 5, 58 | 4, 7, 6, 10, 11, 8, 9, 2, 3, 0, 1, 17, 16, 19, 18}} 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | const short 67 | const short loccliff_tables::adj_tbl[24] 68 | [24] 69 | adj_tbl 70 | 71 | { 0, 1, 2, 3, 72 | 4, 6, 5, 7, 73 | 8, 11, 10, 9, 74 | 12, 13, 15, 14, 75 | 20, 22, 23, 21, 76 | 16, 19, 17, 18} 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | const short 85 | const short loccliff_tables::phase_tbl[4][4] 86 | [4][4] 87 | phase_tbl 88 | 89 | {{0, 0, 0, 0}, 90 | {0, 0, 1, 3}, 91 | {0, 3, 0, 1}, 92 | {0, 1, 3, 0}} 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | Inline functions and tables needed by them. Consider them as private. 102 | 103 | 104 | 105 | 106 | 107 | -------------------------------------------------------------------------------- /doc/xml/namespacestd.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | std 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /doc/xml/structConnectionInfo.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ConnectionInfo 5 | graphsim.h 6 | 7 | 8 | bool 9 | bool ConnectionInfo::wasEdge 10 | 11 | wasEdge 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | bool 20 | bool ConnectionInfo::non1 21 | 22 | non1 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | bool 31 | bool ConnectionInfo::non2 32 | 33 | non2 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | This structure is only for internal use for the cphase functions. 45 | 46 | 47 | ConnectionInfonon1 48 | ConnectionInfonon2 49 | ConnectionInfowasEdge 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /doc/xml/structEdge.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Edge 5 | 6 | 7 | 8 | Edge::Edge 9 | (const VertexIndex a, const VertexIndex b) 10 | Edge 11 | 12 | const VertexIndex 13 | a 14 | 15 | 16 | const VertexIndex 17 | b 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | This structure is needed only by toggle_edges. 28 | 29 | 30 | 31 | 32 | EdgeEdge 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /doc/xml/structQState.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | QState 5 | 6 | 7 | long 8 | long QState::n 9 | 10 | n 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | unsigned long ** 19 | unsigned long** QState::x 20 | 21 | x 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | unsigned long ** 30 | unsigned long** QState::z 31 | 32 | z 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | int * 41 | int* QState::r 42 | 43 | r 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | unsigned long 52 | unsigned long QState::pw[32] 53 | [32] 54 | pw 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | long 63 | long QState::over32 64 | 65 | over32 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | QStaten 80 | QStateover32 81 | QStatepw 82 | QStater 83 | QStatex 84 | QStatez 85 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /doc/xml/structQubitVertex.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | QubitVertex 5 | graphsim.h 6 | 7 | 8 | 9 | QubitVertex::QubitVertex 10 | (void) 11 | QubitVertex 12 | 13 | void 14 | 15 | 16 | 17 | 18 | Upon construction, a qubit vertex is initialised with the Hadamard operation as VOp, and with wmpty neighbor list. This makes it represent a |0>. 19 | 20 | byprod 21 | lco_H 22 | 23 | 24 | 25 | 26 | LocCliffOp 27 | LocCliffOp QubitVertex::byprod 28 | 29 | byprod 30 | 31 | 32 | 33 | byprod is the vertex operator (VOp) associated with the qubit (the name stems from the term 'byproduct operator' used for the similar concept in the one-way quantum computer. 34 | 35 | QubitVertex 36 | 37 | 38 | hash_set< VertexIndex > 39 | hash_set<VertexIndex> QubitVertex::neighbors 40 | 41 | neighbors 42 | 43 | 44 | 45 | neigbors is the adjacency list for this vertex 46 | 47 | 48 | 49 | 50 | 51 | 52 | A GraphRegister object maintains a list of its vertices (qubits), each described by an object of the class QubitVertex described here. 53 | 54 | 55 | 56 | 57 | 58 | byprod 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | QubitVertexbyprod 69 | QubitVertexneighbors 70 | QubitVertexQubitVertex 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /doc/xml/structRightMatrix.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | RightMatrix 5 | 6 | 7 | bool 8 | bool RightMatrix::apply_on_state 9 | (vector< bool >::reference ampl1, vector< bool >::reference ampl2, RightPhase &ph1, RightPhase &ph2) 10 | apply_on_state 11 | 12 | vector< bool >::reference 13 | ampl1 14 | 15 | 16 | vector< bool >::reference 17 | ampl2 18 | 19 | 20 | RightPhase & 21 | ph1 22 | 23 | 24 | RightPhase & 25 | ph2 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | bool 37 | bool RightMatrix::sqrt2norm 38 | 39 | sqrt2norm 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | bool 48 | bool RightMatrix::ampls[2][2] 49 | [2][2] 50 | ampls 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | RightPhase 59 | RightPhase RightMatrix::phases[2][2] 60 | [2][2] 61 | phases 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | phases 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | RightMatrixampls 88 | RightMatrixapply_on_state 89 | RightMatrixphases 90 | RightMatrixsqrt2norm 91 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /doc/xml/structRightPhase.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | RightPhase 5 | loccliff.h 6 | 7 | 8 | 9 | RightPhase::RightPhase 10 | (void) 11 | RightPhase 12 | 13 | void 14 | 15 | 16 | initializes as 0 degrees 17 | 18 | 19 | 20 | ph 21 | 22 | 23 | 24 | RightPhase::RightPhase 25 | (unsigned short ph_) 26 | RightPhase 27 | 28 | unsigned short 29 | ph_ 30 | 31 | 32 | takes 0..3 as argument and writes it to ph 33 | 34 | 35 | 36 | ph 37 | 38 | 39 | string 40 | string RightPhase::get_name 41 | (void) const 42 | get_name 43 | 44 | void 45 | 46 | 47 | returns " +", " i", " -", or "-i" 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | unsigned short 56 | unsigned short RightPhase::ph 57 | 58 | ph 59 | 60 | 61 | 62 | to be read modulo 4, i.e. & 0x03 The field 'ph' indicated the angle with a value 0, 1, 2, or 3, corresponding to 0, 90, 180, or 270 degrees Do not rely on ph<3, always read it out anded with 0x03. 63 | 64 | operator!= 65 | operator+ 66 | operator== 67 | RightPhase 68 | 69 | 70 | 71 | A phase, which is 0, 90, 180, or 270 degrees. 72 | 73 | 74 | 75 | 76 | RightPhaseget_name 77 | RightPhaseph 78 | RightPhaseRightPhase 79 | RightPhaseRightPhase 80 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /doc/xml/structedge__hash.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | edge_hash 5 | 6 | 7 | size_t 8 | size_t edge_hash::operator() 9 | (const Edge &e) const 10 | operator() 11 | 12 | const Edge & 13 | e 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | This structure is needed only by toggle_edges. 24 | 25 | 26 | 27 | 28 | edge_hashoperator() 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /graphsim.h: -------------------------------------------------------------------------------- 1 | // graphsim.h 2 | 3 | /*!\mainpage 4 | This is 'graphsim', a simulator for stabilizer quantum cuircuits using the 5 | graph state formalism. 6 | 7 | graphsim version 0.10, dated 2005-Jan-27 8 | 9 | (c) Simon Anders (sanders@fs.tum.de), University of Innsbruck 10 | 11 | See the article 12 | 13 | S. Anders, H. J. Briegel: 14 | Fast simulation of Stabilizer Circuits using a Graph States Formalism 15 | quant-ph/0504117 16 | 17 | for a description of this software. 18 | 19 | ---- 20 | 21 | // This file is free software; you can redistribute it and/or modify 22 | // it under the terms of the GNU General Public License as published by 23 | // the Free Software Foundation; either version 2, or (at your option) 24 | // any later version. 25 | 26 | // This file is distributed in the hope that it will be useful, 27 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 29 | // GNU General Public License for more details. 30 | 31 | // You should have received a copy of the GNU General Public License 32 | // along with this file; see the file COPYING. If not, browse to 33 | // http://www.fsf.org/licenses/gpl.html 34 | 35 | */ 36 | 37 | /*!\file 38 | This header file defines the main interface of graphsim. 39 | 40 | (c) Simon Anders, University of Innsbruck, 2005 41 | released under GPL. 42 | 43 | Note: If you have trouble compiling this, please note: 44 | This file uses the "hash_set" template, which is an extension 45 | to the Standard C++ Library and the Standard Template Library, 46 | specified by SGI. Most C++ compilers have this template. 47 | For GNU C++, the header file hasa to be included 48 | and hash_set has to be prefixed with namespace __gnu_cxx. 49 | If you use another compiler, you might have to change the include 50 | file and the namespace identifier. 51 | */ 52 | 53 | #ifndef GRAPHSIM_H 54 | #define GRAPHSIM_H 55 | 56 | //The following directives are for SWIG, see http://www.swig.org 57 | #ifdef SWIG 58 | %module (docstring="Graph State Stabilizer Simulator -- S. Anders") graphsim 59 | %{ 60 | #include "graphsim.h" 61 | #include "loccliff.h" 62 | #include "stabilizer.h" 63 | %} 64 | %include "cpointer.i" 65 | %pointer_class (bool, boolpc); 66 | %feature ("autodoc", "1"); 67 | %rename (print_tbl) Stabilizer::print; 68 | %rename (print_kets) CBDecomposition::print; 69 | %include "graphsim.h" 70 | %include "loccliff.h" 71 | %include "stabilizer.h" 72 | #endif // SWIG 73 | 74 | #include 75 | #include 76 | #include 77 | #include 78 | 79 | #include "loccliff.h" 80 | #include "stabilizer.h" 81 | 82 | #include 83 | #include 84 | 85 | using namespace std; 86 | 87 | /*! All vertices in a graph state are numbered beginning with 0. To specify 88 | auch an index, the type VertexIndex (which is just unsigned long) is always 89 | used */ 90 | typedef unsigned long VertexIndex; 91 | 92 | /*! A GraphRegister object maintains a list of its vertices (qubits), each 93 | described by an object of the class QubitVertex described here.*/ 94 | struct QubitVertex { 95 | /*!byprod is the vertex operator (VOp) associated with the qubit (the name 96 | stems from the term 'byproduct operator' used for the similar concept in 97 | the one-way quantum computer.*/ 98 | LocCliffOp byprod; 99 | /*! neigbors is the adjacency list for this vertex */ 100 | hash_set neighbors; 101 | /*! Upon construction, a qubit vertex is initialised with the Hadamard 102 | operation as VOp, and with wmpty neighbor list. This makes it represent 103 | a |0>. */ 104 | QubitVertex (void) 105 | : byprod (lco_H) {}; 106 | }; 107 | 108 | #ifndef SWIG 109 | /*! This structure is only for internal use for the cphase functions. */ 110 | struct ConnectionInfo { 111 | bool wasEdge; 112 | bool non1; 113 | bool non2; 114 | }; 115 | #endif 116 | 117 | //! A quantum register. 118 | /*! GraphRegister is the central class of graphsim. It represents a register of qubits 119 | that can be entangled with each other. It offers functions to initialize the register, 120 | let gates operate on the qubits, do measurements and print out the state. */ 121 | class GraphRegister { 122 | public: 123 | /*! This vector stores all the qubits, represented as QubitVertex objects. The index 124 | of the vector is usually taken as of type VertexIndex. */ 125 | vector vertices; 126 | GraphRegister (VertexIndex numQubits, int randomize = -1); 127 | GraphRegister (GraphRegister& gr); 128 | ~GraphRegister () {}; 129 | void local_op (VertexIndex v, LocCliffOp o); 130 | void hadamard (VertexIndex v); 131 | void phaserot (VertexIndex v); 132 | void bitflip (VertexIndex v); 133 | void phaseflip (VertexIndex v); 134 | void cphase (VertexIndex v1, VertexIndex v2); 135 | void cnot (VertexIndex vc, VertexIndex vt); 136 | int measure (VertexIndex v, LocCliffOp basis = lco_Z, 137 | bool* determined = NULL, int force = -1); 138 | Stabilizer & get_full_stabilizer (void) const; 139 | void invert_neighborhood (VertexIndex v); 140 | void print_adj_list (ostream& os = cout) const; 141 | void print_adj_list_line (ostream& os, VertexIndex i) const; 142 | void print_stabilizer (ostream& os = cout) const; 143 | private: 144 | void add_edge (VertexIndex v1, VertexIndex v2); 145 | void del_edge (VertexIndex v1, VertexIndex v2); 146 | void toggle_edge (VertexIndex v1, VertexIndex v2); 147 | int graph_Z_measure (VertexIndex v, int force = -1); 148 | int graph_Y_measure (VertexIndex v, int force = -1); 149 | int graph_X_measure (VertexIndex v, bool* determined = NULL, int force = -1); 150 | void toggle_edges (const hash_set vs1, 151 | const hash_set vs2); 152 | bool remove_byprod_op (VertexIndex v, VertexIndex use_not); 153 | void cphase_with_table (VertexIndex v1, VertexIndex v2); 154 | ConnectionInfo getConnectionInfo (VertexIndex v1, VertexIndex v2); 155 | }; 156 | 157 | 158 | #ifndef SWIG 159 | /*! As we often iterate over sublists of GraphRegister::vertices, this 160 | iterator typedef is a handy abbreviation. */ 161 | typedef vector::iterator VertexIter; 162 | /*! Another iterator, this one for the adjacency lists QubitVertex::neigbors, 163 | and subsets. */ 164 | typedef hash_set::iterator VtxIdxIter; 165 | 166 | /*! A constant version of VertexIter */ 167 | typedef vector::const_iterator VertexIterConst; 168 | /*! A constant version of VtxIdxIter */ 169 | typedef hash_set::const_iterator VtxIdxIterConst; 170 | 171 | 172 | /*! Apply the local (i.e. single-qubit) operation o on vertex v. */ 173 | inline void GraphRegister::local_op (VertexIndex v, LocCliffOp o) { 174 | vertices[v].byprod = o * vertices[v].byprod; 175 | } 176 | 177 | /*! Apply a Hadamard gate on vertex v */ 178 | inline void GraphRegister::hadamard (VertexIndex v) { 179 | local_op (v, lco_H); 180 | } 181 | 182 | /*! Apply a phaserot gate on vertex v. Phaserot means the gate 183 | S = |0><0| + i |1><1|. */ 184 | inline void GraphRegister::phaserot (VertexIndex v) { 185 | local_op (v, lco_S); 186 | } 187 | 188 | /*! Apply a bitflip gate (i.e. a Pauli X) on vertex v */ 189 | inline void GraphRegister::bitflip (VertexIndex v) { 190 | local_op (v, lco_X); 191 | } 192 | 193 | /*! Apply a phaseflip gate (i.e. a Pauli Z) on vertex v */ 194 | inline void GraphRegister::phaseflip (VertexIndex v) { 195 | local_op (v, lco_Z); 196 | } 197 | 198 | #endif //SWIG 199 | 200 | //#define DEBUGOUTPUT 201 | 202 | #ifdef DEBUGOUTPUT 203 | #define DBGOUT(a) cout << a 204 | #else 205 | #define DBGOUT(a) 206 | #endif 207 | 208 | 209 | 210 | #endif //GRAPHSIM_H 211 | -------------------------------------------------------------------------------- /gstest.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "graphsim.h" 5 | 6 | using namespace std; 7 | 8 | const int nbr_of_qubits = 200; 9 | 10 | int main (int, char**) 11 | { 12 | //srandom (time (NULL)); 13 | GraphRegister gr (nbr_of_qubits); 14 | 15 | for (int iter = 0; iter < 1500; iter++) { 16 | VertexIndex qubit = random () / (RAND_MAX / nbr_of_qubits); 17 | int what = random () / (RAND_MAX / 15); 18 | switch (what) { 19 | case 0: gr.hadamard (qubit); break; 20 | case 1: gr.local_op (qubit, lco_S); break; 21 | case 2: gr.local_op (qubit, lco_Z); break; 22 | case 3: gr.local_op (qubit, lco_X); break; 23 | default: 24 | VertexIndex qubit2 = random () / (RAND_MAX / nbr_of_qubits); 25 | if (qubit2 == qubit) { 26 | continue; 27 | } 28 | if (random() > RAND_MAX/2) { 29 | gr.cphase (qubit, qubit2); 30 | } else { 31 | gr.cnot (qubit, qubit2); 32 | } 33 | } 34 | if (iter % 100 == 0) { 35 | cout << iter << endl; 36 | } 37 | } 38 | cout << endl; 39 | gr.print_adj_list (); 40 | } 41 | -------------------------------------------------------------------------------- /loccliff.cpp: -------------------------------------------------------------------------------- 1 | // loccliff.cpp 2 | 3 | // version v0.10, of 2004-10-28 4 | 5 | // Copyright (C) 2004 Simon Anders 6 | // Institute of Theoretical Physics, University of Innsbruck, Austria 7 | 8 | // ---------- 9 | // This file is free software; you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation; either version 2, or (at your option) 12 | // any later version. 13 | 14 | // This file is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | 19 | // You should have received a copy of the GNU General Public License 20 | // along with this file; see the file COPYING. If not, browse to 21 | // http://www.fsf.org/licenses/gpl.html 22 | // ---------- 23 | 24 | 25 | #include "loccliff.h" 26 | #include 27 | 28 | using namespace std; 29 | 30 | string LocCliffOp::get_name (void) const 31 | { 32 | static const char* paulinames[] = {"I", "X", "Y", "Z"}; 33 | return string (paulinames[op & 0x03]) + (char) ('A' + op / 4); 34 | } 35 | 36 | RightPhase LocCliffOp::conjugate (const LocCliffOp trans) { 37 | //If *this is the identity, we don't have to do anything 38 | if (*this == lco_Id) { 39 | return RightPhase (0); 40 | } 41 | //This is meant to be used only if *this is a Pauli: 42 | assert (op >= lco_X.op && op <= lco_Z.op); 43 | // First the sign: 44 | RightPhase zeta; 45 | if ((trans.op & 0x03) == 0 || (trans.op & 0x03) == op) { 46 | // zeta = + sgn pi 47 | // sgn pi = -1 iff trans.op >= 4 && trans.op <= 15 48 | if (trans.op >= 4 && trans.op <= 15) { 49 | zeta = RightPhase (2); 50 | } else { 51 | zeta = RightPhase (0); 52 | } 53 | } else { 54 | // zeta = - sgn pi 55 | // sgn pi = -1 iff trans.op >= 4 && trans.op <= 15 56 | if (trans.op >= 4 && trans.op <= 15) { 57 | zeta = RightPhase (0); 58 | } else { 59 | zeta = RightPhase (2); 60 | } 61 | } 62 | // Now the operator: 63 | // First check the table (to be removed!): 64 | assert (loccliff_tables::meas_conj_tbl [op-lco_X.op] [trans.op] 65 | == trans * op * trans.herm_adjoint()); 66 | op = loccliff_tables::meas_conj_tbl [op-lco_X.op] [trans.op]; 67 | return zeta; 68 | } 69 | 70 | RightMatrix LocCliffOp::get_matrix (void) const 71 | { 72 | const short matrices[24][2][2] = 73 | {{{0, -1}, {-1, 0}}, {{-1, 0}, {0, -1}}, {{-1, 3}, {1, -1}}, {{0, -1}, {-1, 74 | 2}}, {{-1, 0}, {3, -1}}, {{0, -1}, {-1, 3}}, {{0, -1}, {-1, 1}}, {{-1, 75 | 0}, {1, -1}}, {{0, 2}, {2, 2}}, {{0, 2}, {0, 0}}, {{0, 0}, {0, 2}}, {{0, 76 | 0}, {2, 0}}, {{0, 1}, {3, 2}}, {{0, 3}, {1, 2}}, {{0, 1}, {1, 0}}, {{0, 77 | 3}, {3, 0}}, {{0, 3}, {0, 1}}, {{0, 1}, {2, 1}}, {{0, 3}, {2, 3}}, {{0, 78 | 1}, {0, 3}}, {{0, 0}, {1, 3}}, {{0, 0}, {3, 1}}, {{0, 2}, {3, 3}}, {{0, 79 | 2}, {1, 1}}}; 80 | RightMatrix rm; 81 | rm.sqrt2norm = true; 82 | for (int i = 0; i < 2; i++) { 83 | for (int j = 0; j < 2; j++) { 84 | if (matrices[op][i][j] == -1) { 85 | rm.ampls[i][j] = false; 86 | rm.sqrt2norm = false; 87 | rm.phases[i][j] = RightPhase (0); 88 | } else { 89 | rm.ampls[i][j] = true; 90 | rm.phases[i][j] = RightPhase (matrices[op][i][j]); 91 | } 92 | } 93 | } 94 | return rm; 95 | } 96 | 97 | 98 | string RightPhase::get_name (void) const 99 | { 100 | const char* names[] = {" ", " i", " -", "-i"}; 101 | return string (names[ph & 0x03]); 102 | } 103 | 104 | 105 | 106 | bool RightMatrix::apply_on_state (vector::reference ampl1, 107 | vector::reference ampl2, RightPhase& ph1, RightPhase& ph2) 108 | { 109 | vector::reference amplV[2] = {ampl1, ampl2}; 110 | RightPhase *phV[2] = {&ph1, &ph2}; 111 | RightMatrix sum; 112 | bool diag[2] = {false, false}; 113 | 114 | for (int r = 0; r < 2; r++) { 115 | for (int c = 0; c < 2; c++) { 116 | sum.ampls[r][c] = ampls[r][c] && amplV[c]; 117 | sum.phases[r][c] = phases[r][c] + *phV[c]; 118 | } 119 | } 120 | for (int r = 0; r < 2; r++) { 121 | amplV[r] = sum.ampls[r][0] || sum.ampls[r][1]; 122 | if (!amplV[r]) { 123 | continue; 124 | } 125 | if (! (sum.ampls[r][0] && sum.ampls[r][1])) { 126 | // not both ampls present -> just copy from one 127 | *phV[r] = sum.phases[r][sum.ampls[r][0] ? 0: 1]; 128 | } else { 129 | // both ampls present. We have to add them 130 | switch ((sum.phases[r][1].ph - sum.phases[r][0].ph + 4) % 4) { 131 | case 0: 132 | // They are the same. Take one: 133 | *phV[r] = sum.phases[r][0]; 134 | break; 135 | case 2: 136 | // They cancel 137 | amplV[r] = false; 138 | break; 139 | case 1: 140 | *phV[r] = sum.phases[r][0]; 141 | diag[r] = true; 142 | break; 143 | case 3: 144 | *phV[r] = sum.phases[r][1]; 145 | diag[r] = true; 146 | break; 147 | default: assert (0); 148 | } 149 | } 150 | } 151 | if (amplV[0] && amplV[1]) { 152 | assert (diag[0] == diag[1]); 153 | } 154 | assert (amplV[0] || amplV[1]); 155 | return amplV[0] ? diag[0] : diag[1]; 156 | } 157 | -------------------------------------------------------------------------------- /loccliff.h: -------------------------------------------------------------------------------- 1 | /*!\file 2 | // loccliff.h -- a class for operators in the Clifford group 3 | 4 | // version v0.11, of 2005-01-27 5 | 6 | // Copyright (C) 2004 Simon Anders 7 | // Institute of Theoretical Physics, University of Innsbruck, Austria 8 | 9 | // ---------- 10 | 11 | // This file is free software; you can redistribute it and/or modify 12 | // it under the terms of the GNU General Public License as published by 13 | // the Free Software Foundation; either version 2, or (at your option) 14 | // any later version. 15 | 16 | // This file is distributed in the hope that it will be useful, 17 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | // GNU General Public License for more details. 20 | 21 | // You should have received a copy of the GNU General Public License 22 | // along with this file; see the file COPYING. If not, browse to 23 | // http://www.fsf.org/licenses/gpl.html 24 | 25 | // ---------- 26 | */ 27 | 28 | #ifndef LOCCLIFF_H 29 | #define LOCCLIFF_H 30 | 31 | #include 32 | #include 33 | 34 | #include 35 | 36 | using namespace std; 37 | 38 | 39 | // ----=== RightPhase ===---- 40 | 41 | //! A phase, which is 0, 90, 180, or 270 degrees. 42 | struct RightPhase { 43 | 44 | /*! to be read modulo 4, i.e. & 0x03 45 | The field 'ph' indicated the angle with a value 0, 1, 2, or 3, 46 | corresponding to 0, 90, 180, or 270 degrees 47 | Do not rely on ph<3, always read it out anded with 0x03. */ 48 | unsigned short ph; 49 | 50 | RightPhase (void); //!< initializes as 0 degrees 51 | RightPhase (unsigned short ph_); //!< takes 0..3 as argument and writes it to ph 52 | 53 | string get_name (void) const; //!< returns " +", " i", " -", or "-i" 54 | }; 55 | 56 | 57 | // ----=== RightMatrix ===---- 58 | 59 | #ifndef SWIG 60 | struct RightMatrix { 61 | bool sqrt2norm; 62 | bool ampls[2][2]; 63 | RightPhase phases[2][2]; 64 | bool apply_on_state (vector::reference ampl1, 65 | vector::reference ampl2, RightPhase& ph1, RightPhase& ph2); 66 | }; 67 | #endif 68 | 69 | 70 | // ----=== LocCliffOp ===---- 71 | 72 | //! An operator in the local Clifford group. 73 | struct LocCliffOp { 74 | 75 | //! The field 'op' identifies the operator. 0 is identity I, 1 is Pauli X, 76 | //! 2 is Pauli Y, 3 is Pauli Z, 4 is I^B, 5 is I^C etc. 77 | unsigned short op; 78 | 79 | //! constructor, takes an integer in 0..23. 80 | LocCliffOp (unsigned short int op_); 81 | 82 | //! constructor, takes a sign symbol in 0..3 (for I, X, Y, Z) and a 83 | /*! permutation symbol 0..5 (for A, B, ..., F) */ 84 | LocCliffOp (unsigned short int signsymb, unsigned short int permsymb); 85 | 86 | //! returns something like e.g. "YC" for Hadamard=Y^C 87 | string get_name (void) const; 88 | 89 | //! replaces op by trans * op * trans^dagger and returns a phase, 90 | /*! either +1 or -1 (as RightPhase(0) or RightPhase(2)) */ 91 | RightPhase conjugate (const LocCliffOp trans); 92 | 93 | //! returns the Hermitian adjoint of op 94 | LocCliffOp herm_adjoint (void) const; 95 | 96 | //! returns the phase of the multiplication of op1 * op2 97 | static RightPhase mult_phase (LocCliffOp op1, LocCliffOp op2); 98 | 99 | //! returns True if op is XA or YA. 100 | bool isXY (void) const; 101 | 102 | //! returns True if op is an operator diagonal in the computational basis 103 | bool is_diagonal (void) const; 104 | 105 | RightMatrix get_matrix (void) const; 106 | }; 107 | 108 | 109 | // ----=== operators ===---- 110 | 111 | #ifndef SWIG // I should add names for the operators so that SWIG 112 | // can handle them 113 | 114 | //! muliplies two local Clifford operators. Not commutative! 115 | LocCliffOp operator* (LocCliffOp a, LocCliffOp b); 116 | 117 | //! Check two LC operators for equality 118 | bool operator== (LocCliffOp a, LocCliffOp b); 119 | //! Check two LC operators for inequality 120 | bool operator!= (LocCliffOp a, LocCliffOp b); 121 | 122 | //! Adds two phases (modulo 4). 123 | RightPhase operator+ (RightPhase ph1, RightPhase ph2); 124 | 125 | //! Check two phases for equality 126 | bool operator== (RightPhase ph1, RightPhase ph2); 127 | //! Check two phases for inequality 128 | bool operator!= (RightPhase ph1, RightPhase ph2); 129 | 130 | #endif //SWIG 131 | 132 | // ---=== constants ===--- 133 | 134 | //! There are 24 local Clifford operators. 135 | const unsigned short num_LocCliffOps = 24; 136 | 137 | // special local Clifford operators: 138 | const LocCliffOp lco_Id = 0; //!< Identity 139 | const LocCliffOp lco_X = 1; //!< Pauli X 140 | const LocCliffOp lco_Y = 2; //!< Pauli Y 141 | const LocCliffOp lco_Z = 3; //!< Pauli Z 142 | const LocCliffOp lco_H = 10; //!< Hadamard 143 | const LocCliffOp lco_spiZ = 5; //!< Sqrt (+iZ) 144 | const LocCliffOp lco_smiZ = 6; //!< Sqrt (-iZ) 145 | const LocCliffOp lco_spiY = 11; //!< Sqrt (+iY) 146 | const LocCliffOp lco_smiY = 9; //!< Sqrt (-iY) 147 | const LocCliffOp lco_spiX = 14; //!< Sqrt (+iX) 148 | const LocCliffOp lco_smiX = 15; //!< Sqrt (-iX) 149 | const LocCliffOp lco_S = lco_smiZ; //!< Pi/4 phase rot 150 | const LocCliffOp lco_Sh = lco_spiZ; //!< herm. conj. of Pi/4 phase rot 151 | 152 | // the right angles: 153 | const RightPhase rp_p1 = 0; //!< +1 154 | const RightPhase rp_pI = 1; //!< +i 155 | const RightPhase rp_m1 = 2; //!< -1 156 | const RightPhase rp_mI = 3; //!< -i 157 | 158 | 159 | // ---=== internals ===--- 160 | 161 | 162 | #ifndef SWIG 163 | 164 | //! Inline functions and tables needed by them. Consider them as private. 165 | // (all others functions in loccliff.cpp) 166 | namespace loccliff_tables { 167 | 168 | const unsigned short meas_conj_tbl [3] [num_LocCliffOps] = 169 | {{1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3}, 170 | {2, 2, 2, 2, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1}, 171 | {3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 2, 2, 2, 2}}; 172 | 173 | const unsigned short lco_mult_tbl [num_LocCliffOps] [num_LocCliffOps] = 174 | #include "multtbl.tbl" 175 | ; 176 | 177 | const short adj_tbl [24] = 178 | { 0, 1, 2, 3, 179 | 4, 6, 5, 7, 180 | 8, 11, 10, 9, 181 | 12, 13, 15, 14, 182 | 20, 22, 23, 21, 183 | 16, 19, 17, 18}; 184 | 185 | const short phase_tbl[4][4] = 186 | {{0, 0, 0, 0}, 187 | {0, 0, 1, 3}, 188 | {0, 3, 0, 1}, 189 | {0, 1, 3, 0}}; 190 | 191 | } // end namespace loccliff_tables 192 | 193 | 194 | inline LocCliffOp::LocCliffOp (unsigned short int op_) 195 | { 196 | op = op_; 197 | } 198 | 199 | inline LocCliffOp::LocCliffOp (unsigned short int signsymb, 200 | unsigned short int permsymb) 201 | { 202 | assert (signsymb < 4 && permsymb < 6); 203 | op = permsymb * 4 + signsymb; 204 | } 205 | 206 | inline LocCliffOp LocCliffOp::herm_adjoint (void) const 207 | { 208 | return loccliff_tables::adj_tbl [op]; 209 | } 210 | 211 | inline RightPhase LocCliffOp::mult_phase (LocCliffOp op1, LocCliffOp op2) 212 | { 213 | assert (op1.op <= lco_Z.op && op2.op <= lco_Z.op); 214 | return RightPhase (loccliff_tables::phase_tbl[op1.op][op2.op]); 215 | } 216 | 217 | //! 218 | inline bool LocCliffOp::isXY (void) const 219 | { 220 | return (op == lco_X.op || op == lco_Y.op); 221 | } 222 | 223 | inline bool LocCliffOp::is_diagonal (void) const 224 | { 225 | return (op == lco_Id.op || op == lco_Z.op || 226 | op == lco_smiZ.op || op == lco_spiZ.op); 227 | } 228 | 229 | inline LocCliffOp operator* (LocCliffOp a, LocCliffOp b) 230 | { 231 | return LocCliffOp (loccliff_tables::lco_mult_tbl [a.op] [b.op]); 232 | } 233 | 234 | inline bool operator== (LocCliffOp a, LocCliffOp b) 235 | { 236 | return a.op == b.op; 237 | } 238 | 239 | inline bool operator!= (LocCliffOp a, LocCliffOp b) 240 | { 241 | return a.op != b.op; 242 | } 243 | 244 | inline RightPhase::RightPhase (void) { 245 | ph = 0; 246 | } 247 | 248 | inline RightPhase::RightPhase (unsigned short ph_) { 249 | ph = ph_; 250 | } 251 | 252 | inline RightPhase operator+ (RightPhase ph1, RightPhase ph2) 253 | { 254 | return RightPhase ((ph1.ph + ph2.ph) & 0x03); 255 | } 256 | 257 | inline bool operator== (RightPhase a, RightPhase b) 258 | { 259 | return ((a.ph ^ b.ph) & 0x03) == 0; 260 | } 261 | inline bool operator!= (RightPhase a, RightPhase b) 262 | { 263 | return ((a.ph ^ b.ph) & 0x03) != 0; 264 | } 265 | #endif //SWIG 266 | 267 | #endif //LOCCLIFF_H 268 | -------------------------------------------------------------------------------- /multtbl.tbl: -------------------------------------------------------------------------------- 1 | {{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 2 | 19, 20, 21, 22, 23}, {1, 0, 3, 2, 6, 7, 4, 5, 11, 10, 9, 8, 13, 12, 15, 3 | 14, 19, 18, 17, 16, 22, 23, 20, 21}, {2, 3, 0, 1, 5, 4, 7, 6, 10, 11, 4 | 8, 9, 15, 14, 13, 12, 17, 16, 19, 18, 23, 22, 21, 20}, 5 | {3, 2, 1, 0, 7, 6, 5, 4, 9, 8, 11, 10, 14, 15, 12, 13, 18, 19, 16, 17, 6 | 21, 20, 23, 22}, {4, 5, 6, 7, 0, 1, 2, 3, 20, 21, 22, 23, 16, 17, 18, 7 | 19, 12, 13, 14, 15, 8, 9, 10, 11}, {5, 4, 7, 6, 2, 3, 0, 1, 23, 22, 21, 8 | 20, 17, 16, 19, 18, 15, 14, 13, 12, 10, 11, 8, 9}, 9 | {6, 7, 4, 5, 1, 0, 3, 2, 22, 23, 20, 21, 19, 18, 17, 16, 13, 12, 15, 14, 10 | 11, 10, 9, 8}, {7, 6, 5, 4, 3, 2, 1, 0, 21, 20, 23, 22, 18, 19, 16, 17, 11 | 14, 15, 12, 13, 9, 8, 11, 10}, {8, 9, 10, 11, 16, 17, 18, 19, 0, 1, 2, 12 | 3, 20, 21, 22, 23, 4, 5, 6, 7, 12, 13, 14, 15}, 13 | {9, 8, 11, 10, 18, 19, 16, 17, 3, 2, 1, 0, 21, 20, 23, 22, 7, 6, 5, 4, 14 | 14, 15, 12, 13}, {10, 11, 8, 9, 17, 16, 19, 18, 2, 3, 0, 1, 23, 22, 21, 15 | 20, 5, 4, 7, 6, 15, 14, 13, 12}, {11, 10, 9, 8, 19, 18, 17, 16, 1, 0, 16 | 3, 2, 22, 23, 20, 21, 6, 7, 4, 5, 13, 12, 15, 14}, 17 | {12, 13, 14, 15, 20, 21, 22, 23, 16, 17, 18, 19, 0, 1, 2, 3, 8, 9, 10, 18 | 11, 4, 5, 6, 7}, {13, 12, 15, 14, 22, 23, 20, 21, 19, 18, 17, 16, 1, 0, 19 | 3, 2, 11, 10, 9, 8, 6, 7, 4, 5}, {14, 15, 12, 13, 21, 20, 23, 22, 18, 20 | 19, 16, 17, 3, 2, 1, 0, 9, 8, 11, 10, 7, 6, 5, 4}, 21 | {15, 14, 13, 12, 23, 22, 21, 20, 17, 16, 19, 18, 2, 3, 0, 1, 10, 11, 8, 22 | 9, 5, 4, 7, 6}, {16, 17, 18, 19, 8, 9, 10, 11, 12, 13, 14, 15, 4, 5, 6, 23 | 7, 20, 21, 22, 23, 0, 1, 2, 3}, {17, 16, 19, 18, 10, 11, 8, 9, 15, 14, 24 | 13, 12, 5, 4, 7, 6, 23, 22, 21, 20, 2, 3, 0, 1}, 25 | {18, 19, 16, 17, 9, 8, 11, 10, 14, 15, 12, 13, 7, 6, 5, 4, 21, 20, 23, 26 | 22, 3, 2, 1, 0}, {19, 18, 17, 16, 11, 10, 9, 8, 13, 12, 15, 14, 6, 7, 27 | 4, 5, 22, 23, 20, 21, 1, 0, 3, 2}, {20, 21, 22, 23, 12, 13, 14, 15, 4, 28 | 5, 6, 7, 8, 9, 10, 11, 0, 1, 2, 3, 16, 17, 18, 19}, 29 | {21, 20, 23, 22, 14, 15, 12, 13, 7, 6, 5, 4, 9, 8, 11, 10, 3, 2, 1, 0, 30 | 18, 19, 16, 17}, {22, 23, 20, 21, 13, 12, 15, 14, 6, 7, 4, 5, 11, 10, 31 | 9, 8, 1, 0, 3, 2, 19, 18, 17, 16}, {23, 22, 21, 20, 15, 14, 13, 12, 5, 32 | 4, 7, 6, 10, 11, 8, 9, 2, 3, 0, 1, 17, 16, 19, 18}} 33 | -------------------------------------------------------------------------------- /stabilizer.h: -------------------------------------------------------------------------------- 1 | // stabilizer.h 2 | 3 | /*!\file 4 | defines the Stabilizer class */ 5 | 6 | #ifndef STABILIZER_H 7 | #define STABILIZER_H 8 | 9 | #include 10 | #include 11 | #include 12 | #include "loccliff.h" 13 | 14 | #include 15 | #ifndef SWIG 16 | using __gnu_cxx::hash_set; 17 | #endif 18 | // See note at top of file graphsim.h in case of problems compiling 19 | // the preceding lines. 20 | 21 | 22 | #ifdef SWIG 23 | struct QState; 24 | #else 25 | extern "C" { 26 | // The following struct declaration is quoted in verbatim from Scott 27 | // Aaronson's CHP program. (Scott, I hope, you don't mind.) It is used 28 | // here to implement the functionality of comparing a stabilizer state 29 | // in CHP with a state in graphsim. This is used to compare the action 30 | // of the two programs to ensure correctness. 31 | struct QState 32 | { 33 | long n; // # of qubits 34 | unsigned long **x; // (2n+1)*n matrix for stabilizer/destabilizer x bits (there's one "scratch row" at 35 | unsigned long **z; // (2n+1)*n matrix for z bits the bottom) 36 | int *r; // Phase bits: 0 for +1, 1 for i, 2 for -1, 3 for -i. Normally either 0 or 2. 37 | unsigned long pw[32]; // pw[i] = 2^i 38 | long over32; // floor(n/8)+1 39 | }; 40 | } 41 | #endif //SWIG 42 | 43 | //forward declarations, definition in graphsim.h: 44 | 45 | typedef unsigned long VertexIndex; 46 | struct QubitVertex; 47 | class GraphRegister; 48 | 49 | //! A stabilizer describing a quantum state. 50 | /* This class is used at the moment only by GraphRegister::print_stabilizer and for 51 | the compare method (when comparing with CHP). */ 52 | struct Stabilizer { 53 | VertexIndex numQubits; 54 | vector > paulis; 55 | vector rowsigns; 56 | vector vtxidx; 57 | Stabilizer (const VertexIndex numQubits_); 58 | Stabilizer (const GraphRegister& gr, const hash_set& qubits); 59 | Stabilizer (QState * qs); 60 | void add_row (unsigned target, unsigned addend); 61 | void conjugate (unsigned row, unsigned col, const LocCliffOp trans); 62 | void conjugate_column (unsigned col, const LocCliffOp trans); 63 | void print (ostream &os = cout) const; 64 | bool compare (const Stabilizer &diag); 65 | }; 66 | 67 | #endif //STABILIZER_H 68 | --------------------------------------------------------------------------------