My Project  UNKNOWN_GIT_VERSION
Public Member Functions | Private Member Functions | Private Attributes
resMatrixDense Class Reference

Public Member Functions

 resMatrixDense (const ideal _gls, const int special=SNONE)
 _gls: system of multivariate polynoms special: -1 -> resMatrixDense is a symbolic matrix 0,1, ... More...
 
 ~resMatrixDense ()
 
resVectorgetMVector (const int i)
 column vector of matrix, index von 0 ... More...
 
ideal getMatrix ()
 Returns the matrix M in an usable presentation. More...
 
ideal getSubMatrix ()
 Returns the submatrix M' of M in an usable presentation. More...
 
number getDetAt (const number *evpoint)
 Evaluate the determinant of the matrix M at the point evpoint where the ui's are replaced by the components of evpoint. More...
 
number getSubDet ()
 Evaluates the determinant of the submatrix M'. More...
 
- Public Member Functions inherited from resMatrixBase
 resMatrixBase ()
 
virtual ~resMatrixBase ()
 
virtual poly getUDet (const number *)
 
virtual long getDetDeg ()
 
virtual IStateType initState () const
 

Private Member Functions

 resMatrixDense (const resMatrixDense &)
 deactivated copy constructor More...
 
void generateBaseData ()
 Generate the "matrix" M. More...
 
void generateMonomData (int deg, intvec *polyDegs, intvec *iVO)
 Generates needed set of monoms, split them into sets S0, ... More...
 
void generateMonoms (poly m, int var, int deg)
 Recursively generate all homogeneous monoms of (currRing->N) variables of degree deg. More...
 
void createMatrix ()
 Creates quadratic matrix M of size numVectors for later use. More...
 

Private Attributes

resVectorresVectorList
 
int veclistmax
 
int veclistblock
 
int numVectors
 
int subSize
 
matrix m
 

Additional Inherited Members

- Public Types inherited from resMatrixBase
enum  IStateType {
  none, ready, notInit, fatalError,
  sparseError
}
 
- Protected Attributes inherited from resMatrixBase
IStateType istate
 
ideal gls
 
int linPolyS
 
ring sourceRing
 
int totDeg
 

Detailed Description

Definition at line 1930 of file mpr_base.cc.

Constructor & Destructor Documentation

◆ resMatrixDense() [1/2]

resMatrixDense::resMatrixDense ( const ideal  _gls,
const int  special = SNONE 
)

_gls: system of multivariate polynoms special: -1 -> resMatrixDense is a symbolic matrix 0,1, ...

-> resMatrixDense ist eine u-Resultante, wobei special das lineare u-Polynom angibt

Definition at line 2065 of file mpr_base.cc.

2066  : resMatrixBase()
2067 {
2068  int i;
2069 
2071  gls= idCopy( _gls );
2072  linPolyS= special;
2073  m=NULL;
2074 
2075  // init all
2076  generateBaseData();
2077 
2078  totDeg= 1;
2079  for ( i= 0; i < IDELEMS(gls); i++ )
2080  {
2081  totDeg*=pTotaldegree( (gls->m)[i] );
2082  }
2083 
2084  mprSTICKYPROT2(" resultant deg: %d\n",totDeg);
2085 
2087 }
#define mprSTICKYPROT2(msg, arg)
Definition: mpr_global.h:55
static long pTotaldegree(poly p)
Definition: polys.h:276
int i
Definition: cfEzgcd.cc:125
#define IDELEMS(i)
Definition: simpleideals.h:24
ideal idCopy(ideal A)
Definition: ideals.h:60
ring sourceRing
Definition: mpr_base.h:48
#define NULL
Definition: omList.c:10
void generateBaseData()
Generate the "matrix" M.
Definition: mpr_base.cc:2344
int linPolyS
Definition: mpr_base.h:47
IStateType istate
Definition: mpr_base.h:44
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
ideal gls
Definition: mpr_base.h:46

◆ ~resMatrixDense()

resMatrixDense::~resMatrixDense ( )

Definition at line 2089 of file mpr_base.cc.

2090 {
2091  int i,j;
2092  for (i=0; i < numVectors; i++)
2093  {
2094  pDelete( &resVectorList[i].mon );
2095  pDelete( &resVectorList[i].dividedBy );
2096  for ( j=0; j < resVectorList[i].numColVectorSize; j++ )
2097  {
2098  nDelete( resVectorList[i].numColVector+j );
2099  }
2100  // OB: ????? (solve_s.tst)
2101  if (resVectorList[i].numColVector!=NULL)
2102  omfreeSize( (void *)resVectorList[i].numColVector,
2103  numVectors * sizeof( number ) );
2104  if (resVectorList[i].numColParNr!=NULL)
2105  omfreeSize( (void *)resVectorList[i].numColParNr,
2106  ((currRing->N)+1) * sizeof(int) );
2107  }
2108 
2109  omFreeSize( (void *)resVectorList, veclistmax*sizeof( resVector ) );
2110 
2111  // free matrix m
2112  if ( m != NULL )
2113  {
2114  idDelete((ideal *)&m);
2115  }
2116 }
int j
Definition: facHensel.cc:105
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
#define omfreeSize(addr, size)
Definition: omAllocDecl.h:236
resVector * resVectorList
Definition: mpr_base.cc:1989
int i
Definition: cfEzgcd.cc:125
#define nDelete(n)
Definition: numbers.h:17
int numColVectorSize
size of numColVector
Definition: mpr_base.cc:2041
#define NULL
Definition: omList.c:10
#define pDelete(p_ptr)
Definition: polys.h:181
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13

