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 1931 of file mpr_base.cc.

Constructor & Destructor Documentation

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 2066 of file mpr_base.cc.

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

Definition at line 2090 of file mpr_base.cc.

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

deactivated copy constructor

Member Function Documentation

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 2122 of file mpr_base.cc.

2123 {
2124  int k,i,j;
2125  resVector *vecp;
2126 
2128 
2129  for ( i= 1; i <= MATROWS( m ); i++ )
2130  for ( j= 1; j <= MATCOLS( m ); j++ )
2131  {
2132  MATELEM(m,i,j)= pInit();
2133  pSetCoeff0( MATELEM(m,i,j), nInit(0) );
2134  }
2135 
2136 
2137  for ( k= 0; k <= numVectors - 1; k++ )
2138  {
2139  if ( linPolyS == getMVector(k)->elementOfS )
2140  {
2142  for ( i= 0; i < (currRing->N); i++ )
2143  {
2144  MATELEM(m,numVectors-k,numVectors-(getMVector(k)->numColParNr)[i])= pInit();
2145  }
2146  }
2147  else
2148  {
2150  vecp= getMVector(k);
2151  for ( i= 0; i < numVectors; i++)
2152  {
2153  if ( !nIsZero( vecp->getElemNum(i) ) )
2154  {
2155  MATELEM(m,numVectors - k,i + 1)= pInit();
2156  pSetCoeff0( MATELEM(m,numVectors - k,i + 1), nCopy(vecp->getElemNum(i)) );
2157  }
2158  }
2159  }
2160  } // for
2161  mprSTICKYPROT("\n");
2162 
2163 #ifdef mprDEBUG_ALL
2164  for ( k= numVectors - 1; k >= 0; k-- )
2165  {
2166  if ( linPolyS == getMVector(k)->elementOfS )
2167  {
2168  for ( i=0; i < (currRing->N); i++ )
2169  {
2170  Print(" %d ",(getMVector(k)->numColParNr)[i]);
2171  }
2172  PrintLn();
2173  }
2174  }
2175  for (i=1; i <= numVectors; i++)
2176  {
2177  for (j=1; j <= numVectors; j++ )
2178  {
2179  pWrite0(MATELEM(m,i,j));PrintS(" ");
2180  }
2181  PrintLn();
2182  }
2183 #endif
2184 }
#define mprSTICKYPROT(msg)
Definition: mpr_global.h:54
void PrintLn()
Definition: reporter.cc:322
#define Print
Definition: emacs.cc:83
int k
Definition: cfEzgcd.cc:93
void pWrite0(poly p)
Definition: polys.h:280
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
number getElemNum(const int i)
index von 0 ...
Definition: mpr_base.cc:2058
int j
Definition: myNF.cc:70
#define ST_DENSE_FR
Definition: mpr_global.h:64
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:48
#define ST_DENSE_NR
Definition: mpr_global.h:65
#define MATCOLS(i)
Definition: matpol.h:28
#define nIsZero(n)
Definition: numbers.h:19
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:15
#define pSetCoeff0(p, n)
Definition: monomials.h:67
#define MATROWS(i)
Definition: matpol.h:27
#define nInit(i)
Definition: numbers.h:24
resVector * getMVector(const int i)
column vector of matrix, index von 0 ...
Definition: mpr_base.cc:2465
#define MATELEM(mat, i, j)
Definition: matpol.h:29
void resMatrixDense::generateBaseData ( )
private

Generate the "matrix" M.

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

Definition at line 2345 of file mpr_base.cc.

2346 {
2347  int k,j,i;
2348  number matEntry;
2349  poly pmatchPos;
2350  poly pi,factor,pmp;
2351 
2352  // holds the degrees of F0, F1, ..., Fn
2353  intvec polyDegs( IDELEMS(gls) );
2354  for ( k= 0; k < IDELEMS(gls); k++ )
2355  polyDegs[k]= pTotaldegree( (gls->m)[k] );
2356 
2357  // the internal Variable Ordering
2358  // make sure that the homogenization variable goes last!
2359  intvec iVO( (currRing->N) );
2360  if ( linPolyS != SNONE )
2361  {
2362  iVO[(currRing->N) - 1]= linPolyS;
2363  int p=0;
2364  for ( k= (currRing->N) - 1; k >= 0; k-- )
2365  {
2366  if ( k != linPolyS )
2367  {
2368  iVO[p]= k;
2369  p++;
2370  }
2371  }
2372  }
2373  else
2374  {
2375  linPolyS= 0;
2376  for ( k= 0; k < (currRing->N); k++ )
2377  iVO[k]= (currRing->N) - k - 1;
2378  }
2379 
2380  // the critical degree d= sum( deg(Fi) ) - n
2381  int sumDeg= 0;
2382  for ( k= 0; k < polyDegs.rows(); k++ )
2383  sumDeg+= polyDegs[k];
2384  sumDeg-= polyDegs.rows() - 1;
2385 
2386  // generate the base data
2387  generateMonomData( sumDeg, &polyDegs, &iVO );
2388 
2389  // generate "matrix"
2390  for ( k= numVectors - 1; k >= 0; k-- )
2391  {
2392  if ( resVectorList[k].elementOfS != linPolyS )
2393  {
2394  // column k is a normal column with numerical or symbolic entries
2395  // init stuff
2398  resVectorList[k].numColVector= (number *)omAlloc( numVectors*sizeof( number ) );
2399  for ( i= 0; i < numVectors; i++ ) resVectorList[k].numColVector[i]= nInit(0);
2400 
2401  // compute row poly
2402  poly pi= ppMult_qq( (gls->m)[ resVectorList[k].elementOfS ] , resVectorList[k].mon );
2403  pi= pDivideM( pCopy( pi ), pCopy( resVectorList[k].dividedBy ) );
2404 
2405  // fill in "matrix"
2406  while ( pi != NULL )
2407  {
2408  matEntry= nCopy(pGetCoeff(pi));
2409  pmatchPos= pLmInit( pi );
2410  pSetCoeff0( pmatchPos, nInit(1) );
2411 
2412  for ( i= 0; i < numVectors; i++)
2413  if ( pLmEqual( pmatchPos, resVectorList[i].mon ) )
2414  break;
2415 
2416  resVectorList[k].numColVector[numVectors - i - 1] = nCopy(matEntry);
2417 
2418  pDelete( &pmatchPos );
2419  nDelete( &matEntry );
2420 
2421  pIter( pi );
2422  }
2423  pDelete( &pi );
2424  }
2425  else
2426  {
2427  // column is a special column, i.e. is generated by S0 and F0
2428  // safe only the positions of the ui's in the column
2429  //mprPROTInl(" setup of numColParNr ",k);
2432  resVectorList[k].numColParNr= (int *)omAlloc0( ((currRing->N)+1) * sizeof(int) );
2433 
2434  pi= (gls->m)[ resVectorList[k].elementOfS ];
2435  factor= pDivideM( pCopy( resVectorList[k].mon ), pCopy( resVectorList[k].dividedBy ) );
2436 
2437  j=0;
2438  while ( pi != NULL )
2439  { // fill in "matrix"
2440  pmp= pMult( pCopy( factor ), pHead( pi ) );
2441  pTest( pmp );
2442 
2443  for ( i= 0; i < numVectors; i++)
2444  if ( pLmEqual( pmp, resVectorList[i].mon ) )
2445  break;
2446 
2448  pDelete( &pmp );
2449  pIter( pi );
2450  j++;
2451  }
2452  pDelete( &pi );
2453  pDelete( &factor );
2454  }
2455  } // for ( k= numVectors - 1; k >= 0; k-- )
2456 
2457  mprSTICKYPROT2(" size of matrix: %d\n",numVectors);
2458  mprSTICKYPROT2(" size of submatrix: %d\n",subSize);
2459 
2460  // create the matrix M
2461  createMatrix();
2462 
2463 }
#define ppMult_qq(p, q)
Definition: polys.h:179
return P p
Definition: myNF.cc:203
#define pTest(p)
Definition: polys.h:387
#define mprSTICKYPROT2(msg, arg)
Definition: mpr_global.h:55
#define SNONE
Definition: mpr_base.h:14
poly mon
Definition: mpr_base.cc:2026
int k
Definition: cfEzgcd.cc:93
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
#define omAlloc(size)
Definition: omAllocDecl.h:210
resVector * resVectorList
Definition: mpr_base.cc:1990
#define pIter(p)
Definition: monomials.h:44
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
number * numColVector
holds the column vector if (elementOfS != linPolyS)
Definition: mpr_base.cc:2039
Definition: intvec.h:16
int j
Definition: myNF.cc:70
static long pTotaldegree(poly p)
Definition: polys.h:253
#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:265
int i
Definition: cfEzgcd.cc:123
int elementOfS
number of the set S mon is element of
Definition: mpr_base.cc:2031
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:16
int numColVectorSize
size of numColVector
Definition: mpr_base.cc:2042
#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:178
void createMatrix()
Creates quadratic matrix M of size numVectors for later use.
Definition: mpr_base.cc:2122
#define pDelete(p_ptr)
Definition: polys.h:157
#define nCopy(n)
Definition: numbers.h:15
#define pSetCoeff0(p, n)
Definition: monomials.h:67
void generateMonomData(int deg, intvec *polyDegs, intvec *iVO)
Generates needed set of monoms, split them into sets S0, ...
Definition: mpr_base.cc:2229
polyrec * poly
Definition: hilb.h:10
int * numColParNr
holds the index of u0, u1, ..., un, if (elementOfS == linPolyS) the size is given by (currRing->N) ...
Definition: mpr_base.cc:2036
#define nInit(i)
Definition: numbers.h:24
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:156
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 2229 of file mpr_base.cc.

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

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

2553 {
2554  int k,i;
2555 
2556  // copy evaluation point into matrix
2557  // p0, p1, ..., pn replace u0, u1, ..., un
2558  for ( k= numVectors - 1; k >= 0; k-- )
2559  {
2560  if ( linPolyS == getMVector(k)->elementOfS )
2561  {
2562  for ( i= 0; i < (currRing->N); i++ )
2563  {
2564  pSetCoeff( MATELEM(m,numVectors-k,numVectors-(getMVector(k)->numColParNr)[i]),
2565  nCopy(evpoint[i]) );
2566  }
2567  }
2568  }
2569 
2571 
2572  // evaluate determinant of matrix m using factory singclap_det
2574 
2575  // avoid errors for det==0
2576  number numres;
2577  if ( (res!=NULL) && (!nIsZero(pGetCoeff( res ))) )
2578  {
2579  numres= nCopy( pGetCoeff( res ) );
2580  }
2581  else
2582  {
2583  numres= nInit(0);
2584  mprPROT("0");
2585  }
2586  pDelete( &res );
2587 
2589 
2590  return( numres );
2591 }
#define mprSTICKYPROT(msg)
Definition: mpr_global.h:54
poly singclap_det(const matrix m, const ring s)
Definition: clapsing.cc:1579
int k
Definition: cfEzgcd.cc:93
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
poly res
Definition: myNF.cc:322
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int i
Definition: cfEzgcd.cc:123
#define ST__DET
Definition: mpr_global.h:78
#define nIsZero(n)
Definition: numbers.h:19
#define NULL
Definition: omList.c:10
int linPolyS
Definition: mpr_base.h:47
#define pDelete(p_ptr)
Definition: polys.h:157
#define nCopy(n)
Definition: numbers.h:15
polyrec * poly
Definition: hilb.h:10
#define mprPROT(msg)
Definition: mpr_global.h:41
#define nInit(i)
Definition: numbers.h:24
#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:2465
#define MATELEM(mat, i, j)
Definition: matpol.h:29
ideal resMatrixDense::getMatrix ( )
virtual

Returns the matrix M in an usable presentation.

Reimplemented from resMatrixBase.

Definition at line 2471 of file mpr_base.cc.

2472 {
2473  int i,j;
2474 
2475  // copy matrix
2476  matrix resmat= mpNew(numVectors,numVectors);
2477  poly p;
2478  for (i=1; i <= numVectors; i++)
2479  {
2480  for (j=1; j <= numVectors; j++ )
2481  {
2482  p=MATELEM(m,i,j);
2483  if (( p!=NULL)
2484  && (!nIsZero(pGetCoeff(p)))
2485  && (pGetCoeff(p)!=NULL)
2486  )
2487  {
2488  MATELEM(resmat,i,j)= pCopy( p );
2489  }
2490  }
2491  }
2492  for (i=0; i < numVectors; i++)
2493  {
2494  if ( resVectorList[i].elementOfS == linPolyS )
2495  {
2496  for (j=1; j <= (currRing->N); j++ )
2497  {
2498  if ( MATELEM(resmat,numVectors-i,
2499  numVectors-resVectorList[i].numColParNr[j-1])!=NULL )
2500  pDelete( &MATELEM(resmat,numVectors-i,numVectors-resVectorList[i].numColParNr[j-1]) );
2501  MATELEM(resmat,numVectors-i,numVectors-resVectorList[i].numColParNr[j-1])= pOne();
2502  // FIX ME
2503  if ( FALSE )
2504  {
2505  pSetCoeff( MATELEM(resmat,numVectors-i,numVectors-resVectorList[i].numColParNr[j-1]), n_Param(j,currRing) );
2506  }
2507  else
2508  {
2509  pSetExp( MATELEM(resmat,numVectors-i,numVectors-resVectorList[i].numColParNr[j-1]), j, 1 );
2510  pSetm(MATELEM(resmat,numVectors-i,numVectors-resVectorList[i].numColParNr[j-1]));
2511  }
2512  }
2513  }
2514  }
2515 
2516  // obachman: idMatrix2Module frees resmat !!
2517  ideal resmod= id_Matrix2Module(resmat,currRing);
2518  return resmod;
2519 }
#define pSetm(p)
Definition: polys.h:241
#define pSetExp(p, i, v)
Definition: polys.h:42
#define FALSE
Definition: auxiliary.h:140
return P p
Definition: myNF.cc:203
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
resVector * resVectorList
Definition: mpr_base.cc:1990
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..n_NumberOfParameters(...)
Definition: coeffs.h:801
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
#define pOne()
Definition: polys.h:286
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:48
#define nIsZero(n)
Definition: numbers.h:19
#define NULL
Definition: omList.c:10
int linPolyS
Definition: mpr_base.h:47
#define pDelete(p_ptr)
Definition: polys.h:157
polyrec * poly
Definition: hilb.h:10
#define pSetCoeff(p, n)
deletes old coeff before setting the new one
Definition: polys.h:31
ideal id_Matrix2Module(matrix mat, const ring R)
#define pCopy(p)
return a copy of the poly
Definition: polys.h:156
#define MATELEM(mat, i, j)
Definition: matpol.h:29
resVector * resMatrixDense::getMVector ( const int  i)

column vector of matrix, index von 0 ...

numVectors-1

Definition at line 2465 of file mpr_base.cc.

2466 {
2467  assume( i >= 0 && i < numVectors );
2468  return &resVectorList[i];
2469 }
resVector * resVectorList
Definition: mpr_base.cc:1990
#define assume(x)
Definition: mod2.h:405
int i
Definition: cfEzgcd.cc:123
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 2593 of file mpr_base.cc.

2594 {
2595  int k,i,j,l;
2596  resVector *vecp;
2597 
2598  // generate quadratic matrix mat of size subSize
2599  matrix mat= mpNew( subSize, subSize );
2600 
2601  for ( i= 1; i <= MATROWS( mat ); i++ )
2602  {
2603  for ( j= 1; j <= MATCOLS( mat ); j++ )
2604  {
2605  MATELEM(mat,i,j)= pInit();
2606  pSetCoeff0( MATELEM(mat,i,j), nInit(0) );
2607  }
2608  }
2609  j=1;
2610  for ( k= numVectors - 1; k >= 0; k-- )
2611  {
2612  vecp= getMVector(k);
2613  if ( vecp->isReduced ) continue;
2614  l=1;
2615  for ( i= numVectors - 1; i >= 0; i-- )
2616  {
2617  if ( getMVector(i)->isReduced ) continue;
2618  if ( vecp->getElemNum(numVectors - i - 1) && !nIsZero(vecp->getElemNum(numVectors - i - 1)) )
2619  {
2620  pSetCoeff(MATELEM(mat, j , l ), nCopy(vecp->getElemNum(numVectors - i - 1)));
2621  }
2622  /* else
2623  {
2624  MATELEM(mat, j , l )= pOne();
2625  pSetCoeff(MATELEM(mat, j , l ), nInit(0) );
2626  }
2627  */
2628  l++;
2629  }
2630  j++;
2631  }
2632 
2633  poly res= singclap_det( mat, currRing );
2634 
2635  number numres;
2636  if ((res != NULL) && (!nIsZero(pGetCoeff( res ))) )
2637  {
2638  numres= nCopy(pGetCoeff( res ));
2639  }
2640  else
2641  {
2642  numres= nInit(0);
2643  }
2644  pDelete( &res );
2645  return numres;
2646 }
long isReduced(const nmod_mat_t M)
Definition: facFqBivar.cc:1447
poly singclap_det(const matrix m, const ring s)
Definition: clapsing.cc:1579
int k
Definition: cfEzgcd.cc:93
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
poly res
Definition: myNF.cc:322
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
number getElemNum(const int i)
index von 0 ...
Definition: mpr_base.cc:2058
int j
Definition: myNF.cc:70
bool isReduced
Definition: mpr_base.cc:2028
int i
Definition: cfEzgcd.cc:123
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:48
#define MATCOLS(i)
Definition: matpol.h:28
#define nIsZero(n)
Definition: numbers.h:19
#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:157
#define nCopy(n)
Definition: numbers.h:15
#define pSetCoeff0(p, n)
Definition: monomials.h:67
#define MATROWS(i)
Definition: matpol.h:27
polyrec * poly
Definition: hilb.h:10
#define nInit(i)
Definition: numbers.h:24
#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:2465
int l
Definition: cfEzgcd.cc:94
#define MATELEM(mat, i, j)
Definition: matpol.h:29
ideal resMatrixDense::getSubMatrix ( )
virtual

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

Reimplemented from resMatrixBase.

Definition at line 2521 of file mpr_base.cc.

2522 {
2523  int k,i,j,l;
2524  resVector *vecp;
2525 
2526  // generate quadratic matrix resmat of size subSize
2527  matrix resmat= mpNew( subSize, subSize );
2528 
2529  j=1;
2530  for ( k= numVectors - 1; k >= 0; k-- )
2531  {
2532  vecp= getMVector(k);
2533  if ( vecp->isReduced ) continue;
2534  l=1;
2535  for ( i= numVectors - 1; i >= 0; i-- )
2536  {
2537  if ( getMVector(i)->isReduced ) continue;
2538  if ( !nIsZero(vecp->getElemNum(numVectors - i - 1)) )
2539  {
2540  MATELEM(resmat,j,l)= pCopy( vecp->getElem(numVectors-i-1) );
2541  }
2542  l++;
2543  }
2544  j++;
2545  }
2546 
2547  // obachman: idMatrix2Module frees resmat !!
2548  ideal resmod= id_Matrix2Module(resmat,currRing);
2549  return resmod;
2550 }
long isReduced(const nmod_mat_t M)
Definition: facFqBivar.cc:1447
int k
Definition: cfEzgcd.cc:93
poly getElem(const int i)
index von 0 ...
Definition: mpr_base.cc:2049
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
number getElemNum(const int i)
index von 0 ...
Definition: mpr_base.cc:2058
int j
Definition: myNF.cc:70
bool isReduced
Definition: mpr_base.cc:2028
int i
Definition: cfEzgcd.cc:123
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:48
#define nIsZero(n)
Definition: numbers.h:19
ideal id_Matrix2Module(matrix mat, const ring R)
resVector * getMVector(const int i)
column vector of matrix, index von 0 ...
Definition: mpr_base.cc:2465
int l
Definition: cfEzgcd.cc:94
#define pCopy(p)
return a copy of the poly
Definition: polys.h:156
#define MATELEM(mat, i, j)
Definition: matpol.h:29

Field Documentation

matrix resMatrixDense::m
private

Definition at line 1997 of file mpr_base.cc.

int resMatrixDense::numVectors
private

Definition at line 1994 of file mpr_base.cc.

resVector* resMatrixDense::resVectorList
private

Definition at line 1990 of file mpr_base.cc.

int resMatrixDense::subSize
private

Definition at line 1995 of file mpr_base.cc.

int resMatrixDense::veclistblock
private

Definition at line 1993 of file mpr_base.cc.

int resMatrixDense::veclistmax
private

Definition at line 1992 of file mpr_base.cc.


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