CmpqsFactor Class Reference

provides DLP (double large primes) as a data type More...

#include <Tfactor.H>

Inheritance diagram for CmpqsFactor:

Inheritance graph
[legend]
Collaboration diagram for CmpqsFactor:

Collaboration graph
[legend]

List of all members.

Public Member Functions

bool DLP_get_using_pollard_rho (const mpz_t n)
 try to convert n into a DLP (using pollard rho algorithm)
bool DLP_get (const mpz_t n)
 try to convert n into a DLP (using SQUFOF algorithm)
const CmpqsFactoroperator= (const unsigned int x)
 assign a single (large prime) integer value to this class
int int_value () const
 if the class contains a single large prime or static prime, return it.
int LP1 () const
 return first DLP factor
int LP2 () const
 return second DLP factor
void set_for_search (const unsigned int x)
 assign a single (large prime) integer value to this class (but switched representation)
void swap (void)
 swaps the components p1 and p2 of the DLP
void assign_to_mpz (mpz_t x) const
 return the DLP as a multiple precision integer x
Factortype Type () const
bool IsTypeOf (const Factortype givenType) const
bool DLP_divisible_by (const unsigned int x) const
 returns, whether the object is divisible by x
bool operator< (const CmpqsFactor &x) const
bool operator== (const CmpqsFactor &x) const
bool operator!= (const CmpqsFactor &x) const
int operator/ (const unsigned int u) const
 returns the quotient of this object and u

Static Public Member Functions

static bool DLP_rejected (const mpz_t n)
 returns, whether n is definitely rejected as a DLP

Static Public Attributes

static mpz_t DLP_Threshold
 threshold, when a multiple precision integer should be checked for DLP

Private Attributes

unsigned int p1
 prime components (constraint in normal representation: p1 <= p2 )
unsigned int p2

Static Private Attributes

static double rejected_dlp_counter = 0.0
 counter for rejected DLP (while trying to factor them)

Friends

ostreamoperator<< (ostream &ostr, const CmpqsFactor &x)
 output operator for DLP
istreamoperator>> (istream &istr, CmpqsFactor &x)
 input operator for DLP


Detailed Description

provides DLP (double large primes) as a data type

This class provides the data type DLP (double large prime). It can also handle its subsets (empty, static prime, single large prime). The DLP is represented by its two factors p1 and p2. Methods to split (and check) a multiple precision number into (for) its DLP representation are also provided.

Definition at line 51 of file Tfactor.H.


Member Function Documentation

static bool CmpqsFactor::DLP_rejected ( const mpz_t  n  )  [inline, static]

returns, whether n is definitely rejected as a DLP

Definition at line 67 of file Tfactor.H.

References DLP_Threshold, mpz_cmp(), mpz_probab_prime_p(), and rejected_dlp_counter.

Here is the call graph for this function:

bool CmpqsFactor::DLP_get_using_pollard_rho ( const mpz_t  n  ) 

try to convert n into a DLP (using pollard rho algorithm)

Definition at line 21 of file Tfactor.cc.

References cout, DLP_Threshold, endl(), mpz_add_ui(), mpz_clear(), mpz_cmp(), mpz_cmp_ui(), mpz_divexact(), mpz_gcd(), mpz_get_ui(), mpz_init(), mpz_init_set(), mpz_mod(), mpz_mul(), mpz_set(), mpz_set_ui(), mpz_sub(), p1, p2, numtheory::probab_prime(), SingleLargePrime_Threshold, and std::swap().

Referenced by DLP_get().

Here is the call graph for this function:

bool CmpqsFactor::DLP_get ( const mpz_t  n  ) 

try to convert n into a DLP (using SQUFOF algorithm)

Parameters:
n number to convert into DLP
Returns:
true, if succeed and false if failed
If the result is false, this does not mean necessarily that n is no DLP. It means that either the given n isn't a DLP at all OR that we were not able to factorize n in an acceptable amount of time. If the result is true, then the object contains now a valid DLP.

Definition at line 77 of file Tfactor.cc.

References cerr, cout, DLP_get_using_pollard_rho(), endl(), exit(), floor(), MARK, mpz_add_ui(), mpz_clear(), mpz_cmp_ui(), mpz_gcd_ui(), mpz_get_d(), mpz_get_ui(), mpz_init(), mpz_mul_ui(), mpz_set_d(), mpz_set_ui(), mpz_sizeinbase(), mpz_sqrt(), mpz_sqrtrem(), mpz_sub(), p1, p2, numtheory::probab_prime(), rejected_dlp_counter, setprecision(), setw(), SingleLargePrime_Threshold, sqrt(), and std::swap().

Here is the call graph for this function:

const CmpqsFactor& CmpqsFactor::operator= ( const unsigned int  x  )  [inline]

assign a single (large prime) integer value to this class

Definition at line 95 of file Tfactor.H.

References p1, and p2.

int CmpqsFactor::int_value (  )  const [inline]

if the class contains a single large prime or static prime, return it.

Definition at line 99 of file Tfactor.H.

References cerr, endl(), exit(), p1, and p2.

Here is the call graph for this function:

