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, ... -> resMatrixDense ist eine u-Resultante, wobei special das lineare u-Polynom angibt More...
 
 ~resMatrixDense ()
 
resVectorgetMVector (const int i)
 column vector of matrix, index von 0 ... numVectors-1 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 ideal getMatrix ()
 
virtual ideal getSubMatrix ()
 
virtual poly getUDet (const number *)
 
virtual number getDetAt (const number *)
 
virtual number getSubDet ()
 
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, ... Sn and check if reduced/nonreduced and calculate size of submatrix. 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 1928 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 2063 of file mpr_base.cc.

2064 : resMatrixBase()
2065{
2066 int i;
2067
2069 gls= idCopy( _gls );
2070 linPolyS= special;
2071 m=NULL;
2072
2073 // init all
2075
2076 totDeg= 1;
2077 for ( i= 0; i < IDELEMS(gls); i++ )
2078 {
2079 totDeg*=pTotaldegree( (gls->m)[i] );
2080 }
2081
2082 mprSTICKYPROT2(" resultant deg: %d\n",totDeg);
2083
2085}
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:2342
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 2087 of file mpr_base.cc.

2088{
2089 int i,j;
2090 for (i=0; i < numVectors; i++)
2091 {
2092 pDelete( &resVectorList[i].mon );
2093 pDelete( &resVectorList[i].dividedBy );
2094 for ( j=0; j < resVectorList[i].numColVectorSize; j++ )
2095 {
2096 nDelete( resVectorList[i].numColVector+j );
2097 }
2098 // OB: ????? (solve_s.tst)
2099 if (resVectorList[i].numColVector!=NULL)
2100 omfreeSize( (void *)resVectorList[i].numColVector,
2101 numVectors * sizeof( number ) );
2102 if (resVectorList[i].numColParNr!=NULL)
2103 omfreeSize( (void *)resVectorList[i].numColParNr,
2104 ((currRing->N)+1) * sizeof(int) );
2105 }
2106
2107 omFreeSize( (void *)resVectorList, veclistmax*sizeof( resVector ) );
2108
2109 // free matrix m
2110 if ( m != NULL )
2111 {
2112 idDelete((ideal *)&m);
2113 }
2114}
resVector * resVectorList
Definition: mpr_base.cc:1987
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:2039

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

2120{
2121 int k,i,j;
2122 resVector *vecp;
2123
2125
2126 for ( i= 1; i <= MATROWS( m ); i++ )
2127 for ( j= 1; j <= MATCOLS( m ); j++ )
2128 {
2129 MATELEM(m,i,j)= pInit();
2130 pSetCoeff0( MATELEM(m,i,j), nInit(0) );
2131 }
2132
2133
2134 for ( k= 0; k <= numVectors - 1; k++ )
2135 {
2136 if ( linPolyS == getMVector(k)->elementOfS )
2137 {
2139 for ( i= 0; i < (currRing->N); i++ )
2140 {
2141 MATELEM(m,numVectors-k,numVectors-(getMVector(k)->numColParNr)[i])= pInit();
2142 }
2143 }
2144 else
2145 {
2147 vecp= getMVector(k);
2148 for ( i= 0; i < numVectors; i++)
2149 {
2150 if ( !nIsZero( vecp->getElemNum(i) ) )
2151 {
2152 MATELEM(m,numVectors - k,i + 1)= pInit();
2153 pSetCoeff0( MATELEM(m,numVectors - k,i + 1), nCopy(vecp->getElemNum(i)) );
2154 }
2155 }
2156 }
2157 } // for
2158 mprSTICKYPROT("\n");
2159
2160#ifdef mprDEBUG_ALL
2161 for ( k= numVectors - 1; k >= 0; k-- )
2162 {
2163 if ( linPolyS == getMVector(k)->elementOfS )
2164 {
2165 for ( i=0; i < (currRing->N); i++ )
2166 {
2167 Print(" %d ",(getMVector(k)->numColParNr)[i]);
2168 }
2169 PrintLn();
2170 }
2171 }
2172 for (i=1; i <= numVectors; i++)
2173 {
2174 for (j=1; j <= numVectors; j++ )
2175 {
2176 pWrite0(MATELEM(m,i,j));PrintS(" ");
2177 }
2178 PrintLn();
2179 }
2180#endif
2181}
int k
Definition: cfEzgcd.cc:99
resVector * getMVector(const int i)
column vector of matrix, index von 0 ... numVectors-1
Definition: mpr_base.cc:2462
#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 ... numVectors-1
Definition: mpr_base.cc:2055

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

