source: git/factory/int_cf.h @ 80b8fe

spielwiese
Last change on this file since 80b8fe was abddbe, checked in by Martin Lee <martinlee84@…>, 10 years ago
chg: added brief descriptions to some files
  • Property mode set to 100644
File size: 5.3 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
28class CanonicalForm;
29
30/**
31 * virtual class for internal CanonicalForm's
32 *
33 * InternalCF will become an InternalPoly, InternalInteger, InternalRational
34**/
35class InternalCF {
36private:
37    int refCount;
38protected:
39    int getRefCount() { return refCount; };
40    void incRefCount() { refCount++; };
41    int decRefCount() { return --refCount; };
42public:
43    InternalCF() { refCount = 1; };
44    InternalCF( const InternalCF& )
45    {
46        ASSERT( 0, "ups there is something wrong in your code");
47    };
48    virtual ~InternalCF() {};
49    int deleteObject() { return decRefCount() == 0; }
50    InternalCF* copyObject() { incRefCount(); return this; }
51    virtual InternalCF* deepCopyObject() const PVIRT_INTCF("deepCopyObject");
52    virtual const char * classname() const PVIRT_CHARCC("classname");
53    virtual InternalCF* genZero() PVIRT_INTCF("genZero");
54    virtual InternalCF* genOne() PVIRT_INTCF("genOne");
55    virtual int level() const { return LEVELBASE; }
56    virtual int levelcoeff() const { return UndefinedDomain; }
57    virtual int type() const { return UndefinedDomain; }
58    virtual Variable variable() const { return Variable(); }
59#ifndef NOSTREAMIO
60    virtual void print( OSTREAM&, char* ) PVIRT_VOID("print");
61#endif /* NOSTREAMIO */
62    virtual bool inBaseDomain() const { return true; }
63    virtual bool inExtension() const { return false; }
64    virtual bool inCoeffDomain() const { return true; }
65    virtual bool inPolyDomain() const { return false; }
66    virtual bool inQuotDomain() const { return false; }
67    virtual bool isZero() const;
68    virtual bool isOne() const;
69    virtual bool isUnivariate() const { return false; }
70    virtual long intval() const;
71    virtual int intmod( int ) const { return 0; }
72    virtual int sign() const PVIRT_INT("sign");
73
74    virtual InternalCF* num();
75    virtual InternalCF* den();
76
77    virtual InternalCF* neg() PVIRT_INTCF("neg");
78    virtual InternalCF* invert(); // semantically const, changes refCount
79    virtual InternalCF* tryInvert( const CanonicalForm&, bool& );
80    virtual int comparesame ( InternalCF * ) PVIRT_INT("comparesame");
81    virtual int comparecoeff ( InternalCF * ) PVIRT_INT("comparecoeff");
82
83    virtual InternalCF* addsame( InternalCF* ) PVIRT_INTCF("addsame");
84    virtual InternalCF* subsame( InternalCF* ) PVIRT_INTCF("subsame");
85    virtual InternalCF* mulsame( InternalCF* ) PVIRT_INTCF("mulsame");
86    virtual InternalCF* tryMulsame( InternalCF*, const CanonicalForm& );
87    virtual InternalCF* dividesame( InternalCF* ) PVIRT_INTCF("dividesame");
88    virtual InternalCF* modulosame( InternalCF* ) PVIRT_INTCF("modulosame");
89    virtual InternalCF* divsame( InternalCF* ) PVIRT_INTCF("divsame");
90    virtual InternalCF* tryDivsame ( InternalCF* , const CanonicalForm&, bool& );
91    virtual InternalCF* modsame( InternalCF* ) PVIRT_INTCF("modsame");
92    virtual void divremsame( InternalCF*, InternalCF*&, InternalCF*& ) PVIRT_VOID("divremsame");
93    virtual bool divremsamet( InternalCF*, InternalCF*&, InternalCF*& ) PVIRT_BOOL("divremsamet");
94    virtual bool tryDivremsamet ( InternalCF*, InternalCF*&, InternalCF*&, const CanonicalForm&, bool& );
95
96    virtual InternalCF* addcoeff( InternalCF* ) PVIRT_INTCF("addcoeff");
97    virtual InternalCF* subcoeff( InternalCF*, bool ) PVIRT_INTCF("subcoeff");
98    virtual InternalCF* mulcoeff( InternalCF* ) PVIRT_INTCF("mulcoeff");
99    virtual InternalCF* dividecoeff( InternalCF*, bool ) PVIRT_INTCF("dividecoeff");
100    virtual InternalCF* tryDividecoeff ( InternalCF*, bool, const CanonicalForm&, bool& );
101    virtual InternalCF* modulocoeff( InternalCF*, bool ) PVIRT_INTCF("dividecoeff");
102    virtual InternalCF* divcoeff( InternalCF*, bool ) PVIRT_INTCF("divcoeff");
103    virtual InternalCF* tryDivcoeff ( InternalCF*, bool, const CanonicalForm&, bool& );
104    virtual InternalCF* modcoeff( InternalCF*, bool ) PVIRT_INTCF("modcoeff");
105    virtual void divremcoeff( InternalCF*, InternalCF*&, InternalCF*&, bool ) PVIRT_VOID("divremcoeff");
106    virtual bool divremcoefft( InternalCF*, InternalCF*&, InternalCF*&, bool ) PVIRT_BOOL("divremcoefft");
107    virtual bool tryDivremcoefft( InternalCF*, InternalCF*&, InternalCF*&, bool, const CanonicalForm&, bool& );
108
109    virtual InternalCF * bgcdsame ( const InternalCF * const ) const;
110    virtual InternalCF * bgcdcoeff ( const InternalCF * const ); // semantically const, changes refcount
111
112    virtual InternalCF * bextgcdsame ( InternalCF *, CanonicalForm &, CanonicalForm & ); // semantically const, changes refcount
113    virtual InternalCF * bextgcdcoeff ( InternalCF *, CanonicalForm &, CanonicalForm & ); // semantically const, changes refcount
114
115    virtual InternalCF* sqrt();
116    virtual int ilog2();
117    virtual CanonicalForm lc();
118    virtual CanonicalForm Lc();
119    virtual CanonicalForm LC();
120    virtual CanonicalForm coeff( int i );
121    virtual int degree();
122    virtual int taildegree();
123    virtual CanonicalForm tailcoeff();
124};
125
126#endif /* ! INCL_INT_CF_H */
Note: See TracBrowser for help on using the repository browser.