◆ resMatrixDense() [2/2]

resMatrixDense::resMatrixDense ( const resMatrixDense )
private

deactivated copy constructor

Member Function Documentation

◆ createMatrix()

void resMatrixDense::createMatrix ( )
private

Creates quadratic matrix M of size numVectors for later use.

u0, u1, ...,un are replaced by 0. Entries equal to 0 are not initialized ( == NULL)

Definition at line 2121 of file mpr_base.cc.

2122 {
2123  int k,i,j;
2124  resVector *vecp;
2125 
2127 
2128  for ( i= 1; i <= MATROWS( m ); i++ )
2129  for ( j= 1; j <= MATCOLS( m ); j++ )
2130  {
2131  MATELEM(m,i,j)= pInit();
2132  pSetCoeff0( MATELEM(m,i,j), nInit(0) );
2133  }
2134 
2135 
2136  for ( k= 0; k <= numVectors - 1; k++ )
2137  {
2138  if ( linPolyS == getMVector(k)->elementOfS )
2139  {
2141  for ( i= 0; i < (currRing->N); i++ )
2142  {
2143  MATELEM(m,numVectors-k,numVectors-(getMVector(k)->numColParNr)[i])= pInit();
2144  }
2145  }
2146  else
2147  {
2149  vecp= getMVector(k);
2150  for ( i= 0; i < numVectors; i++)
2151  {
2152  if ( !nIsZero( vecp->getElemNum(i) ) )
2153  {
2154  MATELEM(m,numVectors - k,i + 1)= pInit();
2155  pSetCoeff0( MATELEM(m,numVectors - k,i + 1), nCopy(vecp->getElemNum(i)) );
2156  }
2157  }
2158  }
2159  } // for
2160  mprSTICKYPROT("\n");
2161 
2162 #ifdef mprDEBUG_ALL
2163  for ( k= numVectors - 1; k >= 0; k-- )
2164  {
2165  if ( linPolyS == getMVector(k)->elementOfS )
2166  {
2167  for ( i=0; i < (currRing->N); i++ )
2168  {
2169  Print(" %d ",(getMVector(k)->numColParNr)[i]);
2170  }
2171  PrintLn();
2172  }
2173  }
2174  for (i=1; i <= numVectors; i++)
2175  {
2176  for (j=1; j <= numVectors; j++ )
2177  {
2178  pWrite0(MATELEM(m,i,j));PrintS(" ");
2179  }
2180  PrintLn();
2181  }
2182 #endif
2183 }
#define mprSTICKYPROT(msg)
Definition: mpr_global.h:54
int j
Definition: facHensel.cc:105
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:80
int k
Definition: cfEzgcd.cc:92
void pWrite0(poly p)
Definition: polys.h:303
number getElemNum(const int i)
index von 0 ...
Definition: mpr_base.cc:2057
#define ST_DENSE_FR
Definition: mpr_global.h:64
int i
Definition: cfEzgcd.cc:125
void PrintS(const char *s)
Definition: reporter.cc:284
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:37
#define ST_DENSE_NR
Definition: mpr_global.h:65
#define MATCOLS(i)
Definition: matpol.h:27
#define nIsZero(n)
Definition: numbers.h:20
int linPolyS
Definition: mpr_base.h:47
#define pInit()
allocates a new monomial and initializes everything to 0
Definition: polys.h:61
#define nCopy(n)
Definition: numbers.h:16
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
#define pSetCoeff0(p, n)
Definition: monomials.h:60
#define MATROWS(i)
Definition: matpol.h:26
#define nInit(i)
Definition: numbers.h:25
resVector * getMVector(const int i)
column vector of matrix, index von 0 ...
Definition: mpr_base.cc:2464
#define MATELEM(mat, i, j)
Definition: matpol.h:28

◆ generateBaseData()

void resMatrixDense::generateBaseData ( )
private

Generate the "matrix" M.

Each column is presented by a resVector holding all entries for this column.

Definition at line 2344 of file mpr_base.cc.