2343{
2344 int k,j,i;
2345 number matEntry;
2346 poly pmatchPos;
2347 poly pi,factor,pmp;
2348
2349 // holds the degrees of F0, F1, ..., Fn
2350 intvec polyDegs( IDELEMS(gls) );
2351 for ( k= 0; k < IDELEMS(gls); k++ )
2352 polyDegs[k]= pTotaldegree( (gls->m)[k] );
2353
2354 // the internal Variable Ordering
2355 // make sure that the homogenization variable goes last!
2356 intvec iVO( (currRing->N) );
2357 if ( linPolyS != SNONE )
2358 {
2359 iVO[(currRing->N) - 1]= linPolyS;
2360 int p=0;
2361 for ( k= (currRing->N) - 1; k >= 0; k-- )
2362 {
2363 if ( k != linPolyS )
2364 {
2365 iVO[p]= k;
2366 p++;
2367 }
2368 }
2369 }
2370 else
2371 {
2372 linPolyS= 0;
2373 for ( k= 0; k < (currRing->N); k++ )
2374 iVO[k]= (currRing->N) - k - 1;
2375 }
2376
2377 // the critical degree d= sum( deg(Fi) ) - n
2378 int sumDeg= 0;
2379 for ( k= 0; k < polyDegs.rows(); k++ )
2380 sumDeg+= polyDegs[k];
2381 sumDeg-= polyDegs.rows() - 1;
2382
2383 // generate the base data
2384 generateMonomData( sumDeg, &polyDegs, &iVO );
2385
2386 // generate "matrix"
2387 for ( k= numVectors - 1; k >= 0; k-- )
2388 {
2389 if ( resVectorList[k].elementOfS != linPolyS )
2390 {
2391 // column k is a normal column with numerical or symbolic entries
2392 // init stuff
2395 resVectorList[k].numColVector= (number *)omAlloc( numVectors*sizeof( number ) );
2396 for ( i= 0; i < numVectors; i++ ) resVectorList[k].numColVector[i]= nInit(0);
2397
2398 // compute row poly
2400 pi= pp_DivideM( pi, resVectorList[k].dividedBy, currRing );
2401
2402 // fill in "matrix"
2403 while ( pi != NULL )
2404 {
2405 matEntry= nCopy(pGetCoeff(pi));
2406 pmatchPos= pLmInit( pi );
2407 pSetCoeff0( pmatchPos, nInit(1) );
2408
2409 for ( i= 0; i < numVectors; i++)
2410 if ( pLmEqual( pmatchPos, resVectorList[i].mon ) )
2411 break;
2412
2413 resVectorList[k].numColVector[numVectors - i - 1] = nCopy(matEntry);
2414
2415 pDelete( &pmatchPos );
2416 nDelete( &matEntry );
2417
2418 pIter( pi );
2419 }
2420 pDelete( &pi );
2421 }
2422 else
2423 {
2424 // column is a special column, i.e. is generated by S0 and F0
2425 // safe only the positions of the ui's in the column
2426 //mprPROTInl(" setup of numColParNr ",k);
2429 resVectorList[k].numColParNr= (int *)omAlloc0( ((currRing->N)+1) * sizeof(int) );
2430
2431 pi= (gls->m)[ resVectorList[k].elementOfS ];
2432 factor= pp_DivideM( resVectorList[k].mon, resVectorList[k].dividedBy, currRing );
2433
2434 j=0;
2435 while ( pi != NULL )
2436 { // fill in "matrix"
2437 pmp= pMult( pCopy( factor ), pHead( pi ) );
2438 pTest( pmp );
2439
2440 for ( i= 0; i < numVectors; i++)
2441 if ( pLmEqual( pmp, resVectorList[i].mon ) )
2442 break;
2443
2445 pDelete( &pmp );
2446 pIter( pi );
2447 j++;
2448 }
2449 pDelete( &pi );
2450 pDelete( &factor );
2451 }
2452 } // for ( k= numVectors - 1; k >= 0; k-- )
2453
2454 mprSTICKYPROT2(" size of matrix: %d\n",numVectors);
2455 mprSTICKYPROT2(" size of submatrix: %d\n",subSize);
2456
2457 // create the matrix M
2458 createMatrix();
2459
2460}
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:2119
void generateMonomData(int deg, intvec *polyDegs, intvec *iVO)
Generates needed set of monoms, split them into sets S0, ... Sn and check if reduced/nonreduced and c...
Definition: mpr_base.cc:2226
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:415
#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:2023
int elementOfS
number of the set S mon is element of
Definition: mpr_base.cc:2028
int * numColParNr
holds the index of u0, u1, ..., un, if (elementOfS == linPolyS) the size is given by (currRing->N)
Definition: mpr_base.cc:2033
number * numColVector
holds the column vector if (elementOfS != linPolyS)
Definition: mpr_base.cc:2036

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

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

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

