[493c477] | 1 | /* emacs edit mode for this file is -*- C++ -*- */ |
---|
[f23b9a] | 2 | /* $Id: int_cf.h,v 1.10 1998-06-26 16:13:49 schmidt Exp $ */ |
---|
[2dd068] | 3 | |
---|
[493c477] | 4 | #ifndef INCL_INT_CF_H |
---|
| 5 | #define INCL_INT_CF_H |
---|
[2dd068] | 6 | |
---|
[9d7aaa] | 7 | #include <config.h> |
---|
| 8 | |
---|
[66d043] | 9 | #ifndef NOSTREAMIO |
---|
[2dd068] | 10 | #include <iostream.h> |
---|
[66d043] | 11 | #endif /* NOSTREAMIO */ |
---|
| 12 | |
---|
| 13 | #include "assert.h" |
---|
| 14 | |
---|
[2dd068] | 15 | #include "cf_defs.h" |
---|
| 16 | #include "variable.h" |
---|
| 17 | |
---|
| 18 | class CanonicalForm; |
---|
| 19 | |
---|
| 20 | class InternalCF { |
---|
| 21 | private: |
---|
| 22 | int refCount; |
---|
| 23 | protected: |
---|
| 24 | int getRefCount() { return refCount; }; |
---|
| 25 | void incRefCount() { refCount++; }; |
---|
| 26 | int decRefCount() { return --refCount; }; |
---|
| 27 | public: |
---|
| 28 | InternalCF() { refCount = 1; }; |
---|
| 29 | InternalCF( const InternalCF& ) |
---|
| 30 | { |
---|
[66d043] | 31 | ASSERT( 0, "ups there is something wrong in your code"); |
---|
| 32 | }; |
---|
[2dd068] | 33 | virtual ~InternalCF() {}; |
---|
| 34 | int deleteObject() { return decRefCount() == 0; } |
---|
| 35 | InternalCF* copyObject() { incRefCount(); return this; } |
---|
| 36 | virtual InternalCF* deepCopyObject() const PVIRT_INTCF("deepCopyObject"); |
---|
| 37 | virtual const char * const classname() const PVIRT_CHARCC("classname"); |
---|
| 38 | virtual InternalCF* genZero() PVIRT_INTCF("genZero"); |
---|
| 39 | virtual InternalCF* genOne() PVIRT_INTCF("genOne"); |
---|
| 40 | virtual int level() const { return LEVELBASE; } |
---|
| 41 | virtual int levelcoeff() const { return UndefinedDomain; } |
---|
| 42 | virtual int type() const { return UndefinedDomain; } |
---|
| 43 | virtual Variable variable() const { return Variable(); } |
---|
[66d043] | 44 | #ifndef NOSTREAMIO |
---|
[2dd068] | 45 | virtual void print( ostream&, char* ) PVIRT_VOID("print"); |
---|
[66d043] | 46 | #endif /* NOSTREAMIO */ |
---|
[2dd068] | 47 | virtual bool inBaseDomain() const { return true; } |
---|
| 48 | virtual bool inExtension() const { return false; } |
---|
| 49 | virtual bool inCoeffDomain() const { return true; } |
---|
| 50 | virtual bool inPolyDomain() const { return false; } |
---|
| 51 | virtual bool inQuotDomain() const { return false; } |
---|
[f23b9a] | 52 | virtual bool isZero() const; |
---|
| 53 | virtual bool isOne() const; |
---|
[2dd068] | 54 | virtual bool isUnivariate() const { return false; } |
---|
| 55 | virtual int intval() const; |
---|
| 56 | virtual int intmod( int ) const { return 0; } |
---|
[818a51] | 57 | virtual int sign() const PVIRT_INT("sign"); |
---|
[2dd068] | 58 | |
---|
| 59 | virtual InternalCF* num(); |
---|
| 60 | virtual InternalCF* den(); |
---|
| 61 | |
---|
| 62 | virtual InternalCF* neg() PVIRT_INTCF("neg"); |
---|
[05d0b3] | 63 | virtual InternalCF* invert(); // semantically const, changes refCount |
---|
[535f7b] | 64 | virtual int comparesame ( InternalCF * ) PVIRT_INT("comparesame"); |
---|
| 65 | virtual int comparecoeff ( InternalCF * ) PVIRT_INT("comparecoeff"); |
---|
[2dd068] | 66 | |
---|
| 67 | virtual InternalCF* addsame( InternalCF* ) PVIRT_INTCF("addsame"); |
---|
| 68 | virtual InternalCF* subsame( InternalCF* ) PVIRT_INTCF("subsame"); |
---|
| 69 | virtual InternalCF* mulsame( InternalCF* ) PVIRT_INTCF("mulsame"); |
---|
| 70 | virtual InternalCF* dividesame( InternalCF* ) PVIRT_INTCF("dividesame"); |
---|
| 71 | virtual InternalCF* modulosame( InternalCF* ) PVIRT_INTCF("modulosame"); |
---|
| 72 | virtual InternalCF* divsame( InternalCF* ) PVIRT_INTCF("divsame"); |
---|
| 73 | virtual InternalCF* modsame( InternalCF* ) PVIRT_INTCF("modsame"); |
---|
| 74 | virtual void divremsame( InternalCF*, InternalCF*&, InternalCF*& ) PVIRT_VOID("divremsame"); |
---|
| 75 | virtual bool divremsamet( InternalCF*, InternalCF*&, InternalCF*& ) PVIRT_BOOL("divremsamet"); |
---|
| 76 | |
---|
| 77 | virtual InternalCF* addcoeff( InternalCF* ) PVIRT_INTCF("addcoeff"); |
---|
| 78 | virtual InternalCF* subcoeff( InternalCF*, bool ) PVIRT_INTCF("subcoeff"); |
---|
| 79 | virtual InternalCF* mulcoeff( InternalCF* ) PVIRT_INTCF("mulcoeff"); |
---|
| 80 | virtual InternalCF* dividecoeff( InternalCF*, bool ) PVIRT_INTCF("dividecoeff"); |
---|
| 81 | virtual InternalCF* modulocoeff( InternalCF*, bool ) PVIRT_INTCF("dividecoeff"); |
---|
| 82 | virtual InternalCF* divcoeff( InternalCF*, bool ) PVIRT_INTCF("divcoeff"); |
---|
| 83 | virtual InternalCF* modcoeff( InternalCF*, bool ) PVIRT_INTCF("modcoeff"); |
---|
| 84 | virtual void divremcoeff( InternalCF*, InternalCF*&, InternalCF*&, bool ) PVIRT_VOID("divremcoeff"); |
---|
| 85 | virtual bool divremcoefft( InternalCF*, InternalCF*&, InternalCF*&, bool ) PVIRT_BOOL("divremcoefft"); |
---|
| 86 | |
---|
[05d0b3] | 87 | virtual InternalCF * bgcdsame ( const InternalCF * const ) const; |
---|
| 88 | virtual InternalCF * bgcdcoeff ( const InternalCF * const ); // semantically const, changes refcount |
---|
| 89 | |
---|
| 90 | virtual InternalCF * bextgcdsame ( InternalCF *, CanonicalForm &, CanonicalForm & ); // semantically const, changes refcount |
---|
| 91 | virtual InternalCF * bextgcdcoeff ( InternalCF *, CanonicalForm &, CanonicalForm & ); // semantically const, changes refcount |
---|
| 92 | |
---|
[2dd068] | 93 | virtual InternalCF* sqrt(); |
---|
[240392] | 94 | virtual int ilog2(); |
---|
[2dd068] | 95 | virtual CanonicalForm lc(); |
---|
[7e0be1] | 96 | virtual CanonicalForm Lc(); |
---|
[2dd068] | 97 | virtual CanonicalForm LC(); |
---|
| 98 | virtual CanonicalForm coeff( int i ); |
---|
| 99 | virtual int degree(); |
---|
| 100 | virtual int taildegree(); |
---|
| 101 | virtual CanonicalForm tailcoeff(); |
---|
| 102 | }; |
---|
| 103 | |
---|
[493c477] | 104 | #endif /* ! INCL_INT_CF_H */ |
---|