List of files:
--------------
LICENCE  => the licence (GPL for the source-code files) 
Makefile => the make file for the compilation
README   => this file
shor.cc	=> 	The main file. Implements shor algorithm with static imperfections as 
		described in [Phys Rev. A 75, 052311 (2007)]. IPR and Delta n can be computed
		from the array called "buff". 
		the most important function is the one that implements modular multiplication,
		where the static errors act (there are some comments included in the code).

complex.cc => 	definition of complex-number class
complex.h  => 	header file for complex-number class

quantum.cc => definition of qubit_state class with numerous member functions
		in particular many quantum gates and QFT without error, with 
		static or noise errors are implemented
quantum.h  => header file for qubit_state class 
random.cc  => a random number generator with two seed numbers of 32 bits
		avoiding correlation effects when using a large number of 
		random numbers (the period is much larger than 2^32 !!)
random.h   => header file for random number generator 




COMPILING:
----------
To compile the program type simply:

make

This creates "shor.out".The make file uses by default the g++ compiler 
(from the gcc-package). It should well compile with all versions of gcc 
(2.95/2.96, 3.2.x, 3.3.x, 4.x,y). It should also compile with all other 
standard C++-Compilers, it has been tested with intel icc (7.0, 7.1, 8.0, 9.0)
and C++ from AIX64 (with the most agressive option -O5 !!). The program is 
quite selfcontained, it uses its own package for complex numbers and does 
not rely on libstc++ or similar for this such that incompatibilities between 
different Linux-/Unix versions are minimized. 
It furthermore uses standard C "printf", "sprintf" etc. for input/output 
(and not C++ input/output using the ostream or iostream classes etc.).




RUNNING:
--------
This program requires 4 command line parameters 
and should be invoked by:

./shor.out x N eps ww 

where:

x is the random x in Shor.

N is the big integer to be factorized.

eps is the noise parameter.

ww determines the how many neighbors we couple. (in the paper ww=1)

The program creates the files:

"state3.txt" 	which is the probability distribution measured. It contatines all the information
		that can be obtained.

"clashed.txt"   clashed (one peak) probability distribution.

NOTE:
-----
For the sake of clarity we did not include the complete program that computes IPR and 
other quantities. However once we have the clashed function it is trivial. Then after many runs
we computed the averages of IPR and Delta n^2.

EXAMPLE:
-------
eps=0.0:
-------
./shor.out 2 21 0.0 1

outputs:

n=21     nbr=5   L=15
r0=6     s=171   r=6
number to factorize: 21
u=(x^(r/2)-1) Mod(n)=7
v=(x^(r/2)+1) Mod(n)=3

 7 is a nontrivial factor of 21 !!!

 3 is a nontrivial factor of 21 !!!
7 x 3 = 21


eps != 0.0: just generates the corresponding files.
-----------


The main code for the quantum compuation basics is in "quantum.h/cc" which 
defines a class "qubit_state" and many member functions. The structure and the
use of these functions is pretty obvious for someone with C++-experience. 
People interested in using this code should study the source and the comments 
describing the purposes of every function.