2345 {
2346  int k,j,i;
2347  number matEntry;
2348  poly pmatchPos;
2349  poly pi,factor,pmp;
2350 
2351  // holds the degrees of F0, F1, ..., Fn
2352  intvec polyDegs( IDELEMS(gls) );
2353  for ( k= 0; k < IDELEMS(gls); k++ )
2354  polyDegs[k]= pTotaldegree( (gls->m)[k] );
2355 
2356  // the internal Variable Ordering
2357  // make sure that the homogenization variable goes last!
2358  intvec iVO( (currRing->N) );
2359  if ( linPolyS != SNONE )
2360  {
2361  iVO[(currRing->N) - 1]= linPolyS;
2362  int p=0;
2363  for ( k= (currRing->N) - 1; k >= 0; k-- )
2364  {
2365  if ( k != linPolyS )
2366  {
2367  iVO[p]= k;
2368  p++;
2369  }
2370  }
2371  }
2372  else
2373  {
2374  linPolyS= 0;
2375  for ( k= 0; k < (currRing->N); k++ )
2376  iVO[k]= (currRing->N) - k - 1;
2377  }
2378 
2379  // the critical degree d= sum( deg(Fi) ) - n
2380  int sumDeg= 0;
2381  for ( k= 0; k < polyDegs.rows(); k++ )
2382  sumDeg+= polyDegs[k];
2383  sumDeg-= polyDegs.rows() - 1;
2384 
2385  // generate the base data
2386  generateMonomData( sumDeg, &polyDegs, &iVO );
2387 
2388  // generate "matrix"
2389  for ( k= numVectors - 1; k >= 0; k-- )
2390  {
2391  if ( resVectorList[k].elementOfS != linPolyS )
2392  {
2393  // column k is a normal column with numerical or symbolic entries
2394  // init stuff
2397  resVectorList[k].numColVector= (number *)omAlloc( numVectors*sizeof( number ) );
2398  for ( i= 0; i < numVectors; i++ ) resVectorList[k].numColVector[i]= nInit(0);
2399 
2400  // compute row poly
2401  poly pi= ppMult_qq( (gls->m)[ resVectorList[k].elementOfS ] , resVectorList[k].mon );
2402  pi= pDivideM( pCopy( pi ), pCopy( resVectorList[k].dividedBy ) );
2403 
2404  // fill in "matrix"
2405  while ( pi != NULL )
2406  {
2407  matEntry= nCopy(pGetCoeff(pi));
2408  pmatchPos= pLmInit( pi );
2409  pSetCoeff0( pmatchPos, nInit(1) );
2410 
2411  for ( i= 0; i < numVectors; i++)
2412  if ( pLmEqual( pmatchPos, resVectorList[i].mon ) )
2413  break;
2414 
2415  resVectorList[k].numColVector[numVectors - i - 1] = nCopy(matEntry);
2416 
2417  pDelete( &pmatchPos );
2418  nDelete( &matEntry );
2419 
2420  pIter( pi );
2421  }
2422  pDelete( &pi );
2423  }
2424  else
2425  {
2426  // column is a special column, i.e. is generated by S0 and F0
2427  // safe only the positions of the ui's in the column
2428  //mprPROTInl(" setup of numColParNr ",k);
2431  resVectorList[k].numColParNr= (int *)omAlloc0( ((currRing->N)+1) * sizeof(int) );
2432 
2433  pi= (gls->m)[ resVectorList[k].elementOfS ];
2434  factor= pDivideM( pCopy( resVectorList[k].mon ), pCopy( resVectorList[k].dividedBy ) );
2435 
2436  j=0;
2437  while ( pi != NULL )
2438  { // fill in "matrix"
2439  pmp= pMult( pCopy( factor ), pHead( pi ) );
2440  pTest( pmp );
2441 
2442  for ( i= 0; i < numVectors; i++)
2443  if ( pLmEqual( pmp, resVectorList[i].mon ) )
2444  break;
2445 
2447  pDelete( &pmp );
2448  pIter( pi );
2449  j++;
2450  }
2451  pDelete( &pi );
2452  pDelete( &factor );
2453  }
2454  } // for ( k= numVectors - 1; k >= 0; k-- )
2455 
2456  mprSTICKYPROT2(" size of matrix: %d\n",numVectors);
2457  mprSTICKYPROT2(" size of submatrix: %d\n",subSize);
2458 
2459  // create the matrix M
2460  createMatrix();
2461 
2462 }
#define ppMult_qq(p, q)
Definition: polys.h:203
int j
Definition: facHensel.cc:105
#define pTest(p)
Definition: polys.h:409
#define mprSTICKYPROT2(msg, arg)
Definition: mpr_global.h:55
#define SNONE
Definition: mpr_base.h:14
poly mon
Definition: mpr_base.cc:2025
int k
Definition: cfEzgcd.cc:92
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
#define omAlloc(size)
Definition: omAllocDecl.h:210
resVector * resVectorList
Definition: mpr_base.cc:1989
#define pIter(p)
Definition: monomials.h:38
number * numColVector
holds the column vector if (elementOfS != linPolyS)
Definition: mpr_base.cc:2038
Definition: intvec.h:17
static long pTotaldegree(poly p)
Definition: polys.h:276
#define pLmInit(p)
like pInit, except that expvector is initialized to that of p, p must be != NULL
Definition: polys.h:64
#define pDivideM(a, b)
Definition: polys.h:288
int i
Definition: cfEzgcd.cc:125
int elementOfS
number of the set S mon is element of
Definition: mpr_base.cc:2030
CanonicalForm factor
Definition: facAbsFact.cc:101
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL
Definition: polys.h:67
#define IDELEMS(i)
Definition: simpleideals.h:24
#define nDelete(n)
Definition: numbers.h:17
int numColVectorSize
size of numColVector
Definition: mpr_base.cc:2041
#define pi
Definition: libparse.cc:1143
#define NULL
Definition: omList.c:10
int linPolyS
Definition: mpr_base.h:47
#define pMult(p, q)
Definition: polys.h:202
void createMatrix()
Creates quadratic matrix M of size numVectors for later use.
Definition: mpr_base.cc:2121
#define pDelete(p_ptr)
Definition: polys.h:181
#define nCopy(n)
Definition: numbers.h:16
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
#define pSetCoeff0(p, n)
Definition: monomials.h:60
void generateMonomData(int deg, intvec *polyDegs, intvec *iVO)
Generates needed set of monoms, split them into sets S0, ...
Definition: mpr_base.cc:2228
int p
Definition: cfModGcd.cc:4019
int * numColParNr
holds the index of u0, u1, ..., un, if (elementOfS == linPolyS) the size is given by (currRing->N)
Definition: mpr_base.cc:2035
#define nInit(i)
Definition: numbers.h:25
ideal gls
Definition: mpr_base.h:46
#define pLmEqual(p1, p2)
Definition: polys.h:111
#define omAlloc0(size)
Definition: omAllocDecl.h:211
#define pCopy(p)
return a copy of the poly
Definition: polys.h:180

