My Project
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 1929 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 2064 of file mpr_base.cc.

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

◆ ~resMatrixDense()

resMatrixDense::~resMatrixDense ( )

Definition at line 2088 of file mpr_base.cc.

2089 {
2090  int i,j;
2091  for (i=0; i < numVectors; i++)
2092  {
2093  pDelete( &resVectorList[i].mon );
2094  pDelete( &resVectorList[i].dividedBy );
2095  for ( j=0; j < resVectorList[i].numColVectorSize; j++ )
2096  {
2097  nDelete( resVectorList[i].numColVector+j );
2098  }
2099  // OB: ????? (solve_s.tst)
2100  if (resVectorList[i].numColVector!=NULL)
2101  omfreeSize( (void *)resVectorList[i].numColVector,
2102  numVectors * sizeof( number ) );
2103  if (resVectorList[i].numColParNr!=NULL)
2104  omfreeSize( (void *)resVectorList[i].numColParNr,
2105  ((currRing->N)+1) * sizeof(int) );
2106  }
2107 
2108  omFreeSize( (void *)resVectorList, veclistmax*sizeof( resVector ) );
2109 
2110  // free matrix m
2111  if ( m != NULL )
2112  {
2113  idDelete((ideal *)&m);
2114  }
2115 }
resVector * resVectorList
Definition: mpr_base.cc:1988
int j
Definition: facHensel.cc:110
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
#define nDelete(n)
Definition: numbers.h:16
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
#define omfreeSize(addr, size)
Definition: omAllocDecl.h:236
#define pDelete(p_ptr)
Definition: polys.h:186
int numColVectorSize
size of numColVector
Definition: mpr_base.cc:2040

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

2121 {
2122  int k,i,j;
2123  resVector *vecp;
2124 
2126 
2127  for ( i= 1; i <= MATROWS( m ); i++ )
2128  for ( j= 1; j <= MATCOLS( m ); j++ )
2129  {
2130  MATELEM(m,i,j)= pInit();
2131  pSetCoeff0( MATELEM(m,i,j), nInit(0) );
2132  }
2133 
2134 
2135  for ( k= 0; k <= numVectors - 1; k++ )
2136  {
2137  if ( linPolyS == getMVector(k)->elementOfS )
2138  {
2140  for ( i= 0; i < (currRing->N); i++ )
2141  {
2142  MATELEM(m,numVectors-k,numVectors-(getMVector(k)->numColParNr)[i])= pInit();
2143  }
2144  }
2145  else
2146  {
2148  vecp= getMVector(k);
2149  for ( i= 0; i < numVectors; i++)
2150  {
2151  if ( !nIsZero( vecp->getElemNum(i) ) )
2152  {
2153  MATELEM(m,numVectors - k,i + 1)= pInit();
2154  pSetCoeff0( MATELEM(m,numVectors - k,i + 1), nCopy(vecp->getElemNum(i)) );
2155  }
2156  }
2157  }
2158  } // for
2159  mprSTICKYPROT("\n");
2160 
2161 #ifdef mprDEBUG_ALL
2162  for ( k= numVectors - 1; k >= 0; k-- )
2163  {
2164  if ( linPolyS == getMVector(k)->elementOfS )
2165  {
2166  for ( i=0; i < (currRing->N); i++ )
2167  {
2168  Print(" %d ",(getMVector(k)->numColParNr)[i]);
2169  }
2170  PrintLn();
2171  }
2172  }
2173  for (i=1; i <= numVectors; i++)
2174  {
2175  for (j=1; j <= numVectors; j++ )
2176  {
2177  pWrite0(MATELEM(m,i,j));PrintS(" ");
2178  }
2179  PrintLn();
2180  }
2181 #endif
2182 }
int k
Definition: cfEzgcd.cc:99
resVector * getMVector(const int i)
column vector of matrix, index von 0 ...
Definition: mpr_base.cc:2463
#define Print
Definition: emacs.cc:80
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:37
#define MATELEM(mat, i, j)
1-based access to matrix
Definition: matpol.h:29
#define MATROWS(i)
Definition: matpol.h:26
#define MATCOLS(i)
Definition: matpol.h:27
#define pSetCoeff0(p, n)
Definition: monomials.h:59
#define mprSTICKYPROT(msg)
Definition: mpr_global.h:54
#define ST_DENSE_NR
Definition: mpr_global.h:65
#define ST_DENSE_FR
Definition: mpr_global.h:64
#define nIsZero(n)
Definition: numbers.h:19
#define nCopy(n)
Definition: numbers.h:15
#define nInit(i)
Definition: numbers.h:24
void pWrite0(poly p)
Definition: polys.h:309
#define pInit()
allocates a new monomial and initializes everything to 0
Definition: polys.h:61
void PrintS(const char *s)
Definition: reporter.cc:284
void PrintLn()
Definition: reporter.cc:310
number getElemNum(const int i)
index von 0 ...
Definition: mpr_base.cc:2056

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

