source: git/factory/int_cf.h @ 72ebdb

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