2187{
2188 if ( deg == 0 )
2189 {
2190 poly mon = pCopy( mm );
2191
2192 if ( numVectors == veclistmax )
2193 {
2195 (veclistmax) * sizeof( resVector ),
2196 (veclistmax + veclistblock) * sizeof( resVector ) );
2197 int k;
2198 for ( k= veclistmax; k < (veclistmax + veclistblock); k++ )
2199 resVectorList[k].init();
2202
2203 }
2205 numVectors++;
2207 return;
2208 }
2209 else
2210 {
2211 if ( var == (currRing->N)+1 ) return;
2212 poly newm = pCopy( mm );
2213 while ( deg >= 0 )
2214 {
2215 generateMonoms( newm, var+1, deg );
2216 pIncrExp( newm, var );
2217 pSetm( newm );
2218 deg--;
2219 }
2220 pDelete( & newm );
2221 }
2222
2223 return;
2224}
#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:2003

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

2550{
2551 int k,i;
2552
2553 // copy evaluation point into matrix
2554 // p0, p1, ..., pn replace u0, u1, ..., un
2555 for ( k= numVectors - 1; k >= 0; k-- )
2556 {
2557 if ( linPolyS == getMVector(k)->elementOfS )
2558 {
2559 for ( i= 0; i < (currRing->N); i++ )
2560 {
2561 number np=pGetCoeff(MATELEM(m,numVectors-k,numVectors-(getMVector(k)->numColParNr)[i]));
2562 if (np!=NULL) nDelete(&np);
2563 pSetCoeff0( MATELEM(m,numVectors-k,numVectors-(getMVector(k)->numColParNr)[i]),
2564 nCopy(evpoint[i]) );
2565 }
2566 }
2567 }
2568
2570
2571 // evaluate determinant of matrix m using factory singclap_det
2572 poly res= singclap_det( m, currRing );
2573
2574 // avoid errors for det==0
2575 number numres;
2576 if ( (res!=NULL) && (!nIsZero(pGetCoeff( res ))) )
2577 {
2578 numres= nCopy( pGetCoeff( res ) );
2579 }
2580 else
2581 {
2582 numres= nInit(0);
2583 mprPROT("0");
2584 }
2585 pDelete( &res );
2586
2588
2589 return( numres );
2590}
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 2468 of file mpr_base.cc.

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

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

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

2593{
2594 int k,i,j,l;
2595 resVector *vecp;
2596
2597 // generate quadratic matrix mat of size subSize
2598 matrix mat= mpNew( subSize, subSize );
2599
2600 for ( i= 1; i <= MATROWS( mat ); i++ )
2601 {
2602 for ( j= 1; j <= MATCOLS( mat ); j++ )
2603 {
2604 MATELEM(mat,i,j)= pInit();
2605 pSetCoeff0( MATELEM(mat,i,j), nInit(0) );
2606 }
2607 }
2608 j=1;
2609 for ( k= numVectors - 1; k >= 0; k-- )
2610 {
2611 vecp= getMVector(k);
2612 if ( vecp->isReduced ) continue;
2613 l=1;
2614 for ( i= numVectors - 1; i >= 0; i-- )
2615 {
2616 if ( getMVector(i)->isReduced ) continue;
2617 if ( vecp->getElemNum(numVectors - i - 1) && !nIsZero(vecp->getElemNum(numVectors - i - 1)) )
2618 {
2619 pSetCoeff(MATELEM(mat, j , l ), nCopy(vecp->getElemNum(numVectors - i - 1)));
2620 }
2621 /* else
2622 {
2623 MATELEM(mat, j , l )= pOne();
2624 pSetCoeff(MATELEM(mat, j , l ), nInit(0) );
2625 }
2626 */
2627 l++;
2628 }
2629 j++;
2630 }
2631
2632 poly res= singclap_det( mat, currRing );
2633
2634 number numres;
2635 if ((res != NULL) && (!nIsZero(pGetCoeff( res ))) )
2636 {
2637 numres= nCopy(pGetCoeff( res ));
2638 }
2639 else
2640 {
2641 numres= nInit(0);
2642 }
2643 pDelete( &res );
2644 return numres;
2645}
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 2518 of file mpr_base.cc.

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

Field Documentation

◆ m

matrix resMatrixDense::m
private

Definition at line 1994 of file mpr_base.cc.

◆ numVectors

int resMatrixDense::numVectors
private

Definition at line 1991 of file mpr_base.cc.

◆ resVectorList

resVector* resMatrixDense::resVectorList
private

Definition at line 1987 of file mpr_base.cc.

◆ subSize

int resMatrixDense::subSize
private

Definition at line 1992 of file mpr_base.cc.

◆ veclistblock

int resMatrixDense::veclistblock
private

Definition at line 1990 of file mpr_base.cc.

◆ veclistmax

int resMatrixDense::veclistmax
private

Definition at line 1989 of file mpr_base.cc.


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