56   if (mpz_init_set_str(&
rep(), str, base))
 
   57     std::cerr << 
"Scl<MPZ>: The string " << str
 
   58          << 
" is not a valid number in base " << base << std::endl;
 
   66   mpz_init_set(&rep(), &rhs.
rep());      
 
   74   if (
this != &rhs) mpz_set(&rep(), &rhs.
rep()); 
 
   81   return mpz_cmp(&rep(), &rhs.
rep()) == 0;
 
   86   return mpz_cmp_si(&rep(), sl) == 0;
 
   91   return mpz_cmp_si(&rep(), (
long) si) == 0;
 
   97   return mpz_cmp_ui(&rep(), ul) == 0;
 
  104   return mpz_cmp(&rep(), &rhs.
rep()) != 0;
 
  109   return mpz_cmp_si(&rep(), sl) != 0;
 
  114   return mpz_cmp_si(&rep(), (
long) si) != 0;
 
  120   return mpz_cmp_ui(&rep(), ul) != 0;
 
  126   return mpz_cmp(&rep(), &rhs.
rep()) > 0;
 
  131   return mpz_cmp_si(&rep(), sl) > 0;
 
  136   return mpz_cmp_si(&rep(), (
long) si) > 0;
 
  142   return mpz_cmp_ui(&rep(), ul) > 0;
 
  148   return mpz_cmp(&rep(), &rhs.
rep()) >= 0;
 
  153   return mpz_cmp_si(&rep(), sl) >= 0;
 
  159   return mpz_cmp_si(&rep(), (
long) si) >= 0;
 
  165   return mpz_cmp_ui(&rep(), ul) >= 0;
 
  172   return mpz_cmp(&rep(), &rhs.
rep()) < 0;
 
  177   return mpz_cmp_si(&rep(), sl) < 0;
 
  183   return mpz_cmp_si(&rep(), (
long) si) < 0;
 
  189   return mpz_cmp_ui(&rep(), ul) < 0;
 
  197   return mpz_cmp(&rep(), &rhs.
rep()) <= 0;
 
  202   return mpz_cmp_si(&rep(), sl) <= 0;
 
  208   return mpz_cmp_si(&rep(), (
long) si) <= 0;
 
  214   return mpz_cmp_ui(&rep(), ul) <= 0;
 
  221   mpz_set_ui(&rep(), ul); 
return *
this;
 
  227   mpz_set_si(&rep(), sl);  
return *
this;
 
  233   mpz_init_set_si(&(this->rep()), ul);  
return *
this;
 
  239   mpz_add(&rep(), &rep(), &rhs.
rep());  
return *
this;
 
  245   mpz_add_ui(&rep(), &rep(), ul); 
return *
this;
 
  252     mpz_add_ui(&rep(), &rep(), (
unsigned long) sl);
 
  254     mpz_sub_ui(&rep(), &rep(), ((
unsigned long) -sl));
 
  261   *
this += 
Scl<MPZ>(ul);  
return *
this;
 
  268   mpz_sub(&rep(), &rep(), &rhs.
rep()); 
return *
this;
 
  274   mpz_sub_ui(&rep(), &rep(), ul); 
return *
this;
 
  281     mpz_sub_ui(&rep(), &rep(), (
unsigned long) sl);
 
  283     mpz_add_ui(&rep(), &rep(), (
unsigned long) sl);
 
  290   *
this -= 
Scl<MPZ>(ul); 
return *
this;
 
  296   mpz_mul(&rep(), &rep(), &rhs.
rep()); 
return *
this;
 
  301   mpz_mul_ui(&rep(), &rep(), ul); 
return *
this;
 
  307     mpz_mul_ui(&rep(), &rep(), (
unsigned long) sl);
 
  310       rep()._mp_size = -rep()._mp_size;
 
  311       mpz_mul_ui(&rep(), &rep(), ((
unsigned long) -sl));
 
  319      mpz_mul_ui(&rep(), &rep(), (
unsigned long) ul);
 
  321      mpz_mul_ui(&rep(), &rep(), (
unsigned long) (-ul));
 
  322      mpz_neg(&rep(), &rep());
 
  330   mpz_div(&rep(), &rep(), &rhs.
rep());
 
  337   mpz_div_ui(&rep(), &rep(), ul); 
