My Project
Loading...
Searching...
No Matches
GMPrat.h
Go to the documentation of this file.
1// ----------------------------------------------------------------------------
2// GMPrat.h
3// begin of file
4// originally written by Gerd Sussner, sussner@mi.uni-erlangen.de
5// copied by Stephan Endrass, endrass@mathematik.uni-mainz.de
6// 23.7.99
7// ----------------------------------------------------------------------------
8
9#ifndef GMPRAT_H
10#define GMPRAT_H
11
12#include "coeffs/si_gmp.h"
13
15{
16 struct rep
17 {
18 mpq_t rat;
19 int n;
20 rep() { n=1; }
21 };
22
24
25 void disconnect();
26
27 public:
28
29 Rational( );
30 Rational( int );
31 Rational( const Rational& );
32 Rational( const Rational&,const Rational& );
33 Rational( int,int );
34 ~Rational( );
35
36 Rational& operator = ( int );
38 Rational& operator = ( const Rational& );
39
40 unsigned int length( ) const;
43 int get_num_si( );
44 int get_den_si( );
45 operator int( );
46
57
58 friend Rational operator - ( const Rational& );
59
60 friend bool operator < ( const Rational&,const Rational& );
61 friend bool operator <= ( const Rational&,const Rational& );
62 friend bool operator > ( const Rational&,const Rational& );
63 friend bool operator >= ( const Rational&,const Rational& );
64 friend bool operator == ( const Rational&,const Rational& );
65 friend bool operator != ( const Rational&,const Rational& );
66
67 #ifdef GMPRAT_PRINT
68 friend ostream& operator<<( ostream&,const Rational& );
69 #endif
70
71 friend int sgn ( const Rational& );
72 friend Rational abs ( const Rational& );
73 friend Rational pow ( const Rational&,int );
74
75 double complexity( ) const;
76
77 friend Rational gcd ( const Rational&, const Rational& );
78 friend Rational lcm ( const Rational&, const Rational& );
79 friend Rational gcd ( Rational*, int );
80 friend Rational lcm ( Rational*, int );
81};
82
83Rational operator + ( const Rational&, const Rational& );
84Rational operator - ( const Rational&, const Rational& );
85Rational operator * ( const Rational&, const Rational& );
86Rational operator / ( const Rational&, const Rational& );
87
88#endif /* GMPRAT_H */
89
90// ----------------------------------------------------------------------------
91// GMPrat.h
92// end of file
93// ----------------------------------------------------------------------------
94
Rational operator+(const Rational &, const Rational &)
Definition: GMPrat.cc:385
Rational operator*(const Rational &, const Rational &)
Definition: GMPrat.cc:403
Rational operator-(const Rational &, const Rational &)
Definition: GMPrat.cc:394
Rational operator/(const Rational &, const Rational &)
Definition: GMPrat.cc:422
friend Rational lcm(const Rational &, const Rational &)
Definition: GMPrat.cc:495
Rational & operator*=(const Rational &)
Definition: GMPrat.cc:229
int get_num_si()
Definition: GMPrat.cc:138
friend bool operator>(const Rational &, const Rational &)
Definition: GMPrat.cc:300
friend bool operator<=(const Rational &, const Rational &)
Definition: GMPrat.cc:294
rep * p
Definition: GMPrat.h:23
friend Rational pow(const Rational &, int)
Definition: GMPrat.cc:411
Rational()
Definition: GMPrat.cc:45
friend bool operator>=(const Rational &, const Rational &)
Definition: GMPrat.cc:306
Rational & operator--()
Definition: GMPrat.cc:267
friend Rational abs(const Rational &)
Definition: GMPrat.cc:436
Rational & operator-=(const Rational &)
Definition: GMPrat.cc:221
~Rational()
Definition: GMPrat.cc:88
Rational operator~()
Definition: GMPrat.cc:200
double complexity() const
Definition: GMPrat.cc:526
int get_den_si()
Definition: GMPrat.cc:152
Rational & operator++()
Definition: GMPrat.cc:249
Rational get_num()
Definition: GMPrat.cc:129
friend Rational gcd(const Rational &, const Rational &)
Definition: GMPrat.cc:448
Rational operator-()
Definition: GMPrat.cc:179
friend int sgn(const Rational &)
Definition: GMPrat.cc:430
friend bool operator!=(const Rational &, const Rational &)
Definition: GMPrat.cc:318
unsigned int length() const
Definition: GMPrat.cc:362
Rational & operator+=(const Rational &)
Definition: GMPrat.cc:213
Rational & operator=(int)
Definition: GMPrat.cc:101
void disconnect()
Definition: GMPrat.cc:29
Rational get_den()
Definition: GMPrat.cc:143
Rational & operator/=(const Rational &)
Definition: GMPrat.cc:237
friend bool operator==(const Rational &, const Rational &)
Definition: GMPrat.cc:312
friend bool operator<(const Rational &, const Rational &)
Definition: GMPrat.cc:288
const CanonicalForm int s
Definition: facAbsFact.cc:51
ostream & operator<<(ostream &s, const spectrum &spec)
Definition: semic.cc:249
mpq_t rat
Definition: GMPrat.h:18