2344 {
2345  int k,j,i;
2346  number matEntry;
2347  poly pmatchPos;
2348  poly pi,factor,pmp;
2349 
2350  // holds the degrees of F0, F1, ..., Fn
2351  intvec polyDegs( IDELEMS(gls) );
2352  for ( k= 0; k < IDELEMS(gls); k++ )
2353  polyDegs[k]= pTotaldegree( (gls->m)[k] );
2354 
2355  // the internal Variable Ordering
2356  // make sure that the homogenization variable goes last!
2357  intvec iVO( (currRing->N) );
2358  if ( linPolyS != SNONE )
2359  {
2360  iVO[(currRing->N) - 1]= linPolyS;
2361  int p=0;
2362  for ( k= (currRing->N) - 1; k >= 0; k-- )
2363  {
2364  if ( k != linPolyS )
2365  {
2366  iVO[p]= k;
2367  p++;
2368  }
2369  }
2370  }
2371  else
2372  {
2373  linPolyS= 0;
2374  for ( k= 0; k < (currRing->N); k++ )
2375  iVO[k]= (currRing->N) - k - 1;
2376  }
2377 
2378  // the critical degree d= sum( deg(Fi) ) - n
2379  int sumDeg= 0;
2380  for ( k= 0; k < polyDegs.rows(); k++ )
2381  sumDeg+= polyDegs[k];
2382  sumDeg-= polyDegs.rows() - 1;
2383 
2384  // generate the base data
2385  generateMonomData( sumDeg, &polyDegs, &iVO );
2386 
2387  // generate "matrix"
2388  for ( k= numVectors - 1; k >= 0; k-- )
2389  {
2390  if ( resVectorList[k].elementOfS != linPolyS )
2391  {
2392  // column k is a normal column with numerical or symbolic entries
2393  // init stuff
2396  resVectorList[k].numColVector= (number *)omAlloc( numVectors*sizeof( number ) );
2397  for ( i= 0; i < numVectors; i++ ) resVectorList[k].numColVector[i]= nInit(0);
2398 
2399  // compute row poly
2400  poly pi= ppMult_qq( (gls->m)[ resVectorList[k].elementOfS ] , resVectorList[k].mon );
2401  pi= pp_DivideM( pi, resVectorList[k].dividedBy, currRing );
2402 
2403  // fill in "matrix"
2404  while ( pi != NULL )
2405  {
2406  matEntry= nCopy(pGetCoeff(pi));
2407  pmatchPos= pLmInit( pi );
2408  pSetCoeff0( pmatchPos, nInit(1) );
2409 
2410  for ( i= 0; i < numVectors; i++)
2411  if ( pLmEqual( pmatchPos, resVectorList[i].mon ) )
2412  break;
2413 
2414  resVectorList[k].numColVector[numVectors - i - 1] = nCopy(matEntry);
2415 
2416  pDelete( &pmatchPos );
2417  nDelete( &matEntry );
2418 
2419  pIter( pi );
2420  }
2421  pDelete( &pi );
2422  }
2423  else
2424  {
2425  // column is a special column, i.e. is generated by S0 and F0
2426  // safe only the positions of the ui's in the column
2427  //mprPROTInl(" setup of numColParNr ",k);
2430  resVectorList[k].numColParNr= (int *)omAlloc0( ((currRing->N)+1) * sizeof(int) );
2431 
2432  pi= (gls->m)[ resVectorList[k].elementOfS ];
2433  factor= pp_DivideM( resVectorList[k].mon, resVectorList[k].dividedBy, currRing );
2434 
2435  j=0;
2436  while ( pi != NULL )
2437  { // fill in "matrix"
2438  pmp= pMult( pCopy( factor ), pHead( pi ) );
2439  pTest( pmp );
2440 
2441  for ( i= 0; i < numVectors; i++)
2442  if ( pLmEqual( pmp, resVectorList[i].mon ) )
2443  break;
2444 
2446  pDelete( &pmp );
2447  pIter( pi );
2448  j++;
2449  }
2450  pDelete( &pi );
2451  pDelete( &factor );
2452  }
2453  } // for ( k= numVectors - 1; k >= 0; k-- )
2454 
2455  mprSTICKYPROT2(" size of matrix: %d\n",numVectors);
2456  mprSTICKYPROT2(" size of submatrix: %d\n",subSize);
2457 
2458  // create the matrix M
2459  createMatrix();
2460 
2461 }
int p
Definition: cfModGcd.cc:4078
Definition: intvec.h:23
void createMatrix()
Creates quadratic matrix M of size numVectors for later use.
Definition: mpr_base.cc:2120
void generateMonomData(int deg, intvec *polyDegs, intvec *iVO)
Generates needed set of monoms, split them into sets S0, ...
Definition: mpr_base.cc:2227
CanonicalForm factor
Definition: facAbsFact.cc:97
#define pi
Definition: libparse.cc:1145
#define pIter(p)
Definition: monomials.h:37
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:44
#define SNONE
Definition: mpr_base.h:14
#define omAlloc(size)
Definition: omAllocDecl.h:210
#define omAlloc0(size)
Definition: omAllocDecl.h:211
poly pp_DivideM(poly a, poly b, const ring r)
Definition: p_polys.cc:1629
#define pTest(p)
Definition: polys.h:414
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL
Definition: polys.h:67
#define pLmEqual(p1, p2)
Definition: polys.h:111
#define ppMult_qq(p, q)
Definition: polys.h:208
#define pLmInit(p)
like pInit, except that expvector is initialized to that of p, p must be != NULL
Definition: polys.h:64
#define pMult(p, q)
Definition: polys.h:207
#define pCopy(p)
return a copy of the poly
Definition: polys.h:185
poly mon
Definition: mpr_base.cc:2024
int elementOfS
number of the set S mon is element of
Definition: mpr_base.cc:2029
int * numColParNr
holds the index of u0, u1, ..., un, if (elementOfS == linPolyS) the size is given by (currRing->N)
Definition: mpr_base.cc:2034
number * numColVector
holds the column vector if (elementOfS != linPolyS)
Definition: mpr_base.cc:2037

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

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

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