◆ generateMonomData()

void resMatrixDense::generateMonomData ( int  deg,
intvec polyDegs,
intvec iVO 
)
private

Generates needed set of monoms, split them into sets S0, ...

Sn and check if reduced/nonreduced and calculate size of submatrix.

Definition at line 2228 of file mpr_base.cc.

2229 {
2230  int i,j,k;
2231 
2232  // init monomData
2233  veclistblock= 512;
2236 
2237  // Init resVector()s
2238  for ( j= veclistmax - 1; j >= 0; j-- ) resVectorList[j].init();
2239  numVectors= 0;
2240 
2241  // Generate all monoms of degree deg
2242  poly start= pOne();
2243  generateMonoms( start, 1, deg );
2244  pDelete( & start );
2245 
2246  mprSTICKYPROT("\n");
2247 
2248  // Check for reduced monoms
2249  // First generate polyDegs.rows() monoms
2250  // x(k)^(polyDegs[k]), 0 <= k < polyDegs.rows()
2251  ideal pDegDiv= idInit( polyDegs->rows(), 1 );
2252  for ( k= 0; k < polyDegs->rows(); k++ )
2253  {
2254  poly p= pOne();
2255  pSetExp( p, k + 1, (*polyDegs)[k] );
2256  pSetm( p );
2257  (pDegDiv->m)[k]= p;
2258  }
2259 
2260  // Now check each monom if it is reduced.
2261  // A monom monom is called reduced if there exists
2262  // exactly one x(k)^(polyDegs[k]) that divides the monom.
2263  int divCount;
2264  for ( j= numVectors - 1; j >= 0; j-- )
2265  {
2266  divCount= 0;
2267  for ( k= 0; k < IDELEMS(pDegDiv); k++ )
2268  if ( pLmDivisibleByNoComp( (pDegDiv->m)[k], resVectorList[j].mon ) )
2269  divCount++;
2270  resVectorList[j].isReduced= (divCount == 1);
2271  }
2272 
2273  // create the sets S(k)s
2274  // a monom x(i)^deg, deg given, is element of the set S(i)
2275  // if all x(0)^(polyDegs[0]) ... x(i-1)^(polyDegs[i-1]) DONT divide
2276  // x(i)^deg and only x(i)^(polyDegs[i]) divides x(i)^deg
2277  bool doInsert;
2278  for ( k= 0; k < iVO->rows(); k++)
2279  {
2280  //mprPROTInl(" ------------ var:",(*iVO)[k]);
2281  for ( j= numVectors - 1; j >= 0; j-- )
2282  {
2283  //mprPROTPnl("testing monom",resVectorList[j].mon);
2284  if ( resVectorList[j].elementOfS == SFREE )
2285  {
2286  //mprPROTnl("\tfree");
2287  if ( pLmDivisibleByNoComp( (pDegDiv->m)[ (*iVO)[k] ], resVectorList[j].mon ) )
2288  {
2289  //mprPROTPnl("\tdivisible by ",(pDegDiv->m)[ (*iVO)[k] ]);
2290  doInsert=TRUE;
2291  for ( i= 0; i < k; i++ )
2292  {
2293  //mprPROTPnl("\tchecking db ",(pDegDiv->m)[ (*iVO)[i] ]);
2294  if ( pLmDivisibleByNoComp( (pDegDiv->m)[ (*iVO)[i] ], resVectorList[j].mon ) )
2295  {
2296  //mprPROTPnl("\t and divisible by",(pDegDiv->m)[ (*iVO)[i] ]);
2297  doInsert=FALSE;
2298  break;
2299  }
2300  }
2301  if ( doInsert )
2302  {
2303  //mprPROTInl("\t------------------> S ",(*iVO)[k]);
2304  resVectorList[j].elementOfS= (*iVO)[k];
2305  resVectorList[j].dividedBy= pCopy( (pDegDiv->m)[ (*iVO)[i] ] );
2306  }
2307  }
2308  }
2309  }
2310  }
2311 
2312  // size of submatrix M', equal to number of nonreduced monoms
2313  // (size of matrix M is equal to number of monoms=numVectors)
2314  subSize= 0;
2315  int sub;
2316  for ( i= 0; i < polyDegs->rows(); i++ )
2317  {
2318  sub= 1;
2319  for ( k= 0; k < polyDegs->rows(); k++ )
2320  if ( i != k ) sub*= (*polyDegs)[k];
2321  subSize+= sub;
2322  }
2324 
2325  // pDegDiv wieder freigeben!
2326  idDelete( &pDegDiv );
2327 
2328 #ifdef mprDEBUG_ALL
2329  // Print a list of monoms and their properties
2330  PrintS("// \n");
2331  for ( j= numVectors - 1; j >= 0; j-- )
2332  {
2333  Print("// %s, S(%d), db ",
2334  resVectorList[j].isReduced?"reduced":"nonreduced",
2335  resVectorList[j].elementOfS);
2336  pWrite0(resVectorList[j].dividedBy);
2337  PrintS(" monom ");
2338  pWrite(resVectorList[j].mon);
2339  }
2340  Print("// size: %d, subSize: %d\n",numVectors,subSize);
2341 #endif
2342 }
#define mprSTICKYPROT(msg)
Definition: mpr_global.h:54
int j
Definition: facHensel.cc:105
long isReduced(const nmod_mat_t M)
Definition: facFqBivar.cc:1447
#define pSetm(p)
Definition: polys.h:265
#define Print
Definition: emacs.cc:80
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
#define pSetExp(p, i, v)
Definition: polys.h:42
#define FALSE
Definition: auxiliary.h:94
int rows() const
Definition: intvec.h:94
#define TRUE
Definition: auxiliary.h:98
poly mon
Definition: mpr_base.cc:2025
void pWrite(poly p)
Definition: polys.h:302
int k
Definition: cfEzgcd.cc:92
#define omAlloc(size)
Definition: omAllocDecl.h:210
void pWrite0(poly p)
Definition: polys.h:303
resVector * resVectorList
Definition: mpr_base.cc:1989
#define pLmDivisibleByNoComp(a, b)
like pLmDivisibleBy, does not check components
Definition: polys.h:142
poly dividedBy
Definition: mpr_base.cc:2026
bool isReduced
Definition: mpr_base.cc:2027
int i
Definition: cfEzgcd.cc:125
void PrintS(const char *s)
Definition: reporter.cc:284
#define SFREE
Definition: mpr_base.h:15
int elementOfS
number of the set S mon is element of
Definition: mpr_base.cc:2030
#define pOne()
Definition: polys.h:309
#define IDELEMS(i)
Definition: simpleideals.h:24
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:37
#define pDelete(p_ptr)
Definition: polys.h:181
int p
Definition: cfModGcd.cc:4019
void generateMonoms(poly m, int var, int deg)
Recursively generate all homogeneous monoms of (currRing->N) variables of degree deg.
Definition: mpr_base.cc:2188
#define pCopy(p)
return a copy of the poly
Definition: polys.h:180

