qsieve-fwd.H

Go to the documentation of this file.
00001 
00006 #ifndef QSIEVE_FWD_HEADER_
00007 #define QSIEVE_FWD_HEADER_
00008 
00009 #include "utils.H"
00010 
00011 const int server_port = 12364;
00012 // server port for networked distributed factoring
00013 
00014 const int XML_status_port = 12370;
00015 // port for accessing XML status information
00016 
00017 const char* const QsieveLogon ="Qsieve3-Logon";
00018 // Logon command for accessing the server
00019 
00020 const int SingleLargePrime_Threshold = 1000000000;
00021 // up to this this value the sieved single large primes are
00022 // accepted as such. Only SLP (single large primes) up to this
00023 // limit are inserted into the DynamicFactor set.
00024 
00025 const int DynamicFactor_SievingThreshold = MIN(SingleLargePrime_Threshold,100000000);
00026 // up to this value we also actively sieve with SingleLarge-Primes.
00027 // (If the value is smaller than SingleLargePrime_Threshold, then
00028 //  there is a cut-off in sieving functions for dynamic factors.)
00029 
00030 #define TSIEVEELEMENTSIZE 1 /* 1 = signed char, 2 = short signed int, 4 = signed int, 0 = no assembler inline code (=generic code) */
00031 // this define triggers some types to be set to appropriate values.
00032 // if you don't define it here, a default value will be used, which is perfectly okay.
00033 // if ASM_386 is defined, then TSIEVEELEMENTSIZE defines the type which is used in inline-assembler subroutines
00034 
00035 
00060 const int PhysicalSieveSize = 64*1024; // = 64KB
00061 
00062 
00063 
00064 class StaticFactorbaseSettings
00065 {
00066 public:
00067   typedef unsigned short int FBsizetype; // sizetype of the maximum size of factorbase
00068   //typedef int FBsizetype; // sizetype of the maximum size of factorbase
00069 
00070   // If the factorbase should have not more than 65535 elements,
00071   // you should set FBsizetype to "unsigned short int" to save memory;
00072   // otherwise "int" is a good choice (thereby reducing implicit type casts).
00073   //
00074   // "FBsizetype" has *only* to do with the number of elements in the static
00075   // factorbase. It has *nothing* to do with the type (and the size) of the
00076   // prime numbers in the static factorbase itself!
00077 
00078  static const FBsizetype MaxSize = 65280; /* maximum size of the static factorbase */
00079  /* The bigger the number to factorize, the bigger the factorbase should be. 
00080     Relations can be found easier using a larger factorbase, but also more
00081     relations are needed to solve the system of equations.  The consumed
00082     space for the linear system of equations grows quadratic with the size
00083     of the factorbase.
00084 
00085     Optimal settings depend on the speed and memory provided by the
00086     computers in use. The more memory (RAM+harddisk) is available and the
00087     faster this memory can be accessed, the larger factorbases can be
00088     handled efficiently. You have to experiment...
00089 
00090     Limits are defined by StaticFactorbase::MaxSize, which is constant at
00091     compile time. For 32 MB (real) RAM, 20000 is an acceptable setting.
00092  */
00093 
00094 protected:
00095  static int PrimeNumbers[MaxSize] __attribute__ ((aligned (64)));
00096  static int PrimeNumberReciprocals[MaxSize] __attribute__ ((aligned (64)));
00097  static float PrimeNumberFloatReciprocals[MaxSize] __attribute__ ((aligned (64)));
00098  static FBsizetype Size_StaticFactorbase;
00099  static int biggest_Prime_in_Factorbase;
00100 public:
00101  static FBsizetype Size() { return Size_StaticFactorbase; }
00102  static int StaticPrime(const int i) { return PrimeNumbers[i]; }
00103  static int BiggestPrime() { return biggest_Prime_in_Factorbase; }
00104 
00105  static const int max_additional_Powers = 1000; // maximum count of additional powers of primes, with which sieving is done
00106 
00107  friend void tune_parameters(const unsigned int);
00108 };
00109 
00110 #endif /*  QSIEVE_FWD_HEADER_ */

Generated on Wed Nov 7 23:29:26 2007 for Qsieve by  doxygen 1.5.4