2188 {
2189  if ( deg == 0 )
2190  {
2191  poly mon = pCopy( mm );
2192 
2193  if ( numVectors == veclistmax )
2194  {
2196  (veclistmax) * sizeof( resVector ),
2197  (veclistmax + veclistblock) * sizeof( resVector ) );
2198  int k;
2199  for ( k= veclistmax; k < (veclistmax + veclistblock); k++ )
2200  resVectorList[k].init();
2203 
2204  }
2205  resVectorList[numVectors].init( mon );
2206  numVectors++;
2208  return;
2209  }
2210  else
2211  {
2212  if ( var == (currRing->N)+1 ) return;
2213  poly newm = pCopy( mm );
2214  while ( deg >= 0 )
2215  {
2216  generateMonoms( newm, var+1, deg );
2217  pIncrExp( newm, var );
2218  pSetm( newm );
2219  deg--;
2220  }
2221  pDelete( & newm );
2222  }
2223 
2224  return;
2225 }
#define ST_DENSE_MEM
Definition: mpr_global.h:66
#define ST_DENSE_NMON
Definition: mpr_global.h:67
#define omReallocSize(addr, o_size, size)
Definition: omAllocDecl.h:220
#define pIncrExp(p, i)
Definition: polys.h:43
void init()
Definition: mpr_base.cc:2004

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