◆ generateMonoms()

void resMatrixDense::generateMonoms ( poly  m,
int  var,
int  deg 
)
private

Recursively generate all homogeneous monoms of (currRing->N) variables of degree deg.

Definition at line 2188 of file mpr_base.cc.

2189 {
2190  if ( deg == 0 )
2191  {
2192  poly mon = pCopy( mm );
2193 
2194  if ( numVectors == veclistmax )
2195  {
2197  (veclistmax) * sizeof( resVector ),
2198  (veclistmax + veclistblock) * sizeof( resVector ) );
2199  int k;
2200  for ( k= veclistmax; k < (veclistmax + veclistblock); k++ )
2201  resVectorList[k].init();
2204 
2205  }
2206  resVectorList[numVectors].init( mon );
2207  numVectors++;
2209  return;
2210  }
2211  else
2212  {
2213  if ( var == (currRing->N)+1 ) return;
2214  poly newm = pCopy( mm );
2215  while ( deg >= 0 )
2216  {
2217  generateMonoms( newm, var+1, deg );
2218  pIncrExp( newm, var );
2219  pSetm( newm );
2220  deg--;
2221  }
2222  pDelete( & newm );
2223  }
2224 
2225  return;
2226 }
#define mprSTICKYPROT(msg)
Definition: mpr_global.h:54
#define pSetm(p)
Definition: polys.h:265
int k
Definition: cfEzgcd.cc:92
#define ST_DENSE_NMON
Definition: mpr_global.h:67
resVector * resVectorList
Definition: mpr_base.cc:1989
#define ST_DENSE_MEM
Definition: mpr_global.h:66
#define omReallocSize(addr, o_size, size)
Definition: omAllocDecl.h:220
#define pIncrExp(p, i)
Definition: polys.h:43
#define pDelete(p_ptr)
Definition: polys.h:181
void init()
Definition: mpr_base.cc:2005
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
void generateMonoms(poly m, int var, int deg)
Recursively generate all homogeneous monoms of (currRing->N) variables of degree deg.
Definition: mpr_base.cc:2188
#define pCopy(p)
return a copy of the poly
Definition: polys.h:180