int CmpqsFactor::LP1 (  )  const [inline]

return first DLP factor

Definition at line 112 of file Tfactor.H.

References p1.

Referenced by SpecialRelations::CycleSearch(), SpecialRelations::insert(), and SpecialRelations::SpecialFactor_splitable().

int CmpqsFactor::LP2 (  )  const [inline]

return second DLP factor

Definition at line 115 of file Tfactor.H.

References p2.

Referenced by SpecialRelations::CycleSearch(), SpecialRelations::insert(), and SpecialRelations::SpecialFactor_splitable().

void CmpqsFactor::set_for_search ( const unsigned int  x  )  [inline]

assign a single (large prime) integer value to this class (but switched representation)

This functions inserts the integer value x into the object using its switched (non-standard) representation, that is setting the second component to 0 and the first component to x. This makes it possible to search in a set of DLP for elements containing this value as its smaller component.

Definition at line 127 of file Tfactor.H.

References p1, and p2.

Referenced by SpecialRelations::CycleSearch(), and SpecialRelations::split_by_primefactor().

void CmpqsFactor::swap ( void   )  [inline]

swaps the components p1 and p2 of the DLP

Definition at line 134 of file Tfactor.H.

References p1, and p2.

Referenced by SpecialRelations::CycleSearch(), SpecialRelations::insert(), SpecialRelations::Load(), and SpecialRelations::split_by_primefactor().

void CmpqsFactor::assign_to_mpz ( mpz_t  x  )  const [inline]

return the DLP as a multiple precision integer x

Definition at line 137 of file Tfactor.H.

References mpz_mul_ui(), mpz_set_ui(), p1, and p2.

Referenced by SpecialRelations::insert().

Here is the call graph for this function:

Factortype CmpqsFactor::Type (  )  const [inline]

returns, whether the object is empty, or if it contains a static prime, a single large prime or a double large prime.

Definition at line 150 of file Tfactor.H.

References cerr, CmpqsFactortypes::double_large_prime, CmpqsFactortypes::empty, endl(), p1, p2, CmpqsFactortypes::single_large_prime, and CmpqsFactortypes::static_prime.

Referenced by IsTypeOf().

Here is the call graph for this function:

bool CmpqsFactor::IsTypeOf ( const Factortype  givenType  )  const [inline]

Definition at line 160 of file Tfactor.H.

References Type().

Here is the call graph for this function:

bool CmpqsFactor::DLP_divisible_by ( const unsigned int  x  )  const [inline]

returns, whether the object is divisible by x

Definition at line 166 of file Tfactor.H.

References p1, and p2.

bool CmpqsFactor::operator< ( const CmpqsFactor x  )  const [inline]

Definition at line 169 of file Tfactor.H.

References p1, and p2.

bool CmpqsFactor::operator== ( const CmpqsFactor x  )  const [inline]

Definition at line 175 of file Tfactor.H.

References p1, and p2.

bool CmpqsFactor::operator!= ( const CmpqsFactor x  )  const [inline]

Definition at line 180 of file Tfactor.H.

int CmpqsFactor::operator/ ( const unsigned int  u  )  const [inline]

returns the quotient of this object and u

Definition at line 186 of file Tfactor.H.

References cerr, endl(), exit(), p1, and p2.

Here is the call graph for this function:


Friends And Related Function Documentation

ostream& operator<< ( ostream ostr,
const CmpqsFactor x 
) [friend]

output operator for DLP

Definition at line 204 of file Tfactor.H.

istream& operator>> ( istream istr,
CmpqsFactor x 
) [friend]

input operator for DLP

Definition at line 463 of file Tfactor.cc.


Member Data Documentation

unsigned int CmpqsFactor::p1 [private]

prime components (constraint in normal representation: p1 <= p2 )

Definition at line 56 of file Tfactor.H.

Referenced by assign_to_mpz(), DLP_divisible_by(), DLP_get(), DLP_get_using_pollard_rho(), int_value(), LP1(), operator/(), operator<(), operator<<(), operator=(), operator==(), operator>>(), set_for_search(), swap(), and Type().

unsigned int CmpqsFactor::p2 [private]

Definition at line 56 of file Tfactor.H.

Referenced by assign_to_mpz(), DLP_divisible_by(), DLP_get(), DLP_get_using_pollard_rho(), int_value(), LP2(), operator/(), operator<(), operator<<(), operator=(), operator==(), operator>>(), set_for_search(), swap(), and Type().

double CmpqsFactor::rejected_dlp_counter = 0.0 [static, private]

counter for rejected DLP (while trying to factor them)

Definition at line 59 of file Tfactor.H.

Referenced by DLP_get(), and DLP_rejected().

mpz_t CmpqsFactor::DLP_Threshold [static]

threshold, when a multiple precision integer should be checked for DLP

Definition at line 64 of file Tfactor.H.

Referenced by cleanup_memory(), DLP_get_using_pollard_rho(), DLP_rejected(), and main().


The documentation for this class was generated from the following files:
Generated on Wed Nov 7 23:30:49 2007 for Qsieve by  doxygen 1.5.4