/usr/include/givaro/givinteger.h is in libgivaro-dev 3.2.13-1.2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 | #ifndef _INTEGER_H_
#define _INTEGER_H_
// =============================================================
// Copyright(c)'94-02 by Givaro Team
// see the copyright file.
// Authors: T. Gautier, J.-G. Dumas
// =============================================================
// Description:
// Integer Domain class definition
#include "givaro/givbasictype.h"
#include "givaro/givinit.h"
#include "givaro/giverror.h"
#include "givaro-config.h"
#include "gmp++/gmp++.h"
#include <string>
//------------------------------------ Class IntegerDom
class IntegerDom : public Integer {
public:
typedef Integer Rep;
typedef Rep Element;
IntegerDom() : one(1UL), zero(0UL) {}
IntegerDom(const IntegerDom& D) : one(1UL), zero(0UL) {}
int operator==( const IntegerDom& BC) const { return 1;}
int operator!=( const IntegerDom& BC) const { return 0;}
// -- Constants:
const Integer one;
const Integer zero;
// -- assignement
Rep& init ( Rep& a ) const {return a;}
Rep& init ( Rep& a, const Rep& b) const { return a = b ; }
Rep& read( Rep& a, const long i) const { return a = Integer(i) ; }
Rep& read( Rep& a, const unsigned long i) const { return a = Integer(i) ; }
Rep& read( Rep& a, const int i) const { return a = Integer(i) ; }
Rep& read( Rep& a, const unsigned int i) const { return a = Integer(i) ; }
Rep& convert( Rep& a, const Rep& b) const { return a = b ; }
Rep& assign( Rep& a, const Rep& b) const { return a = b ; }
// -- access
const Rep& access(const Rep& a) const { return a; }
template<class XXX> XXX& convert(XXX& x, const Rep& a) const { return x=(XXX)a;}
// -- arithmetic operators
Rep& mul( Rep& r, const Rep& a, const Rep& b ) const { return Integer::mul(r,a,b); }
Rep& div( Rep& r, const Rep& a, const Rep& b ) const { return Integer::div(r,a,b); }
Rep& mod( Rep& r, const Rep& a, const Rep& b ) const { return Integer::mod(r,a,b); }
Rep& add( Rep& r, const Rep& a, const Rep& b ) const { return Integer::add(r,a,b); }
Rep& sub( Rep& r, const Rep& a, const Rep& b ) const { return Integer::sub(r,a,b); }
Rep& divmod( Rep& q, Rep& r, const Rep& a, const Rep& b ) const
{ return Integer::divmod(q,r,a,b); }
Rep& divexact( Rep& q, const Rep& a, const Rep& b ) const { return Integer::divexact(q,a,b); }
Rep& mulin( Rep& r, const Rep& a) const { return r *= a; }
Rep& divin( Rep& r, const Rep& a) const { return r /= a; }
Rep& modin( Rep& r, const Rep& a) const { return r %= a; }
Rep& addin( Rep& r, const Rep& a) const { return r += a; }
Rep& subin( Rep& r, const Rep& a) const { return r -= a; }
Rep& axpy( Rep& r, const Rep& a, const Rep& b, const Rep& c ) const
{ return Integer::axpy(r,a,b,c); }
Rep& amxy( Rep& r, const Rep& a, const Rep& b, const Rep& c ) const
{ return Integer::amxy(r,a,b,c); }
Rep& axmy( Rep& r, const Rep& a, const Rep& b, const Rep& c ) const
{ return Integer::axmy(r,a,b,c); }
Rep& axpyin( Rep& r, const Rep& a, const Rep& b ) const
{ return r += a * b; }
Rep& axmyin( Rep& r, const Rep& a, const Rep& b ) const
{ return r -= a * b; }
// -- unary methods
Rep& neg( Rep& r, const Rep& a ) const { return Integer::neg(r,a); }
Rep& negin( Rep& r ) const { return Integer::negin(r); }
// -- extended gcd q = gcd(a,b) = u*a+v*b;
Rep& gcd( Rep& g, Rep& u, Rep& v, const Rep& a, const Rep& b ) const
{ return ::gcd(g, a, b, u, v); }
Rep& gcd( Rep& g, const Rep& a, const Rep& b ) const
{ return ::gcd(g, a, b); }
Rep& lcm( Rep& l, const Rep& a, const Rep& b ) const
{ return ::lcm(l, a, b); }
Rep& lcmin( Rep& l, const Rep& a) const
{ Rep tmp(l); return lcm(l, tmp, a); }
// - return n^l
Rep& pow(Rep& r, const Rep& n, const long l) const { return r = ::pow(n, l); }
Rep& pow(Rep& r, const Rep& n, const unsigned long l) const { return r = ::pow(n, l); }
Rep& pow(Rep& r, const Rep& n, const int l) const { return r = ::pow(n, (long)l); }
Rep& pow(Rep& r, const Rep& n, const unsigned int l) const { return r = ::pow(n, (unsigned long)l); }
// - return square root of n
Rep& sqrt(Rep& s, const Rep& n) const { return ::sqrt(s,n); }
Rep& sqrt(Rep& s, Rep& r, const Rep& n) const { return ::sqrtrem(s,n, r); }
// - base p logarithm of a
long logp(const Rep& a, const Rep& p) const { return ::logp(a,p); }
// - return n^e % m
Rep& powmod(Rep& r, const Rep& n, const long e, const Rep& m) const
{ return r = ::powmod(n, e, m);}
Rep& powmod(Rep& r, const Rep& n, const Rep& e, const Rep& m) const
{ return r = ::powmod(n, e, m);}
// - Misc
unsigned long length (const Rep& a) const { return ::length(a); }
int sign (const Rep& a) const { return ::sign(a); }
bool isZero (const Rep& a) const { return ::isZero(a); }
bool isOne (const Rep& a) const { return ::isOne(a); }
bool areEqual (const Rep& a, const Rep& b) const { return compare(a,b) ==0;}
bool areNEqual(const Rep& a, const Rep& b) const { return compare(a,b) !=0;}
bool isgeq(const Rep& a, const Rep& b) const { return compare(a,b) >= 0;}
bool isleq(const Rep& a, const Rep& b) const { return compare(a,b) <= 0;}
bool isgeq(const long b,const Rep& a ) const { return isgeq(Rep(b),a);}
bool isleq(const long b,const Rep& a ) const { return isleq(Rep(b),a);}
bool isgeq(const Rep& a, const long b) const { return isgeq(a,Rep(b));}
bool isleq(const Rep& a, const long b) const { return isleq(a,Rep(b));}
bool isgt(const Rep& a, const Rep& b) const { return compare(a,b) > 0;}
bool islt(const Rep& a, const Rep& b) const { return compare(a,b) < 0;}
bool isgt(const long b,const Rep& a ) const { return isgt(Rep(b),a);}
bool islt(const long b,const Rep& a ) const { return islt(Rep(b),a);}
bool isgt(const Rep& a, const long b) const { return isgt(a,Rep(b));}
bool islt(const Rep& a, const long b) const { return islt(a,Rep(b));}
#ifdef __GMP_PLUSPLUS__
void seeding(unsigned long s = 0) const { Integer::seeding(s) ; }
#endif
template< class RandIter > Rep& random(RandIter& g, Rep& r, long s = 1) const { return Integer::random(r,s); }
template< class RandIter > Rep& random(RandIter& g, Rep& r, const Rep& b) const { return Integer::random(r,b); }
template< class RandIter > Rep& nonzerorandom(RandIter& g, Rep& r, long s = 1) const { return Integer::nonzerorandom(r,s); }
template< class RandIter > Rep& nonzerorandom (RandIter& g,Rep& r, const Rep& b) const { return Integer::nonzerorandom(r,b); }
// -- IO
std::istream& read ( std::istream& i )
{ char ch;
i >> std::ws >> ch;
// JGD 22.03.03
// if (ch != 'I')
// GivError::throw_error(GivBadFormat("IntegerDom::read: bad signature domain"));
return i;
}
std::ostream& write( std::ostream& o ) const { return o << 'I'; }
std::istream& read ( std::istream& i, Rep& n) const { return i >> n; }
std::ostream& write( std::ostream& o, const Rep& n) const { return o << n; }
};
#endif //__INT_H_
|