◆ getDetAt()

number resMatrixDense::getDetAt ( const number *  evpoint)
virtual

Evaluate the determinant of the matrix M at the point evpoint where the ui's are replaced by the components of evpoint.

Uses singclap_det from factory.

Reimplemented from resMatrixBase.

Definition at line 2551 of file mpr_base.cc.

2552 {
2553  int k,i;
2554 
2555  // copy evaluation point into matrix
2556  // p0, p1, ..., pn replace u0, u1, ..., un
2557  for ( k= numVectors - 1; k >= 0; k-- )
2558  {
2559  if ( linPolyS == getMVector(k)->elementOfS )
2560  {
2561  for ( i= 0; i < (currRing->N); i++ )
2562  {
2563  number np=pGetCoeff(MATELEM(m,numVectors-k,numVectors-(getMVector(k)->numColParNr)[i]));
2564  if (np!=NULL) nDelete(&np);
2565  pSetCoeff0( MATELEM(m,numVectors-k,numVectors-(getMVector(k)->numColParNr)[i]),
2566  nCopy(evpoint[i]) );
2567  }
2568  }
2569  }
2570 
2572 
2573  // evaluate determinant of matrix m using factory singclap_det
2574  poly res= singclap_det( m, currRing );
2575 
2576  // avoid errors for det==0
2577  number numres;
2578  if ( (res!=NULL) && (!nIsZero(pGetCoeff( res ))) )
2579  {
2580  numres= nCopy( pGetCoeff( res ) );
2581  }
2582  else
2583  {
2584  numres= nInit(0);
2585  mprPROT("0");
2586  }
2587  pDelete( &res );
2588 
2590 
2591  return( numres );
2592 }
#define mprSTICKYPROT(msg)
Definition: mpr_global.h:54
poly singclap_det(const matrix m, const ring s)
Definition: clapsing.cc:1635
int k
Definition: cfEzgcd.cc:92
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
CanonicalForm res
Definition: facAbsFact.cc:64
int i
Definition: cfEzgcd.cc:125
#define ST__DET
Definition: mpr_global.h:78
#define nDelete(n)
Definition: numbers.h:17
#define nIsZero(n)
Definition: numbers.h:20
#define NULL
Definition: omList.c:10
int linPolyS
Definition: mpr_base.h:47
#define pDelete(p_ptr)
Definition: polys.h:181
#define nCopy(n)
Definition: numbers.h:16
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
#define pSetCoeff0(p, n)
Definition: monomials.h:60
#define mprPROT(msg)
Definition: mpr_global.h:41
#define nInit(i)
Definition: numbers.h:25
resVector * getMVector(const int i)
column vector of matrix, index von 0 ...
Definition: mpr_base.cc:2464
#define MATELEM(mat, i, j)
Definition: matpol.h:28

◆ getMatrix()

ideal resMatrixDense::getMatrix ( )
virtual

Returns the matrix M in an usable presentation.

Reimplemented from resMatrixBase.

Definition at line 2470 of file mpr_base.cc.