return *
this;
 
  344     mpz_div_ui(&rep(), &rep(), (
unsigned long) sl);
 
  347       rep()._mp_size = -rep()._mp_size;
 
  348       mpz_div_ui(&rep(), &rep(), ((
unsigned long) -sl));
 
  357   mpz_mod(&rep(), &rep(), &rhs.
rep()); 
return *
this;
 
  363   mpz_mod_ui(&rep(), &rep(), ul); 
return *
this;
 
  372    mpz_add(&result.
rep(), &a1.
rep(), &a2.
rep());
 
  380    mpz_sub(&result.
rep(), &a1.
rep(), &a2.
rep());
 
  388    mpz_mul(&result.
rep(), &a1.
rep(), &a2.
rep());
 
  412   mpz_add_ui(&rep(), &rep(), 1);
 
  419   mpz_sub_ui(&rep(), &rep(), 1);
 
  424   mpz_init_set_str(&n.
rep(), s, 10);
 
  429 std::ostream& operator << (std::ostream& os, const Scl<MPZ>& b)
 
  431   mpz_out_str(stdout, 10, &b.rep());
 
  437   std::string s;is >> s;
 
  438   mpz_init_set_str(&b.
rep(),s.c_str(), 10);
 
  444 template<> 
inline void 
  447   mpz_div_2exp(&rep(), &rep(), exponent_of_2);
 
  453     mpz_gcd (&rep(), &rep(), &b2.
rep());
 
  457 template<> 
inline void 
  460   mpz_mod_2exp(&rep(), &rep(), exponent_of_2);
 
  463 template<> 
inline void 
  466   mpz_mul_2exp(&rep(), &rep(), exponent_of_2);
 
  469 template<> 
inline void 
  472   mpz_powm(&rep(), &rep(), &exp.
rep(), &m.
rep());
 
  475 template<> 
inline void 
  478   mpz_powm_ui(&rep(), &rep(), exp, &m.
rep());
 
  481 template<> 
inline void 
  484   if (rep()._mp_size < 0)
 
  485     rep()._mp_size = - rep()._mp_size;
 
  488 template<> 
inline void 
  491   mpz_fac_ui(&rep(), n);
 
  497   rep()._mp_size = - rep()._mp_size; 
return *
this;
 
  503   mpz_pow_ui(&rep(), &rep(), exp); 
return *
this;
 
  509   mpz_ui_pow_ui(&rep(), base, exp); 
return *
this;
 
  512 template<> 
inline void 
  515   mpz_mdiv (&rep(), &rep(), &divisor.
rep());
 
  518 template<> 
inline void 
  521   mpz_mdiv_ui(&rep(), &rep(), divisor);
 
  524 template<> 
inline void 
  527   mpz_mmod(&rep(), &rep(), &divisor.
rep());
 
  530 template<> 
inline unsigned long 
  533   return mpz_mmod_ui(&rep(), &rep(), divisor);
 
  536 template<> 
inline void 
  539   mpz_sqrt(&rep(), &rep());
 
  545   mpz_sqrtrem(&sqrt.
rep(), &rem.
rep(), &b.
rep());
 
  551   mpz_mdivmod(&q.
rep(), &r.
rep(), &divdend.
rep(), &divisor.
rep());
 
  557   return mpz_mdivmod_ui(&q.
rep(), &r.
rep(), &divdend.
rep(), divisor);
 
  563   mpz_divmod(&q.
rep(), &r.
rep(), &divdend.
rep(), &divisor.
rep());
 
  569   mpz_divmod_ui(&q.
rep(), &r.
rep(), &divdend.
rep(), divisor);
 
  583     mpz_gcdext(&gcd.
rep(), &a.
rep(), 0, &x.
rep(), &y.
rep());
 
  588   return mpz_get_ui(&b.
rep());
 
  593   return mpz_get_si(&b.
rep());
 
  598   return mpz_size(&b.
rep());
 
  603   assert(base >= 2 && base <= 36);
 
  604   return mpz_sizeinbase(&b.
rep(), base);
 
  609   if (b.
rep()._mp_size == 0)
 
  612     return b.
rep()._mp_size > 0 ? 1 : -1;
 
  617   return mpz_cmp(&b1.
rep(), &b2.
rep());
 
  622   return mpz_cmp_ui(&b.
rep(), ul);
 
  627   return mpz_cmp_si(&b.
rep(), 
sl);
 
  631   return b.
rep()._mp_size > 0;
 
  635   return b.
rep()._mp_size < 0;
 
  639   return b.
rep()._mp_size == 0;
 
  643   return b.
rep()._mp_size == 1 && b.
rep()._mp_d[0] == 1;
 
  647   return b.
rep()._mp_size == -1 && b.
rep()._mp_d[0] == 1;
 
  651   return b.
rep()._mp_size != 0 && (b.
rep()._mp_d[0] & ((mp_limb_t) 1));
 
  655   return b.
rep()._mp_size == 0 || (b.
rep()._mp_d[0] ^ ((mp_limb_t) 0));
 
  660   return mpz_perfect_square_p(&b.
rep());
 
  665   return mpz_probab_prime_p(&b.
rep(), reps);
 
  669     return (x.
rep()._mp_size > 0);
 
  673 #endif // //SCL_MPZ_H 
void convert(Scl< MPZ > &n, char *s)
Definition: Scl_mpz.hpp:422
 
void ExtGCD(Scl< MPZ > &gcd, Scl< MPZ > &a, Scl< MPZ > &b, const Scl< MPZ > &x, const Scl< MPZ > &y)
Definition: Scl_mpz.hpp:573
 
bool IsEven(const Scl< MPZ > &b)
Definition: Scl_mpz.hpp:654
 
void PowMod(const Scl< T > &exp, const Scl< T > &m)
 
Scl< MPZ > operator/(const Scl< MPZ > &a, const Scl< MPZ > &b)
Definition: Scl_mpz.hpp:393
 
void SqrtRem(Scl< MPZ > &sqrt, Scl< MPZ > &rem, const Scl< MPZ > &b)
Definition: Scl_mpz.hpp:543
 
void Div2Exp(unsigned long exponent_of_2)
 
Scl< MPZ > operator-(const Scl< MPZ > &a1, const Scl< MPZ > &a2)
Definition: Scl_mpz.hpp:377
 
unsigned long BigIntToUL(const Scl< MPZ > &b)
Definition: Scl_mpz.hpp:586
 
bool IsOne(const Scl< MPZ > &b)
Definition: Scl_mpz.hpp:642
 
bool IsMinusOne(const Scl< MPZ > &b)
Definition: Scl_mpz.hpp:646
 
Scl< T > operator-=(const Scl< T > &rhs)
 
MSKaccmodee MSKint32t MSKsoltypee MSKstakeye MSKrealt MSKrealt * sl
Definition: mosek.h:3209
 
Scl< T > operator+=(const Scl< T > &rhs)
 
void DivMod(Scl< MPZ > &q, Scl< MPZ > &r, const Scl< MPZ > &divdend, const Scl< MPZ > &divisor)
Definition: Scl_mpz.hpp:561
 
MP_INT MPZ
Definition: Scl_mpz.hpp:14
 
MSKcallbackcodee MSKsoltypee MSKprostae MSKsolstae MSKstakeye MSKstakeye MSKstakeye MSKrealt MSKrealt MSKrealt * y
Definition: mosek.h:2689
 
bool operator>=(const Scl< T > &rhs) const 
 
MSKaccmodee MSKint32t MSKsoltypee MSKstakeye MSKrealt * x
Definition: mosek.h:3209
 
