#include <Net.h>
Inheritance diagram for Net:

Public Types | |
| typedef std::complex< double > | cdouble |
| typedef std::map< icoord, std::list< knot * >, icoord_cmp > | nettype |
Public Member Functions | |
| void | generate_net (int max_length) |
| Internal helper for generating nets. | |
| void | add (Matrix< cdouble > &U, char *word, int l) |
| Add the knot (Matrix,word,length) to the net. | |
| icoord | coordinate (const Matrix< cdouble > &U, int rounding=-1) |
| Storage for the net. | |
| Net (double tw) | |
| Initialize a Net with a given tile width. | |
| Net (const char *file) | |
| Load a previously generated Net from a file. | |
| ~Net (void) | |
| DESTROY! | |
| void | generate (char *labels, cdouble **basis, int n, int max_length) |
| Generate the net. | |
| void | generate (char labels[], cdouble basis[][4], int n, int max_length) |
| As above, but taking constant size arrays as arguments for convenience. | |
| int | load (const char *file) |
| Load a net saved from a file. | |
| void | save (const char *file) |
| Save the generated net into a file. | |
| knot * | nearest (const Matrix< cdouble > &U) |
| Return the nearest knot to U. | |
| std::string | nearest_string (const Matrix< cdouble > &U) |
| Return the closest approximating string to U in SU(2). | |
| Matrix< cdouble > | evaluate (const std::string &s) |
| Evaluate an instruction string and return the resulting Matrix. | |
| std::string | invert (const std::string &s) |
| Invert an instruction string (same as taking its adjoint). | |
| int | searched (void) |
| Return the total number of knots seached last approximation. | |
| int | size (void) |
| Number of points in the net. | |
| knot | solovay_kitaev (const Matrix< cdouble > &U, int depth) |
| ... | |
Public Attributes | |
| std::list< knot * > | knots |
| Storage was chosen somewhat arbitrarily as a list<knot*>. | |
| double | tilewidth |
| Precision of this net. | |
| int | G |
| Number of intervals the coordinate axes are divided into. | |
| Matrix< cdouble > * | gate_set |
| The 'instruction set' of matrices. | |
| int | N |
| Size of the instruction set. | |
| char * | gate_labels |
| Labels for each of the matrices above. | |
| int * | gate_orders |
| The order of each gate. | |
| int * | gate_inverses |
| Index of each gate's inverse. | |
| int | search_count |
| Maps a label to its corresponding index in the above (very oversized). | |
| char | label_indices [512] |
| nettype | su2net |
Friends | |
| std::ostream & | operator<< (std::ostream &out, const Net &N) |
| Output operator. | |
Classes | |
| struct | icoord |
| Integer coordinates for an SU(2) matrix in 4D space. More... | |
| struct | icoord_cmp |
| Comparison operator for the 4D integer coordinates. More... | |
| struct | knot |
| A 'knot' is a mildly amusing term for a point in a Net. More... | |
The purpose of a Net is to generate and store instruction sequences from a given instruction set, and to provide a means for obtaining the nearest instruction sequence to a given U in SU(2).
A net is initially constructed by specifying a tile width. The coordinate space for SU(2) is divided up into tiles, so that when we want to look up an approximation to a given U we need only search the tile that it is in.
When generating a Net, the tile coordinate for each instruction sequence is determined. There are 16 corners to this tile, and the instruction sequence is associated with each corner. When given a operator U to be approximated we find the closest corner, and search through all the instruction sequences associated with that corner.
To generate a Net, we require an instruction set specified as a 2D array containing the instruction gates, and an array of chars containing the labels we want to denote these matrices by.
|
|
Reimplemented in PyNet. |
|
|
|
|
|
Initialize a Net with a given tile width.
|
|
|
Load a previously generated Net from a file.
|
|
|
DESTROY!
|
|
||||||||||||||||
|
Add the knot (Matrix,word,length) to the net.
|
|
||||||||||||
|
Storage for the net. The matrix U lies in a 4D tile bounded by 16 coordinates. If the optional 'corner' paramemter is given it specifies which of these 16 coordinates to return. Otherwise it returns the nearest. |
|
|
Evaluate an instruction string and return the resulting Matrix.
|
|
||||||||||||||||||||
|
As above, but taking constant size arrays as arguments for convenience.
|
|
||||||||||||||||||||
|
Generate the net. This function takes an array of n chars which denote the labels to be used for the net (upper case only). For each label[i] there is a cdouble vector basis[i] which is the corresponding matrix elements as u00, u01, u10, u11. max_length is the maximum length of the instruction sequences we wish to generate. |
|
|
Internal helper for generating nets.
|
|
|
Invert an instruction string (same as taking its adjoint).
|
|
|
Load a net saved from a file.
|
|
|
Return the nearest knot to U.
|
|
|
Return the closest approximating string to U in SU(2).
|
|
|
Save the generated net into a file.
|
|
|
Return the total number of knots seached last approximation.
|
|
|
Number of points in the net.
|
|
||||||||||||
|
...
|
|
||||||||||||
|
Output operator. Prints some terse information about the gate set |
|
|
Number of intervals the coordinate axes are divided into.
|
|
|
Index of each gate's inverse.
|
|
|
Labels for each of the matrices above.
|
|
|
The order of each gate.
|
|
|
The 'instruction set' of matrices.
|
|
|
Storage was chosen somewhat arbitrarily as a list<knot*>.
|
|
|
|
|
|
Size of the instruction set.
|
|
|
Maps a label to its corresponding index in the above (very oversized).
|
|
|
|
|
|
Precision of this net.
|
1.4.1