Developer documentation

scalar.hpp
Go to the documentation of this file.
1 /*********************************************************************
2 * This file is part of the source code of realroot package. *
3 * (C) B. Mourrain, GALAAD, INRIA *
4 **********************************************************************
5 History: Initialized from the Posso file.
6  Modified in order to handel different internal representation.
7 **********************************************************************/
8 #ifndef NDEBUG
9 #include <assert.h>
10 #endif //
11 #ifndef realroot_scalar_hpp
12 #define realroot_scalar_hpp
13 #include <math.h>
14 //----------------------------------------------------------------------
15 #include <stdio.h>
17 //----------------------------------------------------------------------
18 #define WITH_REFCOUNT
19 namespace mmx {
20  namespace let {template<class A, class B> inline void assign(A& a, const B& b); }
24 template<class T> struct scalar
25 {
26 public:
27  //data
28 #ifdef WITH_REFCOUNT
30  T & rep() {return (*data);}
31  const T & rep() const {return (*data);}
32 #else
33  T data;
34  inline T & rep() {return (data);}
35  inline const T & rep() const {return (data);}
36 #endif
37  scalar (){this->init();};
38  scalar (const scalar<T>& b); //{ data=b.data;}
39  template<class R> inline
40  explicit scalar (const scalar<R>& x) { this->init(); let::assign(*this,x); }
41  scalar (double d){this->init();
42  let::assign(*this,d);
43  //data=T(d);
44  };
45  scalar (signed long sl);
46  scalar (unsigned long ul);
47  scalar (int si);
48  scalar (unsigned x){this->init(); let::assign(*this,x);};
49  scalar (const char* string, unsigned int b=10);
50 
51  // extended constructor: used to initialize an extended type
52  template<class U>
53  scalar (const scalar<U> &a, const scalar<U> &b, const scalar<U> &c);
54 
55  ~scalar () {}
56 
57  bool operator == (const scalar<T>& rhs) const;
58  bool operator != (const scalar<T>& rhs) const;
59  bool operator > (const scalar<T>& rhs) const;
60  bool operator >= (const scalar<T>& rhs) const;
61  bool operator < (const scalar<T>& rhs) const;
62  bool operator <= (const scalar<T>& rhs) const;
63 
64  bool operator == (long sl) const;
65  bool operator != (long sl) const;
66  bool operator > (long sl) const;
67  bool operator >= (long sl) const;
68  bool operator < (long sl) const;
69  bool operator <= (long sl) const;
70 
71  bool operator == (int si) const;
72  bool operator != (int si) const;
73  bool operator > (int si) const;
74  bool operator >= (int si) const;
75  bool operator < (int si) const;
76  bool operator <= (int si) const;
77 
78  bool operator == (unsigned long ul) const;
79  bool operator != (unsigned long ul) const;
80  bool operator > (unsigned long ul) const;
81  bool operator >= (unsigned long ul) const;
82  bool operator < (unsigned long ul) const;
83  bool operator <= (unsigned long ul) const;
84 
85  // functions that modify at least one argument or `*this'
86  scalar<T>& operator = (const scalar<T>& rhs);// {data=rhs.data; return *this;}
87  scalar<T>& operator += (const scalar<T>& rhs);
88  scalar<T>& operator -= (const scalar<T>& rhs);
89  scalar<T>& operator *= (const scalar<T>& rhs);
90  scalar<T>& operator /= (const scalar<T>& rhs);
91  scalar<T>& operator %= (const scalar<T>& rhs);
92 
93  scalar<T>& operator = (unsigned rhs);
94  scalar<T>& operator += (unsigned rhs);
95  scalar<T>& operator -= (unsigned rhs);
96  scalar<T>& operator *= (unsigned rhs);
97  scalar<T>& operator /= (unsigned rhs);
98  scalar<T>& operator %= (unsigned rhs);
99 
100  scalar<T>& operator = (int rhs);
101  scalar<T>& operator += (int rhs);
102  scalar<T>& operator -= (int rhs);
103  scalar<T>& operator *= (int rhs);
104  scalar<T>& operator /= (int rhs);
105  scalar<T>& operator %= (int rhs);
106 
107  scalar<T>& operator = (unsigned long rhs);
108  scalar<T>& operator += (unsigned long rhs);
109  scalar<T>& operator -= (unsigned long rhs);
110  scalar<T>& operator *= (unsigned long rhs);
111  scalar<T>& operator /= (unsigned long rhs);
112  scalar<T>& operator %= (unsigned long rhs);
113 
114  scalar<T>& operator *= (double rhs);
115  scalar<T>& operator += (double rhs);
116 
117  scalar<T>& operator = (long rhs);
118  scalar<T>& operator += (long rhs);
119  scalar<T>& operator -= (long rhs);
120  scalar<T>& operator *= (long rhs);
121  scalar<T>& operator /= (long rhs);
122 // scalar<T>& operator %= (long rhs);
123 
124  // template<class S>
125 // scalar<T>& operator = (const VAL<S> & x) {assign(*this,x.rep());return *this;}
126 // template<class S>
127 // scalar<T>& operator += (const VAL<S> & x)
128 // {scalar<T> tmp(x);*this+=tmp;return *this;}
129 // template<class S>
130 // scalar<T>& operator -= (const VAL<S> & x)
131 // {scalar<T> tmp(x); *this-=tmp;return *this;}
132 // template<class S> scalar<T>& operator *= (const VAL<S> & x)
133 // {scalar<T> tmp(x); *this*=tmp;return *this;}
134 // template<class S> scalar<T>& operator /= (const VAL<S> & x)
135 // {scalar<T> tmp(x); *this/=tmp;return *this;}
136 // template<class S> scalar<T>& operator %= (const VAL<S> & x)
137 // {scalar<T> tmp(x); *this%=tmp;return *this;}
138 
139  //-----------------------------------------------------------------
140  void operator ++ ( );
141  void operator -- ( );
142  //-----------------------------------------------------------------
143  void Div2Exp (unsigned long exponent_of_2);
144  void GCD (const scalar<T>& b2);
145  void Mod2Exp (unsigned long exponent_of_2);
146  void Mul2Exp (unsigned long exponent_of_2);
147  void PowMod (const scalar<T>& exp, const scalar<T>& m);
148  void PowMod (unsigned long exp, const scalar<T>& m);
149  void abs ( );
150  void factorial (unsigned long n);
151  scalar<T>& negate ( );
152  scalar<T>& pow (unsigned long exp);
153  scalar<T>& pow (unsigned long base, unsigned long exp);
154  void quo (const scalar<T>& divisor);
155  void quo (unsigned long divisor);
156  void rem (const scalar<T>& divisor);
157  unsigned long rem (unsigned long divisor);
158  void sqrt ( );
159 
160 private:
161  void init();
162 };
163 
164 //======================================================================
165 // THE ARITHMETIC OPERATORS
166 //======================================================================
167 // template<class T> scalar<T>& operator - (const scalar<T>& b);
168 // template<class T> scalar<T>& operator + (const scalar<T>& b1, const scalar<T>& b2);
169 // template<class T> scalar<T>& operator - (const scalar<T>& b1, const scalar<T>& b2);
170 // template<class T> scalar<T>& operator * (const scalar<T>& b1, const scalar<T>& b2);
171 // template<class T> scalar<T>& operator / (const scalar<T>& b1, const scalar<T>& b2);
172 // template<class T> scalar<T>& operator % (const scalar<T>& b1, const scalar<T>& b2);
173 //----------------------------------------------------------------------}
174 // template <class R> inline
175 // VAL<OP<'+',scalar<R>,scalar<R> > > operator+(const scalar<R> & a, const scalar<R> & b)
176 // {
177 // return VAL<OP<'+',scalar<R>,scalar<R> > >(OP<'+',scalar<R>,scalar<R> >(a,b));
178 // }
179 // //----------------------------------------------------------------------
180 // template <class R> inline
181 // VAL<OP<'-',scalar<R>,scalar<R> > > operator-(const scalar<R> & a, const scalar<R> & b)
182 // {
183 // return VAL<OP<'-',scalar<R>,scalar<R> > >(OP<'-',scalar<R>,scalar<R> >(a,b));
184 // }
185 // //----------------------------------------------------------------------}
186 // template<class T> inline
187 // scalar<T>& operator - (const scalar<T>& b)
188 // {
189 // scalar<T> r(b); return (r.negate());
190 // }
191 // //----------------------------------------------------------------------
192 // // Product of polynomials
193 // template <class R> inline
194 // VAL<OP<'*',scalar<R>,scalar<R> > > operator*(const scalar<R> & a, const scalar<R> & b)
195 // {
196 // return VAL<OP<'*',scalar<R>,scalar<R> > >(OP<'*',scalar<R>,scalar<R> >(a,b));
197 // }
198 // //----------------------------------------------------------------------
199 // // Division of polynomials
200 // template <class R> inline
201 // VAL<OP<'/',scalar<R>,scalar<R> > > operator/(const scalar<R> & a, const scalar<R> & b)
202 // {
203 // return VAL<OP<'/',scalar<R>,scalar<R> > >(OP<'/',scalar<R>,scalar<R> >(a,b));
204 // }
205 // //----------------------------------------------------------------------
206 // // Division of polynomials
207 // template <class R> inline
208 // VAL<OP<'%',scalar<R>,scalar<R> > > operator%(const scalar<R> & a, const scalar<R> & b)
209 // {
210 // return VAL<OP<'%',scalar<R>,scalar<R> > >(OP<'%',scalar<R>,scalar<R> >(a,b));
211 // }
212 //----------------------------------------------------------------------
213 template<class T> scalar<T>& operator + (const scalar<T>& b, unsigned long ul);
214 template<class T> scalar<T>& operator - (const scalar<T>& b, unsigned long ul);
215 template<class T> scalar<T>& operator * (const scalar<T>& b, unsigned long ul);
216 template<class T> scalar<T>& operator / (const scalar<T>& b, unsigned long ul);
217 template<class T> scalar<T>& operator % (const scalar<T>& b, unsigned long ul);
218 
219 template<class T> scalar<T>& operator + (unsigned long ul, const scalar<T>& b);
220 template<class T> scalar<T>& operator * (unsigned long ul, const scalar<T>& b);
221 
222 template<class T> scalar<T>& operator + (const scalar<T>& b, long sl);
223 template<class T> scalar<T>& operator - (const scalar<T>& b, long sl);
224 template<class T> scalar<T>& operator * (const scalar<T>& b, long sl);
225 template<class T> scalar<T>& operator / (const scalar<T>& b, long sl);
226 template<class T> scalar<T>& operator % (const scalar<T>& b, long sl);
227 
228 template<class T> scalar<T>& operator + (long sl, const scalar<T>& b);
229 template<class T> scalar<T>& operator * (int sl, const scalar<T>& b);
230 template<class T> scalar<T>& operator * (long sl, const scalar<T>& b);
231 template<class T> scalar<T>& operator * (double d, const scalar<T>& b);
232 //----------------------------------------------------------------------
233 template<class T> scalar<T>& Div2Exp (const scalar<T>& b,
234  unsigned long exponent_of_2);
235 template<class T> scalar<T>& GCD (const scalar<T>& b1, const scalar<T>& b2);
236 template<class T> scalar<T>& gcd (const scalar<T>& b1, const scalar<T>& b2);
237 template<class T> scalar<T>& Mod2Exp (const scalar<T>& b,
238  unsigned long exponent_of_2);
239 template<class T> scalar<T>& Mul2Exp (const scalar<T>& b, unsigned long exponent_of_2);
240 template<class T> scalar<T>& PowMod (const scalar<T>& b, const scalar<T>& exp, const scalar<T>& m);
241 template<class T> scalar<T>& PowMod (const scalar<T>& b, unsigned long exp,
242  const scalar<T>& m);
243 template<class T> scalar<T> abs (const scalar<T>& b);
244 template<class T> scalar<T>& neg (const scalar<T>& b);
245 template<class T> scalar<T> pow (const scalar<T>& base, unsigned long exp);
246 template<class T> scalar<T>& quo (const scalar<T>& dividend, unsigned long divisor);
247 template<class T> scalar<T>& rem (const scalar<T>& dividend, const scalar<T>& divisor);
248 template<class T> unsigned long rem (const scalar<T>& b, unsigned long divisor);
249 template<class T> scalar<T> sqrt (const scalar<T>& b);
250 
251 
252 template<class T> scalar<T>& BigIntFactorial (unsigned long n);
253 
254 //
255 // -------- the corresponding `const' functions -----------------------------
256 //
257 
258 #define NO_NRV 1
259 #if defined(__GNUG__) && !defined(NO_NRV)
260 #define NRVAL(name) return name
261 #define NRCODE(code) code
262 #define NONRCODE(code)
263 #else
264 #define NRVAL(name)
265 #define NRCODE(code)
266 #define NONRCODE(code) code
267 #endif //
268 
269 #define OPCODE(a, b, op) scalar<T>& r =*new scalar<T>(a); return (r op b);
270 
271 
272 // template<class T> inline
273 // scalar<T>& operator + (const scalar<T>& b1, const scalar<T>& b2)
274 // {
275 // OPCODE(b1,b2,+=)
276 // }
277 
278 // template<class T> inline
279 // scalar<T>& operator - (const scalar<T>& b1, const scalar<T>& b2)
280 // {
281 // OPCODE(b1,b2,-=)
282 // }
283 
284 // template<class T> inline
285 // scalar<T>& operator * (const scalar<T>& b1, const scalar<T>& b2)
286 // {
287 // OPCODE(b1,b2,*=)
288 // }
289 
290 // template<class T> inline
291 // scalar<T>& operator / (const scalar<T>& b1, const scalar<T>& b2)
292 // {
293 // OPCODE(b1,b2,/=)
294 // }
295 
296 // template<class T> inline
297 // scalar<T>& operator % (const scalar<T>& b1, const scalar<T>& b2)
298 // {
299 // OPCODE(b1,b2,%=)
300 // }
301 
302 //--------------------------
303 template<class T> inline
304 scalar<T>& operator + (const scalar<T>& b, unsigned long ul)
305 {
306  OPCODE(b,ul,+=)
307 }
308 
309 template<class T> inline
310 scalar<T>& operator - (const scalar<T>& b, unsigned long ul)
311 {
312  OPCODE(b,ul,-=)
313 }
314 
315 template<class T> inline scalar<T>&
316 operator * (const scalar<T>& b, unsigned long ul)
317 {
318  OPCODE(b,ul,*=)
319 }
320 
321 template<class T> inline scalar<T>&
322 operator / (const scalar<T>& b, unsigned long ul)
323 {
324  OPCODE(b,ul,/=)
325 }
326 
327 template<class T> inline
328 scalar<T>& operator % (const scalar<T>& b, unsigned long ul)
329 {
330  OPCODE(b,ul,%=)
331 }
332 
333 //----------------------------------------------------------------------
334 template<class T> inline
335 scalar<T>& operator + (unsigned long ul, const scalar<T>& b)
336 {
337  return b + ul;
338 }
339 //----------------------------------------------------------------------
340 template<class T> inline
341 scalar<T>& operator * (unsigned long ul, const scalar<T>& b)
342 {
343  return b * ul;
344 }
345 //----------------------------------------------------------------------
346 template<class T> inline
347 scalar<T>& operator + (const scalar<T>& b, unsigned sl) NRVAL(r(b)) { OPCODE(b,sl,+=) }
348 
349 template<class T> inline
350 scalar<T>& operator - (const scalar<T>& b, unsigned sl) NRVAL(r(b)) { OPCODE(b,sl,-=) }
351 
352 template<class T> inline
353 scalar<T>& operator * (const scalar<T>& b, unsigned sl) NRVAL(r(b)) { OPCODE(b,sl,*=) }
354 
355 template<class T> inline
356 scalar<T>& operator / (const scalar<T>& b, unsigned sl) NRVAL(r(b)) { OPCODE(b,sl,/=) }
357 
358 template<class T> inline
359 scalar<T>& operator % (const scalar<T>& b, unsigned sl) NRVAL(r(b)) { OPCODE(b,sl,%=) }
360 //--------------------------------------------------------------------
361 template<class T> inline
362 scalar<T>& operator + (const scalar<T>& b, int sl) NRVAL(r(b)) { OPCODE(b,sl,+=) }
363 
364 template<class T> inline
365 scalar<T>& operator - (const scalar<T>& b, int sl) NRVAL(r(b)) { OPCODE(b,sl,-=) }
366 
367 template<class T> inline
368 scalar<T>& operator * (const scalar<T>& b, int sl) NRVAL(r(b)) { OPCODE(b,sl,*=) }
369 
370 template<class T> inline
371 scalar<T>& operator / (const scalar<T>& b, int sl) NRVAL(r(b)) { OPCODE(b,sl,/=) }
372 
373 template<class T> inline
374 scalar<T>& operator % (const scalar<T>& b, int sl) NRVAL(r(b)) { OPCODE(b,sl,%=) }
375 //----------------------------------------------------------------------
376 template<class T> inline
377 scalar<T>& operator + (const scalar<T>& b, long int sl) NRVAL(r(b)) { OPCODE(b,sl,+=) }
378 
379 template<class T> inline
380 scalar<T>& operator - (const scalar<T>& b, long int sl) NRVAL(r(b)) { OPCODE(b,sl,-=) }
381 
382 template<class T> inline
383 scalar<T>& operator * (const scalar<T>& b, long int sl) NRVAL(r(b)) { OPCODE(b,sl,*=) }
384 
385 template<class T> inline
386 scalar<T>& operator / (const scalar<T>& b, long int sl) NRVAL(r(b)) { OPCODE(b,sl,/=) }
387 
388 template<class T> inline
389 scalar<T>& operator % (const scalar<T>& b, long int sl) NRVAL(r(b)) { OPCODE(b,sl,%=) }
390 
391 
392 
393 //--------------------------
394 
395 template<class T> inline
396 scalar<T>& operator + (long sl, const scalar<T>& b)
397 {
398  return b + sl;
399 }
400 
401 template<class T> inline
402 scalar<T>& operator * (long sl, const scalar<T>& b)
403 {
404  return b * sl;
405 }
406 //--------------------------
407 
408 template<class T> inline
409 scalar<T>& Div2Exp (const scalar<T>& b, unsigned long exponent_of_2) NRVAL(r(b))
410 {
411  NRCODE(r.Div2Exp(exponent_of_2);)
412  NONRCODE(scalar<T> r(b); r.Div2Exp(exponent_of_2); return r;)
413 }
414 
415 template<class T> inline
416 scalar<T>& GCD (const scalar<T>& b1, const scalar<T>& b2) NRVAL(r(b1))
417 {
418  NRCODE(r.GCD(b2);)
419  NONRCODE(scalar<T> r(b1); r.GCD(b2); return r;)
420 }
421 
422 template<class T> inline
423 scalar<T>& gcd (const scalar<T>& b1, const scalar<T>& b2) NRVAL(r(b1))
424 {
425  NRCODE(r.GCD(b2);)
426  NONRCODE(scalar<T> r(b1); r.GCD(b2); return r;)
427 }
428 
429 template<class T> inline
430 scalar<T>& Mod2Exp (const scalar<T>& b, unsigned long exponent_of_2) NRVAL(r(b))
431 {
432  NRCODE(r.Mod2Exp(exponent_of_2);)
433  NONRCODE(scalar<T> r(b); r.Mod2Exp(exponent_of_2); return r;)
434 }
435 
436 template<class T> inline
437 scalar<T>& Mul2Exp (const scalar<T>& b, unsigned long exponent_of_2) NRVAL(r(b))
438 {
439  NRCODE(r.Mul2Exp(exponent_of_2);)
440  NONRCODE(scalar<T> r(b); r.Mul2Exp(exponent_of_2); return r;)
441 }
442 
443 template<class T> inline
444 scalar<T>& PowMod (const scalar<T>& b, const scalar<T>& exp, const scalar<T>& m) NRVAL(r(b))
445 {
446  NRCODE(r.PowMod(exp, m);)
447  NONRCODE(scalar<T> r(b); r.PowMod(exp,m); return r;)
448 }
449 
450 template<class T> inline
451 scalar<T>& PowMod (const scalar<T>& b, unsigned long exp, const scalar<T>& m) NRVAL(r(b))
452 {
453  NRCODE(r.PowMod(exp, m);)
454  NONRCODE(scalar<T> r(b); r.PowMod(exp,m); return r;)
455 }
456 
457 //template<class T> inline scalar<T>
458 template <class T> inline
459 scalar<T> abs (const scalar<T>& b) NRVAL(r(b))
460 {
461  NRCODE(r.abs();)
462  NONRCODE(scalar<T> r(b); r.abs(); return r;)
463 }
464 
465 // template<class T> inline scalar<T>&
466 // negate (const scalar<T>& b) NRVAL(r(b))
467 // {
468 // NRCODE(r.negate();)
469 // NONRCODE(scalar<T> r(b); r.negate(); return r;)
470 // }
471 
472 template<class T> inline
473 scalar<T> pow (const scalar<T>& base, unsigned long exp) NRVAL(r(base))
474 {
475  NRCODE(r.pow(exp);)
476  NONRCODE(scalar<T> r(base); r.pow(exp); return r;)
477 }
478 
479 template<class T> inline
480 scalar<T> quo (const scalar<T>& dividend, const scalar<T>& divisor) NRVAL(r(dividend))
481 {
482  NRCODE(r.quo(divisor);)
483  NONRCODE(scalar<T> r(dividend); r.quo(divisor); return r;)
484 }
485 
486 template<class T> inline
487 scalar<T> quo (const scalar<T>& dividend, unsigned long divisor) NRVAL(r(dividend))
488 {
489  NRCODE(r.quo(divisor);)
490  NONRCODE(scalar<T> r(dividend); r.quo(divisor); return r;)
491 }
492 
493 template<class T> inline
494 scalar<T>& rem (const scalar<T>& dividend, const scalar<T>& divisor) NRVAL(r(dividend))
495 {
496  NRCODE(r.rem(divisor);)
497  NONRCODE(scalar<T> r(dividend); r.rem(divisor); return r;)
498 }
499 
500 template<class T> inline
501 scalar<T> sqrt (const scalar<T>& b) NRVAL(r(b))
502 {
503  NRCODE(r.sqrt();)
504  NONRCODE(scalar<T> r(b); r.sqrt(); return r;)
505 }
506 
507 template<class T> inline
508 unsigned long rem (const scalar<T>& b, unsigned long divisor)
509 {
510  scalar<T> r(b);
511  return r.rem(divisor);
512 }
513 
514 template<class T> inline
515 scalar<T>& BigIntFactorial (unsigned long n) NRVAL(r)
516 {
517  NRCODE(r.factorial(n);)
518  NONRCODE(scalar<T> r; r.factorial(n); return r;)
519 }
520 
521 template<class T> inline
522 scalar<T>& BigIntPow (unsigned long base, unsigned long exp) NRVAL(r)
523 {
524  NRCODE(r.pow(base, exp);)
525  NONRCODE(scalar<T> r; r.pow(base, exp); return r;)
526 }
527 
528 template<class T>
530 {
531  return abs(r);
532 }
533 //----------------------------------------------------------------------
534 
535 inline double rfloor(double x) { return floor(x); }
536 inline double rceil(double x) { return ceil(x); }
537 inline long int bit_size(double x) { return sizeof(double) * 8; }
538 } //namespace mmx
539 //======================================================================
540 #undef NRVAL
541 #undef NRCODE
542 #undef NONRCODE
543 #endif // //scalar_H
544 
545 
546 
547 
TMPL void rem(POLYNOMIAL &r, const POLYNOMIAL &a, const POLYNOMIAL &b)
Definition: polynomial_operators.hpp:73
bool operator>(const scalar< T > &rhs) const
scalar< T > & operator+=(const scalar< T > &rhs)
scalar()
Definition: scalar.hpp:37
T pow(const T &a, int i)
Definition: binomials.hpp:12
void neg(Interval< C, r > &a)
Definition: Interval_fcts.hpp:200
const C & b
Definition: Interval_glue.hpp:25
scalar< T > & operator=(const scalar< T > &rhs)
bool operator>=(const scalar< T > &rhs) const
QQ Size(const QQ &r)
Definition: GMPXX.hpp:64
scalar(double d)
Definition: scalar.hpp:41
void rem(const scalar< T > &divisor)
double gcd(const double &, const double &)
Definition: GMP.hpp:90
#define OPCODE(a, b, op)
Definition: scalar.hpp:269
T & rep()
Definition: scalar.hpp:30
scalar< T > & quo(const scalar< T > &dividend, unsigned long divisor)
Definition: scalar.hpp:487
#define NRCODE(code)
Definition: scalar.hpp:265
scalar< T > & operator%=(const scalar< T > &rhs)
void PowMod(const scalar< T > &exp, const scalar< T > &m)
extended< NT > operator-(const extended< NT > &lhs, const extended< NT > &rhs)
Definition: extended.hpp:132
extended< NT > operator/(const extended< NT > &lhs, const extended< NT > &rhs)
Definition: extended.hpp:111
scalar< T > & pow(unsigned long exp)
scalar< T > & operator-=(const scalar< T > &rhs)
shared_object< T > data
Definition: scalar.hpp:29
scalar(const scalar< R > &x)
Definition: scalar.hpp:40
#define NRVAL(name)
Definition: scalar.hpp:264
extended< NT > operator+(const extended< NT > &lhs, const extended< NT > &rhs)
Definition: extended.hpp:122
void Mul2Exp(unsigned long exponent_of_2)
bool operator<(const scalar< T > &rhs) const
void quo(const scalar< T > &divisor)
void Mod2Exp(unsigned long exponent_of_2)
bool operator<=(const scalar< T > &rhs) const
bool operator!=(const scalar< T > &rhs) const
scalar< T > & operator*=(const scalar< T > &rhs)
long int bit_size(const ZZ &z)
Definition: GMPXX.hpp:32
scalar< T > & negate()
void operator++()
scalar< T > & BigIntPow(unsigned long base, unsigned long exp) NRVAL(r)
Definition: scalar.hpp:522
scalar< T > & Div2Exp(const scalar< T > &b, unsigned long exponent_of_2)
Definition: scalar.hpp:409
#define NONRCODE(code)
Definition: scalar.hpp:266
double rceil(double x)
Definition: scalar.hpp:536
scalar< T > & operator/=(const scalar< T > &rhs)
scalar< T > & Mod2Exp(const scalar< T > &b, unsigned long exponent_of_2)
Definition: scalar.hpp:430
void abs(Interval< C, r > &x, const Interval< C, r > &a)
Definition: Interval_fcts.hpp:185
scalar< T > & GCD(const scalar< T > &b1, const scalar< T > &b2)
Definition: scalar.hpp:416
scalar< T > sqrt(const scalar< T > &b)
Definition: scalar.hpp:501
bool operator==(const scalar< T > &rhs) const
scalar< T > & operator%(const scalar< T > &b, unsigned long ul)
Definition: scalar.hpp:328
const T & rep() const
Definition: scalar.hpp:31
void factorial(unsigned long n)
void GCD(const scalar< T > &b2)
void operator--()
const C & c
Definition: Interval_glue.hpp:45
scalar< T > & BigIntFactorial(unsigned long n)
Definition: scalar.hpp:515
scalar< T > & PowMod(const scalar< T > &b, const scalar< T > &exp, const scalar< T > &m)
Definition: scalar.hpp:444
scalar(unsigned x)
Definition: scalar.hpp:48
void assign(A &a, const B &b)
Generic definition of the assignement function.
Definition: assign.hpp:97
Definition: array.hpp:12
double rfloor(double x)
Definition: scalar.hpp:535
extended< NT > operator*(const extended< NT > &lhs, const extended< NT > &rhs)
Definition: extended.hpp:101
scalar< T > & Mul2Exp(const scalar< T > &b, unsigned long exponent_of_2)
Definition: scalar.hpp:437
Definition: scalar.hpp:24
void Div2Exp(unsigned long exponent_of_2)
~scalar()
Definition: scalar.hpp:55
Home