source: git/factory/int_cf.h @ 3ace5b6

spielwiese
Last change on this file since 3ace5b6 was 362fc67, checked in by Martin Lee <martinlee84@…>, 12 years ago
chg: remove $Id$
  • Property mode set to 100644
File size: 5.1 KB
Line 
1/* emacs edit mode for this file is -*- C++ -*- */
2
3#ifndef INCL_INT_CF_H
4#define INCL_INT_CF_H
5
6// #include "config.h"
7
8#ifndef NOSTREAMIO
9#ifdef HAVE_IOSTREAM
10#include <iostream>
11#define OSTREAM std::ostream
12#elif defined(HAVE_IOSTREAM_H)
13#include <iostream.h>
14#define OSTREAM ostream
15#endif
16#endif /* NOSTREAMIO */
17
18#include "cf_assert.h"
19
20#include "cf_defs.h"
21#include "variable.h"
22
23class CanonicalForm;
24
25class InternalCF {
26private:
27    int refCount;
28protected:
29    int getRefCount() { return refCount; };
30    void incRefCount() { refCount++; };
31    int decRefCount() { return --refCount; };
32public:
33    InternalCF() { refCount = 1; };
34    InternalCF( const InternalCF& )
35    {
36        ASSERT( 0, "ups there is something wrong in your code");
37    };
38    virtual ~InternalCF() {};
39    int deleteObject() { return decRefCount() == 0; }
40    InternalCF* copyObject() { incRefCount(); return this; }
41    virtual InternalCF* deepCopyObject() const PVIRT_INTCF("deepCopyObject");
42    virtual const char * classname() const PVIRT_CHARCC("classname");
43    virtual InternalCF* genZero() PVIRT_INTCF("genZero");
44    virtual InternalCF* genOne() PVIRT_INTCF("genOne");
45    virtual int level() const { return LEVELBASE; }
46    virtual int levelcoeff() const { return UndefinedDomain; }
47    virtual int type() const { return UndefinedDomain; }
48    virtual Variable variable() const { return Variable(); }
49#ifndef NOSTREAMIO
50    virtual void print( OSTREAM&, char* ) PVIRT_VOID("print");
51#endif /* NOSTREAMIO */
52    virtual bool inBaseDomain() const { return true; }
53    virtual bool inExtension() const { return false; }
54    virtual bool inCoeffDomain() const { return true; }
55    virtual bool inPolyDomain() const { return false; }
56    virtual bool inQuotDomain() const { return false; }
57    virtual bool isZero() const;
58    virtual bool isOne() const;
59    virtual bool isUnivariate() const { return false; }
60    virtual int intval() const;
61    virtual int intmod( int ) const { return 0; }
62    virtual int sign() const PVIRT_INT("sign");
63
64    virtual InternalCF* num();
65    virtual InternalCF* den();
66
67    virtual InternalCF* neg() PVIRT_INTCF("neg");
68    virtual InternalCF* invert(); // semantically const, changes refCount
69    virtual InternalCF* tryInvert( const CanonicalForm&, bool& );
70    virtual int comparesame ( InternalCF * ) PVIRT_INT("comparesame");
71    virtual int comparecoeff ( InternalCF * ) PVIRT_INT("comparecoeff");
72
73    virtual InternalCF* addsame( InternalCF* ) PVIRT_INTCF("addsame");
74    virtual InternalCF* subsame( InternalCF* ) PVIRT_INTCF("subsame");
75    virtual InternalCF* mulsame( InternalCF* ) PVIRT_INTCF("mulsame");
76    virtual InternalCF* tryMulsame( InternalCF*, const CanonicalForm& );
77    virtual InternalCF* dividesame( InternalCF* ) PVIRT_INTCF("dividesame");
78    virtual InternalCF* modulosame( InternalCF* ) PVIRT_INTCF("modulosame");
79    virtual InternalCF* divsame( InternalCF* ) PVIRT_INTCF("divsame");
80    virtual InternalCF* tryDivsame ( InternalCF* , const CanonicalForm&, bool& );
81    virtual InternalCF* modsame( InternalCF* ) PVIRT_INTCF("modsame");
82    virtual void divremsame( InternalCF*, InternalCF*&, InternalCF*& ) PVIRT_VOID("divremsame");
83    virtual bool divremsamet( InternalCF*, InternalCF*&, InternalCF*& ) PVIRT_BOOL("divremsamet");
84    virtual bool tryDivremsamet ( InternalCF*, InternalCF*&, InternalCF*&, const CanonicalForm&, bool& );
85
86    virtual InternalCF* addcoeff( InternalCF* ) PVIRT_INTCF("addcoeff");
87    virtual InternalCF* subcoeff( InternalCF*, bool ) PVIRT_INTCF("subcoeff");
88    virtual InternalCF* mulcoeff( InternalCF* ) PVIRT_INTCF("mulcoeff");
89    virtual InternalCF* dividecoeff( InternalCF*, bool ) PVIRT_INTCF("dividecoeff");
90    virtual InternalCF* tryDividecoeff ( InternalCF*, bool, const CanonicalForm&, bool& );
91    virtual InternalCF* modulocoeff( InternalCF*, bool ) PVIRT_INTCF("dividecoeff");
92    virtual InternalCF* divcoeff( InternalCF*, bool ) PVIRT_INTCF("divcoeff");
93    virtual InternalCF* tryDivcoeff ( InternalCF*, bool, const CanonicalForm&, bool& );
94    virtual InternalCF* modcoeff( InternalCF*, bool ) PVIRT_INTCF("modcoeff");
95    virtual void divremcoeff( InternalCF*, InternalCF*&, InternalCF*&, bool ) PVIRT_VOID("divremcoeff");
96    virtual bool divremcoefft( InternalCF*, InternalCF*&, InternalCF*&, bool ) PVIRT_BOOL("divremcoefft");
97    virtual bool tryDivremcoefft( InternalCF*, InternalCF*&, InternalCF*&, bool, const CanonicalForm&, bool& );
98
99    virtual InternalCF * bgcdsame ( const InternalCF * const ) const;
100    virtual InternalCF * bgcdcoeff ( const InternalCF * const ); // semantically const, changes refcount
101
102    virtual InternalCF * bextgcdsame ( InternalCF *, CanonicalForm &, CanonicalForm & ); // semantically const, changes refcount
103    virtual InternalCF * bextgcdcoeff ( InternalCF *, CanonicalForm &, CanonicalForm & ); // semantically const, changes refcount
104
105    virtual InternalCF* sqrt();
106    virtual int ilog2();
107    virtual CanonicalForm lc();
108    virtual CanonicalForm Lc();
109    virtual CanonicalForm LC();
110    virtual CanonicalForm coeff( int i );
111    virtual int degree();
112    virtual int taildegree();
113    virtual CanonicalForm tailcoeff();
114};
115
116#endif /* ! INCL_INT_CF_H */
Note: See TracBrowser for help on using the repository browser.