2471 {
2472  int i,j;
2473 
2474  // copy matrix
2475  matrix resmat= mpNew(numVectors,numVectors);
2476  poly p;
2477  for (i=1; i <= numVectors; i++)
2478  {
2479  for (j=1; j <= numVectors; j++ )
2480  {
2481  p=MATELEM(m,i,j);
2482  if (( p!=NULL)
2483  && (!nIsZero(pGetCoeff(p)))
2484  && (pGetCoeff(p)!=NULL)
2485  )
2486  {
2487  MATELEM(resmat,i,j)= pCopy( p );
2488  }
2489  }
2490  }
2491  for (i=0; i < numVectors; i++)
2492  {
2493  if ( resVectorList[i].elementOfS == linPolyS )
2494  {
2495  for (j=1; j <= (currRing->N); j++ )
2496  {
2497  if ( MATELEM(resmat,numVectors-i,
2498  numVectors-resVectorList[i].numColParNr[j-1])!=NULL )
2499  pDelete( &MATELEM(resmat,numVectors-i,numVectors-resVectorList[i].numColParNr[j-1]) );
2500  MATELEM(resmat,numVectors-i,numVectors-resVectorList[i].numColParNr[j-1])= pOne();
2501  // FIX ME
2502  if ( FALSE )
2503  {
2504  pSetCoeff( MATELEM(resmat,numVectors-i,numVectors-resVectorList[i].numColParNr[j-1]), n_Param(j,currRing) );
2505  }
2506  else
2507  {
2508  pSetExp( MATELEM(resmat,numVectors-i,numVectors-resVectorList[i].numColParNr[j-1]), j, 1 );
2509  pSetm(MATELEM(resmat,numVectors-i,numVectors-resVectorList[i].numColParNr[j-1]));
2510  }
2511  }
2512  }
2513  }
2514 
2515  // obachman: idMatrix2Module frees resmat !!
2516  ideal resmod= id_Matrix2Module(resmat,currRing);
2517  return resmod;
2518 }
int j
Definition: facHensel.cc:105
#define pSetm(p)
Definition: polys.h:265
#define pSetExp(p, i, v)
Definition: polys.h:42
#define FALSE
Definition: auxiliary.h:94
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
resVector * resVectorList
Definition: mpr_base.cc:1989
static FORCE_INLINE number n_Param(const int iParameter, const coeffs r)
return the (iParameter^th) parameter as a NEW number NOTE: parameter numbering: 1....
Definition: coeffs.h:805
int i
Definition: cfEzgcd.cc:125
#define pOne()
Definition: polys.h:309
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:37
#define nIsZero(n)
Definition: numbers.h:20
#define NULL
Definition: omList.c:10
int linPolyS
Definition: mpr_base.h:47
#define pDelete(p_ptr)
Definition: polys.h:181
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
int p
Definition: cfModGcd.cc:4019
#define pSetCoeff(p, n)
deletes old coeff before setting the new one
Definition: polys.h:31
ideal id_Matrix2Module(matrix mat, const ring R)
converts mat to module, destroys mat
#define pCopy(p)
return a copy of the poly
Definition: polys.h:180
#define MATELEM(mat, i, j)
Definition: matpol.h:28

◆ getMVector()

resVector * resMatrixDense::getMVector ( const int  i)

column vector of matrix, index von 0 ...

numVectors-1

Definition at line 2464 of file mpr_base.cc.

2465 {
2466  assume( i >= 0 && i < numVectors );
2467  return &resVectorList[i];
2468 }
resVector * resVectorList
Definition: mpr_base.cc:1989
#define assume(x)
Definition: mod2.h:390
int i
Definition: cfEzgcd.cc:125

◆ getSubDet()

number resMatrixDense::getSubDet ( )
virtual

Evaluates the determinant of the submatrix M'.

Since the matrix is numerically, no evaluation point is needed. Uses singclap_det from factory.

Reimplemented from resMatrixBase.

Definition at line 2594 of file mpr_base.cc.

