source: git/factory/int_cf.h @ 9383ae

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