2551 {
2552  int k,i;
2553 
2554  // copy evaluation point into matrix
2555  // p0, p1, ..., pn replace u0, u1, ..., un
2556  for ( k= numVectors - 1; k >= 0; k-- )
2557  {
2558  if ( linPolyS == getMVector(k)->elementOfS )
2559  {
2560  for ( i= 0; i < (currRing->N); i++ )
2561  {
2562  number np=pGetCoeff(MATELEM(m,numVectors-k,numVectors-(getMVector(k)->numColParNr)[i]));
2563  if (np!=NULL) nDelete(&np);
2564  pSetCoeff0( 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
2573  poly res= singclap_det( m, currRing );
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 }
poly singclap_det(const matrix m, const ring s)
Definition: clapsing.cc:1757
CanonicalForm res
Definition: facAbsFact.cc:60
#define ST__DET
Definition: mpr_global.h:78
#define mprPROT(msg)
Definition: mpr_global.h:41

◆ getMatrix()

ideal resMatrixDense::getMatrix ( )
virtual

Returns the matrix M in an usable presentation.

Reimplemented from resMatrixBase.

Definition at line 2469 of file mpr_base.cc.

2470 {
2471  int i,j;
2472 
2473  // copy matrix
2474  matrix resmat= mpNew(numVectors,numVectors);
2475  poly p;
2476  for (i=1; i <= numVectors; i++)
2477  {
2478  for (j=1; j <= numVectors; j++ )
2479  {
2480  p=MATELEM(m,i,j);
2481  if (( p!=NULL)
2482  && (!nIsZero(pGetCoeff(p)))
2483  && (pGetCoeff(p)!=NULL)
2484  )
2485  {
2486  MATELEM(resmat,i,j)= pCopy( p );
2487  }
2488  }
2489  }
2490  for (i=0; i < numVectors; i++)
2491  {
2492  if ( resVectorList[i].elementOfS == linPolyS )
2493  {
2494  for (j=1; j <= (currRing->N); j++ )
2495  {
2496  if ( MATELEM(resmat,numVectors-i,
2497  numVectors-resVectorList[i].numColParNr[j-1])!=NULL )
2498  pDelete( &MATELEM(resmat,numVectors-i,numVectors-resVectorList[i].numColParNr[j-1]) );
2499  MATELEM(resmat,numVectors-i,numVectors-resVectorList[i].numColParNr[j-1])= pOne();
2500  // FIX ME
2501  if ( FALSE )
2502  {
2503  pSetCoeff( MATELEM(resmat,numVectors-i,numVectors-resVectorList[i].numColParNr[j-1]), n_Param(j,currRing) );
2504  }
2505  else
2506  {
2507  pSetExp( MATELEM(resmat,numVectors-i,numVectors-resVectorList[i].numColParNr[j-1]), j, 1 );
2508  pSetm(MATELEM(resmat,numVectors-i,numVectors-resVectorList[i].numColParNr[j-1]));
2509  }
2510  }
2511  }
2512  }
2513 
2514  // obachman: idMatrix2Module frees resmat !!
2515  ideal resmod= id_Matrix2Module(resmat,currRing);
2516  return resmod;
2517 }
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:780
#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

◆ getMVector()

resVector * resMatrixDense::getMVector ( const int  i)

column vector of matrix, index von 0 ...

numVectors-1

Definition at line 2463 of file mpr_base.cc.

2464 {
2465  assume( i >= 0 && i < numVectors );
2466  return &resVectorList[i];
2467 }
#define assume(x)
Definition: mod2.h:389

◆ 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 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 }
int l
Definition: cfEzgcd.cc:100

◆ getSubMatrix()

ideal resMatrixDense::getSubMatrix ( )
virtual

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

Reimplemented from resMatrixBase.

Definition at line 2519 of file mpr_base.cc.

2520 {
2521  int k,i,j,l;
2522  resVector *vecp;
2523 
2524  // generate quadratic matrix resmat of size subSize
2525  matrix resmat= mpNew( subSize, subSize );
2526 
2527  j=1;
2528  for ( k= numVectors - 1; k >= 0; k-- )
2529  {
2530  vecp= getMVector(k);
2531  if ( vecp->isReduced ) continue;
2532  l=1;
2533  for ( i= numVectors - 1; i >= 0; i-- )
2534  {
2535  if ( getMVector(i)->isReduced ) continue;
2536  if ( !nIsZero(vecp->getElemNum(numVectors - i - 1)) )
2537  {
2538  MATELEM(resmat,j,l)= pCopy( vecp->getElem(numVectors-i-1) );
2539  }
2540  l++;
2541  }
2542  j++;
2543  }
2544 
2545  // obachman: idMatrix2Module frees resmat !!
2546  ideal resmod= id_Matrix2Module(resmat,currRing);
2547  return resmod;
2548 }
poly getElem(const int i)
index von 0 ...
Definition: mpr_base.cc:2047

Field Documentation

◆ m

matrix resMatrixDense::m
private

Definition at line 1995 of file mpr_base.cc.

◆ numVectors

int resMatrixDense::numVectors
private

Definition at line 1992 of file mpr_base.cc.

◆ resVectorList

resVector* resMatrixDense::resVectorList
private

Definition at line 1988 of file mpr_base.cc.

◆ subSize

int resMatrixDense::subSize
private

Definition at line 1993 of file mpr_base.cc.

◆ veclistblock

int resMatrixDense::veclistblock
private

Definition at line 1991 of file mpr_base.cc.

◆ veclistmax

int resMatrixDense::veclistmax
private

Definition at line 1990 of file mpr_base.cc.


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