2595 {
2596  int k,i,j,l;
2597  resVector *vecp;
2598 
2599  // generate quadratic matrix mat of size subSize
2600  matrix mat= mpNew( subSize, subSize );
2601 
2602  for ( i= 1; i <= MATROWS( mat ); i++ )
2603  {
2604  for ( j= 1; j <= MATCOLS( mat ); j++ )
2605  {
2606  MATELEM(mat,i,j)= pInit();
2607  pSetCoeff0( MATELEM(mat,i,j), nInit(0) );
2608  }
2609  }
2610  j=1;
2611  for ( k= numVectors - 1; k >= 0; k-- )
2612  {
2613  vecp= getMVector(k);
2614  if ( vecp->isReduced ) continue;
2615  l=1;
2616  for ( i= numVectors - 1; i >= 0; i-- )
2617  {
2618  if ( getMVector(i)->isReduced ) continue;
2619  if ( vecp->getElemNum(numVectors - i - 1) && !nIsZero(vecp->getElemNum(numVectors - i - 1)) )
2620  {
2621  pSetCoeff(MATELEM(mat, j , l ), nCopy(vecp->getElemNum(numVectors - i - 1)));
2622  }
2623  /* else
2624  {
2625  MATELEM(mat, j , l )= pOne();
2626  pSetCoeff(MATELEM(mat, j , l ), nInit(0) );
2627  }
2628  */
2629  l++;
2630  }
2631  j++;
2632  }
2633 
2634  poly res= singclap_det( mat, currRing );
2635 
2636  number numres;
2637  if ((res != NULL) && (!nIsZero(pGetCoeff( res ))) )
2638  {
2639  numres= nCopy(pGetCoeff( res ));
2640  }
2641  else
2642  {
2643  numres= nInit(0);
2644  }
2645  pDelete( &res );
2646  return numres;
2647 }
int j
Definition: facHensel.cc:105
long isReduced(const nmod_mat_t M)
Definition: facFqBivar.cc:1447
poly singclap_det(const matrix m, const ring s)
Definition: clapsing.cc:1635
int k
Definition: cfEzgcd.cc:92
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
number getElemNum(const int i)
index von 0 ...
Definition: mpr_base.cc:2057
CanonicalForm res
Definition: facAbsFact.cc:64
bool isReduced
Definition: mpr_base.cc:2027
int i
Definition: cfEzgcd.cc:125
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:37
#define MATCOLS(i)
Definition: matpol.h:27
#define nIsZero(n)
Definition: numbers.h:20
#define NULL
Definition: omList.c:10
#define pInit()
allocates a new monomial and initializes everything to 0
Definition: polys.h:61
#define pDelete(p_ptr)
Definition: polys.h:181
#define nCopy(n)
Definition: numbers.h:16
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
#define pSetCoeff0(p, n)
Definition: monomials.h:60
#define MATROWS(i)
Definition: matpol.h:26
#define nInit(i)
Definition: numbers.h:25
#define pSetCoeff(p, n)
deletes old coeff before setting the new one
Definition: polys.h:31
resVector * getMVector(const int i)
column vector of matrix, index von 0 ...
Definition: mpr_base.cc:2464
int l
Definition: cfEzgcd.cc:93
#define MATELEM(mat, i, j)
Definition: matpol.h:28

◆ getSubMatrix()

ideal resMatrixDense::getSubMatrix ( )
virtual

Returns the submatrix M' of M in an usable presentation.

Reimplemented from resMatrixBase.

Definition at line 2520 of file mpr_base.cc.

2521 {
2522  int k,i,j,l;
2523  resVector *vecp;
2524 
2525  // generate quadratic matrix resmat of size subSize
2526  matrix resmat= mpNew( subSize, subSize );
2527 
2528  j=1;
2529  for ( k= numVectors - 1; k >= 0; k-- )
2530  {
2531  vecp= getMVector(k);
2532  if ( vecp->isReduced ) continue;
2533  l=1;
2534  for ( i= numVectors - 1; i >= 0; i-- )
2535  {
2536  if ( getMVector(i)->isReduced ) continue;
2537  if ( !nIsZero(vecp->getElemNum(numVectors - i - 1)) )
2538  {
2539  MATELEM(resmat,j,l)= pCopy( vecp->getElem(numVectors-i-1) );
2540  }
2541  l++;
2542  }
2543  j++;
2544  }
2545 
2546  // obachman: idMatrix2Module frees resmat !!
2547  ideal resmod= id_Matrix2Module(resmat,currRing);
2548  return resmod;
2549 }
int j
Definition: facHensel.cc:105
long isReduced(const nmod_mat_t M)
Definition: facFqBivar.cc:1447
int k
Definition: cfEzgcd.cc:92
poly getElem(const int i)
index von 0 ...
Definition: mpr_base.cc:2048
number getElemNum(const int i)
index von 0 ...
Definition: mpr_base.cc:2057
bool isReduced
Definition: mpr_base.cc:2027
int i
Definition: cfEzgcd.cc:125
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:37
#define nIsZero(n)
Definition: numbers.h:20
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
ideal id_Matrix2Module(matrix mat, const ring R)
converts mat to module, destroys mat
resVector * getMVector(const int i)
column vector of matrix, index von 0 ...
Definition: mpr_base.cc:2464
int l
Definition: cfEzgcd.cc:93
#define pCopy(p)
return a copy of the poly
Definition: polys.h:180
#define MATELEM(mat, i, j)
Definition: matpol.h:28

Field Documentation

◆ m

matrix resMatrixDense::m
private

Definition at line 1996 of file mpr_base.cc.

◆ numVectors

int resMatrixDense::numVectors
private

Definition at line 1993 of file mpr_base.cc.

◆ resVectorList

resVector* resMatrixDense::resVectorList
private

Definition at line 1989 of file mpr_base.cc.

◆ subSize

int resMatrixDense::subSize
private

Definition at line 1994 of file mpr_base.cc.

◆ veclistblock

int resMatrixDense::veclistblock
private

Definition at line 1992 of file mpr_base.cc.

◆ veclistmax

int resMatrixDense::veclistmax
private

Definition at line 1991 of file mpr_base.cc.


The documentation for this class was generated from the following file: