1 | #ifndef MPR_BASE_H |
---|
2 | #define MPR_BASE_H |
---|
3 | /**************************************** |
---|
4 | * Computer Algebra System SINGULAR * |
---|
5 | ****************************************/ |
---|
6 | |
---|
7 | /* |
---|
8 | * ABSTRACT - multipolynomial resultants - resultant matrices |
---|
9 | * ( sparse, dense, u-resultant solver ) |
---|
10 | */ |
---|
11 | |
---|
12 | #include <numeric/mpr_numeric.h> |
---|
13 | |
---|
14 | #define SNONE -1 |
---|
15 | #define SFREE -2 |
---|
16 | |
---|
17 | //%s |
---|
18 | //-> class resMatrixBase |
---|
19 | /** |
---|
20 | * Base class for sparse and dense u-Resultant computation |
---|
21 | */ |
---|
22 | class resMatrixBase |
---|
23 | { |
---|
24 | public: |
---|
25 | /* state of the resultant */ |
---|
26 | enum IStateType { none, ready, notInit, fatalError, sparseError }; |
---|
27 | |
---|
28 | resMatrixBase() : istate(notInit), totDeg(0) {} |
---|
29 | virtual ~resMatrixBase() {} |
---|
30 | |
---|
31 | virtual ideal getMatrix() { return NULL; } |
---|
32 | virtual ideal getSubMatrix() { return NULL; } |
---|
33 | |
---|
34 | virtual poly getUDet( const number* /*evpoint*/ ) { return NULL; } |
---|
35 | |
---|
36 | virtual number getDetAt( const number* /*evpoint*/ ) { return NULL; } |
---|
37 | virtual number getSubDet() { return NULL; } |
---|
38 | |
---|
39 | virtual long getDetDeg() { return totDeg; } |
---|
40 | |
---|
41 | virtual IStateType initState() const { return istate; } |
---|
42 | |
---|
43 | protected: |
---|
44 | IStateType istate; |
---|
45 | |
---|
46 | ideal gls; |
---|
47 | int linPolyS; |
---|
48 | ring sourceRing; |
---|
49 | |
---|
50 | int totDeg; |
---|
51 | |
---|
52 | private: |
---|
53 | /* disables the copy constructor */ |
---|
54 | resMatrixBase( const resMatrixBase & ); |
---|
55 | }; |
---|
56 | //<- |
---|
57 | |
---|
58 | //-> class uResultant |
---|
59 | /** |
---|
60 | * Base class for solving 0-dim poly systems using u-resultant |
---|
61 | */ |
---|
62 | class uResultant |
---|
63 | { |
---|
64 | public: |
---|
65 | enum resMatType { none, sparseResMat, denseResMat }; |
---|
66 | |
---|
67 | uResultant( const ideal _gls, const resMatType _rmt= sparseResMat, BOOLEAN extIdeal= true ); |
---|
68 | ~uResultant(); |
---|
69 | |
---|
70 | poly interpolateDense( const number subDetVal= NULL ); |
---|
71 | |
---|
72 | /* Interpolates n+1 determinat polys for coeff specializations. */ |
---|
73 | rootContainer ** interpolateDenseSP( BOOLEAN matchUp= false, const number subDetVal= NULL ); |
---|
74 | |
---|
75 | /* Uses Bareiss */ |
---|
76 | rootContainer ** specializeInU( BOOLEAN matchUp= false, const number subDetVal= NULL ); |
---|
77 | |
---|
78 | resMatrixBase * accessResMat() { return resMat; } |
---|
79 | |
---|
80 | private: |
---|
81 | /* deactivated copy constructor */ |
---|
82 | uResultant( const uResultant & ); |
---|
83 | |
---|
84 | ideal extendIdeal( const ideal gls, poly linPoly, const resMatType rmt ); |
---|
85 | poly linearPoly( const resMatType rmt ); |
---|
86 | int nextPrime( const int p ); |
---|
87 | |
---|
88 | ideal gls; |
---|
89 | int n; |
---|
90 | |
---|
91 | resMatType rmt; // sparse or dense resultant matrix ? |
---|
92 | resMatrixBase *resMat; // pointer to base resultant matrix class |
---|
93 | }; |
---|
94 | //<- |
---|
95 | uResultant::resMatType determineMType( int imtype ); |
---|
96 | enum mprState |
---|
97 | { |
---|
98 | mprOk, |
---|
99 | mprWrongRType, |
---|
100 | mprHasOne, |
---|
101 | mprInfNumOfVars, |
---|
102 | mprNotReduced, |
---|
103 | mprNotZeroDim, |
---|
104 | mprNotHomog, |
---|
105 | mprUnSupField |
---|
106 | }; |
---|
107 | |
---|
108 | mprState mprIdealCheck( const ideal theIdeal, |
---|
109 | const char * name, |
---|
110 | uResultant::resMatType mtype, |
---|
111 | BOOLEAN rmatrix= false ); |
---|
112 | |
---|
113 | ideal loNewtonPolytope( const ideal id ); |
---|
114 | |
---|
115 | extern size_t gmp_output_digits; |
---|
116 | //%e |
---|
117 | #endif /*MPR_BASE_H*/ |
---|
118 | |
---|
119 | // local Variables: *** |
---|
120 | // folded-file: t *** |
---|
121 | // compile-command-2: "make install" *** |
---|
122 | // compile-command: "make installg" *** |
---|
123 | // End: *** |
---|