Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members | Examples

Net Class Reference

Net class. More...

#include <Net.h>

Inheritance diagram for Net:

PyNet List of all members.

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.
knotnearest (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< cdoubleevaluate (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...

Detailed Description

Net class.

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.

Examples:

example.cpp.


Member Typedef Documentation

typedef std::complex<double> Net::cdouble
 

Reimplemented in PyNet.

typedef std::map<icoord, std::list<knot*> , icoord_cmp> Net::nettype
 


Constructor & Destructor Documentation

Net::Net double  tw  ) 
 

Initialize a Net with a given tile width.

Net::Net const char *  file  ) 
 

Load a previously generated Net from a file.

Net::~Net void   ) 
 

DESTROY!


Member Function Documentation

void Net::add Matrix< cdouble > &  U,
char *  word,
int  l
 

Add the knot (Matrix,word,length) to the net.

Net::icoord Net::coordinate const Matrix< cdouble > &  U,
int  rounding = -1
 

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.

Matrix< cdouble > Net::evaluate const std::string &  s  ) 
 

Evaluate an instruction string and return the resulting Matrix.

void Net::generate char  labels[],
cdouble  basis[][4],
int  n,
int  max_length
[inline]
 

As above, but taking constant size arrays as arguments for convenience.

void Net::generate char *  labels,
cdouble **  basis,
int  n,
int  max_length
 

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.

void Net::generate_net int  max_length  ) 
 

Internal helper for generating nets.

string Net::invert const std::string &  s  ) 
 

Invert an instruction string (same as taking its adjoint).

int Net::load const char *  file  ) 
 

Load a net saved from a file.

Net::knot * Net::nearest const Matrix< cdouble > &  U  ) 
 

Return the nearest knot to U.

std::string Net::nearest_string const Matrix< cdouble > &  U  )  [inline]
 

Return the closest approximating string to U in SU(2).

void Net::save const char *  file  ) 
 

Save the generated net into a file.

int Net::searched void   )  [inline]
 

Return the total number of knots seached last approximation.

int Net::size void   )  [inline]
 

Number of points in the net.

Net::knot Net::solovay_kitaev const Matrix< cdouble > &  U,
int  depth
 

...


Friends And Related Function Documentation

std::ostream& operator<< std::ostream &  out,
const Net N
[friend]
 

Output operator.

Prints some terse information about the gate set


Member Data Documentation

int Net::G
 

Number of intervals the coordinate axes are divided into.

int* Net::gate_inverses
 

Index of each gate's inverse.

char* Net::gate_labels
 

Labels for each of the matrices above.

int* Net::gate_orders
 

The order of each gate.

Matrix<cdouble>* Net::gate_set
 

The 'instruction set' of matrices.

std::list<knot*> Net::knots
 

Storage was chosen somewhat arbitrarily as a list<knot*>.

char Net::label_indices[512]
 

int Net::N
 

Size of the instruction set.

int Net::search_count
 

Maps a label to its corresponding index in the above (very oversized).

nettype Net::su2net
 

double Net::tilewidth
 

Precision of this net.


The documentation for this class was generated from the following files:
Generated on Sun Jul 10 21:57:14 2005 by  doxygen 1.4.1