void Mod2Exp(unsigned long exponent_of_2)
 
void quo(const Scl< T > &divisor)
 
Scl< T > operator*=(const Scl< T > &rhs)
 
std::istream & operator>>(std::istream &is, Scl< MPZ > &b)
Definition: Scl_mpz.hpp:435
 
bool IsOdd(const Scl< MPZ > &b)
Definition: Scl_mpz.hpp:650
 
bool operator==(const Scl< T > &rhs) const 
 
void rem(const Scl< T > &divisor)
 
MSKCONST char * str
Definition: mosek.h:2317
 
Scl< T > & rem(const Scl< T > ÷nd, const Scl< T > &divisor)
Definition: BC.hpp:1096
 
Scl< MPZ > operator*(const Scl< MPZ > &a1, const Scl< MPZ > &a2)
Definition: Scl_mpz.hpp:385
 
Scl()
Definition: Scl.hpp:38
 
bool operator<=(const Scl< T > &rhs) const 
 
Scl< T > operator/=(const Scl< T > &rhs)
 
bool IsNegative(const Scl< MPZ > &b)
Definition: Scl_mpz.hpp:634
 
int compare(const Scl< MPZ > &b1, const Scl< MPZ > &b2)
Definition: Scl_mpz.hpp:615
 
void Mul2Exp(unsigned long exponent_of_2)
 
bool IsProbablyPrime(const Scl< MPZ > &b, int reps)
Definition: Scl_mpz.hpp:663
 
bool IsPerfectSquare(const Scl< MPZ > &b)
Definition: Scl_mpz.hpp:658
 
size_t log(const Scl< MPZ > &b)
Definition: Scl_mpz.hpp:596
 
Scl< T > & sqrt(const Scl< T > &b)
Definition: BC.hpp:1103
 
Scl< T > operator=(const Scl< T > &rhs)
 
MSKrescodee r
Definition: mosek.h:2321
 
Scl< T > operator%=(const Scl< T > &rhs)
 
bool operator>(const Scl< T > &rhs) const 
 
signed long BigIntToSL(const Scl< MPZ > &b)
Definition: Scl_mpz.hpp:591
 
bool IsZero(const Scl< MPZ > &b)
Definition: Scl_mpz.hpp:638
 
MSKstreamtypee MSKint32t MSKint32t MSKint32t MSKint32t MSKint32t MSKint32t MSKint32t MSKint32t MSKint32t a
Definition: mosek.h:3833
 
int sign(const Scl< MPZ > &b)
Definition: Scl_mpz.hpp:607
 
void QuoRem(Scl< MPZ > &q, Scl< MPZ > &r, const Scl< MPZ > &divdend, const Scl< MPZ > &divisor)
Definition: Scl_mpz.hpp:549
 
T & rep()
Definition: Scl.hpp:35
 
bool has_positive_sign(const Scl< MPZ > &x)
Definition: Scl_mpz.hpp:668
 
Scl< MPZ > operator+(const Scl< MPZ > &a1, const Scl< MPZ > &a2)
Definition: Scl_mpz.hpp:369
 
~Scl()
Definition: Scl.hpp:49
 
void GCD(const Scl< T > &b2)
 
void factorial(unsigned long n)
 
bool operator!=(const Scl< T > &rhs) const 
 
bool IsPositive(const Scl< MPZ > &b)
Definition: Scl_mpz.hpp:630
 
bool operator<(const Scl< T > &rhs) const 
 
Scl< T > & gcd(const Scl< T > &b1, const Scl< T > &b2)
Definition: BC.hpp:1026
 
Scl< MPZ > operator%(const Scl< MPZ > &a, const Scl< MPZ > &b)
Definition: Scl_mpz.hpp:401
 
void HalfExtGCD(Scl< MPZ > &gcd, Scl< MPZ > &a, const Scl< MPZ > &x, const Scl< MPZ > &y)
Definition: Scl_mpz.hpp:580