File: mpr_base.h

package info (click to toggle)
singular 1%3A4.0.3-p3%2Bds-5
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 33,040 kB
  • ctags: 19,347
  • sloc: cpp: 271,589; ansic: 13,500; lisp: 4,242; yacc: 1,656; lex: 1,377; makefile: 1,264; perl: 632; sh: 467; python: 233; xml: 182
file content (123 lines) | stat: -rw-r--r-- 2,975 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#ifndef MPR_BASE_H
#define MPR_BASE_H
/****************************************
*  Computer Algebra System SINGULAR     *
****************************************/

/*
* ABSTRACT - multipolynomial resultants - resultant matrices
*            ( sparse, dense, u-resultant solver )
*/

#include <kernel/numeric/mpr_numeric.h>

#define SNONE -1
#define SFREE -2

//%s
//-> class resMatrixBase
/**
 * Base class for sparse and dense u-Resultant computation
 */
class resMatrixBase
{
public:
  /* state of the resultant */
  enum IStateType { none, ready, notInit, fatalError, sparseError };

  resMatrixBase() : istate(notInit), totDeg(0) {}
  virtual ~resMatrixBase() {}

  virtual ideal getMatrix() { return NULL; }
  virtual ideal getSubMatrix() { return NULL; }

  virtual poly getUDet( const number* /*evpoint*/ ) { return NULL; }

  virtual number getDetAt( const number* /*evpoint*/ ) { return NULL; }
  virtual number getSubDet() { return NULL; }

  virtual long getDetDeg() { return totDeg; }

  virtual IStateType initState() const { return istate; }

protected:
  IStateType istate;

  ideal gls;
  int linPolyS;
  ring sourceRing;

  int totDeg;

private:
  /* disables the copy constructor */
  resMatrixBase( const resMatrixBase & );
};
//<-

//-> class uResultant
/**
 * Base class for solving 0-dim poly systems using u-resultant
 */
class uResultant
{
public:
  enum resMatType { none, sparseResMat, denseResMat };

  uResultant( const ideal _gls, const resMatType _rmt= sparseResMat, BOOLEAN extIdeal= true );
  ~uResultant();

  poly interpolateDense( const number subDetVal= NULL );

  /* Interpolates n+1 determinat polys for coeff specializations. */
  rootContainer ** interpolateDenseSP( BOOLEAN matchUp= false, const number subDetVal= NULL );

  /* Uses Bareiss */
  rootContainer ** specializeInU( BOOLEAN matchUp= false, const number subDetVal= NULL );

  resMatrixBase * accessResMat() { return resMat; }

private:
  /* deactivated copy constructor */
  uResultant( const uResultant & );

  ideal extendIdeal( const ideal gls, poly linPoly, const resMatType rmt );
  poly linearPoly( const resMatType rmt );
  int nextPrime( const int p );

  ideal gls;
  int n;

  resMatType rmt;        // sparse or dense resultant matrix ?
  resMatrixBase *resMat; // pointer to base resultant matrix class
};
//<-
uResultant::resMatType determineMType( int imtype );
enum mprState
{
    mprOk,
    mprWrongRType,
    mprHasOne,
    mprInfNumOfVars,
    mprNotReduced,
    mprNotZeroDim,
    mprNotHomog,
    mprUnSupField
};

mprState mprIdealCheck( const ideal theIdeal,
                        const char * name,
                        uResultant::resMatType mtype,
                        BOOLEAN rmatrix= false );

ideal loNewtonPolytope( const ideal id );

extern size_t gmp_output_digits;
//%e
#endif /*MPR_BASE_H*/

// local Variables: ***
// folded-file: t ***
// compile-command-2: "make install" ***
// compile-command: "make installg" ***
// End: ***