Changeset 41b473 in git for Singular/polys.cc
- Timestamp:
- Apr 23, 1998, 8:17:40 PM (26 years ago)
- Branches:
- (u'spielwiese', '17f1d200f27c5bd38f5dfc6e8a0879242279d1d8')
- Children:
- 356dc3d199dbfae000f47b6c6d67ce4cffcb5771
- Parents:
- 1d202e7f25871522d0ff3683f371e598b0a40eed
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/polys.cc
r1d202e r41b473 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: polys.cc,v 1.2 2 1998-04-08 16:04:31Singular Exp $ */4 /* $Id: polys.cc,v 1.23 1998-04-23 18:17:39 Singular Exp $ */ 5 5 6 6 /* … … 34 34 pCompProc pComp0; 35 35 36 int pVariables; // number of variables 36 int pVariables; // number of variables 37 37 int pVariablesW; // number of words of pVariables exponents 38 38 int pVariables1W; // number of words of (pVariables+1) exponents … … 41 41 int pLexSgn; // 1, for lex monom comps; -1 otherwise (exception: ls) 42 42 int pVarOffset; // controls the way exponents are stored in a vector 43 int pVarLowIndex; // lowest exponent index 44 int pVarHighIndex; // highest exponent index 43 int pVarLowIndex; // lowest exponent index 44 int pVarHighIndex; // highest exponent index 45 45 int pVarCompIndex; // Location of component in exponent vector 46 46 … … 116 116 { 117 117 p->Order = (((Order_t)pGetExp(p,1))<<(sizeof(Exponent_t)*8)) 118 + (Order_t)pGetExp(p,2); 118 + (Order_t)pGetExp(p,2); 119 119 } 120 120 … … 157 157 } \ 158 158 while(0) 159 159 160 160 #define Mreturn(d, multiplier) \ 161 161 { \ 162 162 if (d > 0) return multiplier; \ 163 163 return -multiplier; \ 164 } 164 } 165 165 166 166 static int pComp_otEXP_nwONE(poly p1, poly p2); … … 177 177 static int pComp_otEXPCOMP_nwODD(poly p1, poly p2); 178 178 179 179 180 180 // comp_nwONE is used if pVariables1W == 1 and component is compatible 181 181 // with ordering 182 static int pComp_otEXP_nwONE(poly p1, poly p2) 182 static int pComp_otEXP_nwONE(poly p1, poly p2) 183 183 { 184 184 register long d = pGetOrder(p1) - pGetOrder(p2); … … 193 193 // comp_otEXPCOMP_nwONE : pVariables1W == 1, priority is 194 194 // given to exponents, component is incompatible with ordering 195 static int pComp_otEXPCOMP_nwONE(poly p1, poly p2) 195 static int pComp_otEXPCOMP_nwONE(poly p1, poly p2) 196 196 { 197 197 register long d = pGetOrder(p1) - pGetOrder(p2); … … 206 206 // comp_otEXPCOMP_nwONE : pVariables1W == 1, priority is given to component, 207 207 // component is incompatible with ordering 208 static int pComp_otCOMPEXP_nwONE(poly p1, poly p2) 208 static int pComp_otCOMPEXP_nwONE(poly p1, poly p2) 209 209 { 210 210 register long d = pGetComp(p2) - pGetComp(p1); … … 213 213 if (d) Mreturn(d, pOrdSgn); 214 214 _pMonComp_otEXP_nwONE(p1, p2, d, goto NotEqual , return 0); 215 215 216 216 NotEqual: 217 217 Mreturn(d, pLexSgn); … … 219 219 220 220 // comp_nwTWO : pVariables1W == 2 and component is compatible with ordering 221 static int pComp_otEXP_nwTWO(poly p1, poly p2) 221 static int pComp_otEXP_nwTWO(poly p1, poly p2) 222 222 { 223 223 register long d = pGetOrder(p1) - pGetOrder(p2); … … 232 232 // comp_otEXPCOMP_nwTWO : pVariables1W == 2, priority is given to exponents, 233 233 // component is incompatible with ordering 234 static int pComp_otEXPCOMP_nwTWO(poly p1, poly p2) 234 static int pComp_otEXPCOMP_nwTWO(poly p1, poly p2) 235 235 { 236 236 register long d = pGetOrder(p1) - pGetOrder(p2); … … 238 238 if (d) Mreturn(d, pOrdSgn); 239 239 _pMonComp_otEXPCOMP_nwTWO(p1, p2, d, goto NotEqual, return 0); 240 240 241 241 NotEqual: 242 242 Mreturn(d, pLexSgn); … … 245 245 // comp_otEXPCOMP_nwTWO : pVariables1W == 2, priority is given to component, 246 246 // component is incompatible with ordering 247 static int pComp_otCOMPEXP_nwTWO(poly p1, poly p2) 247 static int pComp_otCOMPEXP_nwTWO(poly p1, poly p2) 248 248 { 249 249 register long d = pGetComp(p2) - pGetComp(p1); … … 252 252 if (d) Mreturn(d, pOrdSgn); 253 253 _pMonComp_otEXP_nwTWO(p1, p2, d, goto NotEqual , return 0); 254 254 255 255 NotEqual: 256 256 Mreturn(d, pLexSgn); … … 259 259 // comp_nwEVEN : pVariables1W == 2*i and component is compatible 260 260 // with ordering 261 static int pComp_otEXP_nwEVEN(poly p1, poly p2) 261 static int pComp_otEXP_nwEVEN(poly p1, poly p2) 262 262 { 263 263 register long d = pGetOrder(p1) - pGetOrder(p2); … … 272 272 // comp_otEXPCOMP_nwEVEN : pVariables1W == 2*i, priority is given to exponents, 273 273 // component is incompatible with ordering 274 static int pComp_otEXPCOMP_nwEVEN(poly p1, poly p2) 274 static int pComp_otEXPCOMP_nwEVEN(poly p1, poly p2) 275 275 { 276 276 register long d = pGetOrder(p1) - pGetOrder(p2); … … 285 285 // comp_otEXPCOMP_nwEVEN : pVariables1W == 2*i, priority is given to component, 286 286 // component is incompatible with ordering 287 static int pComp_otCOMPEXP_nwEVEN(poly p1, poly p2) 287 static int pComp_otCOMPEXP_nwEVEN(poly p1, poly p2) 288 288 { 289 289 register long d = pGetComp(p2) - pGetComp(p1); … … 292 292 if (d) Mreturn(d, pOrdSgn); 293 293 _pMonComp_otEXP_nwEVEN(p1, p2, pVariablesW, d, goto NotEqual, return 0); 294 294 295 295 NotEqual: 296 296 Mreturn(d, pLexSgn); … … 299 299 // comp_nwODD : pVariables1W == 2*i and component is compatible 300 300 // with ordering 301 static int pComp_otEXP_nwODD(poly p1, poly p2) 301 static int pComp_otEXP_nwODD(poly p1, poly p2) 302 302 { 303 303 register long d = pGetOrder(p1) - pGetOrder(p2); … … 312 312 // comp_otEXPCOMP_nwODD : pVariables1W == 2*i, priority is given to exponents, 313 313 // component is incompatible with ordering 314 static int pComp_otEXPCOMP_nwODD(poly p1, poly p2) 314 static int pComp_otEXPCOMP_nwODD(poly p1, poly p2) 315 315 { 316 316 register long d = pGetOrder(p1) - pGetOrder(p2); 317 if (d) 317 if (d) 318 318 { 319 319 if (d > 0) return pOrdSgn; 320 320 return -pOrdSgn; 321 321 } 322 322 323 323 _pMonComp_otEXPCOMP_nwODD(p1, p2, pVariables1W, d, goto NotEqual , return 0); 324 324 325 325 NotEqual: 326 326 Mreturn(d, pLexSgn); … … 329 329 // comp_otCOMPEXP_nwODD : pVariables1W == 2*i, priority is given to component, 330 330 // component is incompatible with ordering 331 static int pComp_otCOMPEXP_nwODD(poly p1, poly p2) 331 static int pComp_otCOMPEXP_nwODD(poly p1, poly p2) 332 332 { 333 333 register long d = pGetComp(p2) - pGetComp(p1); … … 336 336 if (d) Mreturn(d, pOrdSgn); 337 337 _pMonComp_otEXP_nwODD(p1, p2, pVariablesW, d, goto NotEqual, return 0); 338 338 339 339 NotEqual: 340 340 Mreturn(d, pLexSgn); … … 924 924 int pTotaldegree(poly p) 925 925 { 926 return pExpQuerSum(p); 926 return pExpQuerSum(p); 927 927 } 928 928 … … 1127 1127 else 1128 1128 { 1129 // component is compatible with exponent vector 1129 // component is compatible with exponent vector 1130 1130 if (pVariables1W == 1) *p = pComp_otEXP_nwONE; 1131 1131 else if (pVariables1W == 2) *p = pComp_otEXP_nwTWO; … … 1134 1134 } 1135 1135 break; 1136 1136 1137 1137 #ifdef PDEBUG 1138 1138 case ringorder_lp: … … 1155 1155 else 1156 1156 { 1157 // component is compatible with exponent vector 1157 // component is compatible with exponent vector 1158 1158 if (pVariables1W == 1) *p = pComp_otEXP_nwONE; 1159 1159 else if (pVariables1W == 2) *p = pComp_otEXP_nwTWO; … … 1167 1167 #endif 1168 1168 } 1169 1169 1170 1170 if (o_r == ringorder_lp || o_r == ringorder_ls) 1171 1171 { … … 1202 1202 *p = pComp_otCOMPEXP_nwEVEN; 1203 1203 break; 1204 1204 1205 1205 #ifdef PDEBUG 1206 1206 case ringorder_lp: … … 1373 1373 { 1374 1374 int i; 1375 pComponentOrder=1; 1376 if (ppNoether!=NULL) pDelete(&ppNoether); 1375 pVariables = r->N; 1376 if (complete) 1377 { 1378 pComponentOrder=1; 1379 if (ppNoether!=NULL) pDelete(&ppNoether); 1377 1380 #ifdef SRING 1378 pSRING=FALSE;1379 pAltVars=r->N+1;1381 pSRING=FALSE; 1382 pAltVars=r->N+1; 1380 1383 #endif 1381 pVariables = r->N; 1382 1383 // set the various size parameters and initialize memory1384 if ((((pVariables+1)*sizeof(Exponent_t)) % sizeof(void*)) == 0)1385 pVariables1W = (pVariables+1)*sizeof(Exponent_t) / sizeof(void*);1386 else1387 pVariables1W = ((pVariables+1)*sizeof(Exponent_t) / sizeof(void*)) + 1; 1388 1389 if ((((pVariables)*sizeof(Exponent_t)) % sizeof(void*)) == 0)1390 pVariablesW = (pVariables)*sizeof(Exponent_t) / sizeof(void*);1391 else1392 pVariablesW = ((pVariables)*sizeof(Exponent_t) / sizeof(void*)) + 1;1384 1385 // set the various size parameters and initialize memory 1386 if ((((pVariables+1)*sizeof(Exponent_t)) % sizeof(void*)) == 0) 1387 pVariables1W = (pVariables+1)*sizeof(Exponent_t) / sizeof(void*); 1388 else 1389 pVariables1W = ((pVariables+1)*sizeof(Exponent_t) / sizeof(void*)) + 1; 1390 1391 if ((((pVariables)*sizeof(Exponent_t)) % sizeof(void*)) == 0) 1392 pVariablesW = (pVariables)*sizeof(Exponent_t) / sizeof(void*); 1393 else 1394 pVariablesW = ((pVariables)*sizeof(Exponent_t) / sizeof(void*)) + 1; 1395 } 1393 1396 1394 1397 pMonomSize = POLYSIZE + (pVariables + 1) * sizeof(Exponent_t); 1395 if ((pMonomSize % sizeof(void*)) == 0) 1396 { 1397 pMonomSizeW = pMonomSize/sizeof(void*); 1398 } 1399 else 1400 { 1401 pMonomSizeW = pMonomSize/sizeof(void*) + 1; 1402 pMonomSize = pMonomSizeW*sizeof(void*); 1403 } 1404 1405 // Set default Var Indicies 1406 pSetVarIndicies(pVariables); 1407 1408 // Initialize memory management 1398 1399 // Initialize memory management 1409 1400 mmSpecializeBlock(pMonomSize); 1410 1411 pOrdSgn = r->OrdSgn; 1412 pVectorOut=(r->order[0]==ringorder_c); 1413 order=r->order; 1414 block0=r->block0; 1415 block1=r->block1; 1416 firstwv=NULL; 1417 polys_wv=r->wvhdl; 1418 /*------- only one real block ----------------------*/ 1419 pLexOrder=FALSE; 1420 pMixedOrder=FALSE; 1421 pFDeg=pDeg; 1422 if (pOrdSgn == 1) pLDeg = ldegb; 1423 else pLDeg = ldeg0; 1424 /*======== ordering type is (_,c) =========================*/ 1425 if ((order[0]==ringorder_unspec) 1426 ||( 1427 ((order[1]==ringorder_c)||(order[1]==ringorder_C)) 1428 && (order[0]!=ringorder_M) 1429 && (order[2]==0)) 1430 ) 1431 { 1432 if ((order[0]!=ringorder_unspec) 1433 && (order[1]==ringorder_C)) 1434 pComponentOrder=-1; 1435 if (pOrdSgn == -1) pLDeg = ldeg0c; 1436 SimpleChoose(order[0],order[1], &pComp0); 1437 SetpSetm(order[0],0); 1438 } 1439 /*======== ordering type is (c,_) =========================*/ 1440 else if (((order[0]==ringorder_c)||(order[0]==ringorder_C)) 1441 && (order[1]!=ringorder_M) 1442 && (order[2]==0)) 1443 { 1444 /* pLDeg = ldeg0; is standard*/ 1445 if (order[0]==ringorder_C) 1446 pComponentOrder=-1; 1447 SimpleChooseC(order[1], &pComp0); 1448 SetpSetm(order[1],1); 1449 } 1450 /*------- more than one block ----------------------*/ 1451 else 1452 { 1453 //pLexOrder=TRUE; 1454 pVectorOut=order[0]==ringorder_c; 1455 if ((pVectorOut)||(order[0]==ringorder_C)) 1456 { 1457 if(block1[1]!=pVariables) pLexOrder=TRUE; 1458 } 1401 1402 if (complete) 1403 { 1404 if ((pMonomSize % sizeof(void*)) == 0) 1405 { 1406 pMonomSizeW = pMonomSize/sizeof(void*); 1407 } 1459 1408 else 1460 1409 { 1461 if(block1[0]!=pVariables) pLexOrder=TRUE; 1462 } 1463 /*the number of orderings:*/ 1464 i = 0; 1465 while (order[++i] != 0); 1466 do 1467 { 1468 i--; 1469 HighSet(i, order[i]);/*sets also pMixedOrder to TRUE, if...*/ 1470 SetpSetm(order[i],i); 1471 } 1472 while (i != 0); 1473 1474 pComp0 = BlockComp; 1475 if ((order[0]!=ringorder_c)&&(order[0]!=ringorder_C)) 1476 { 1477 pLDeg = ldeg1c; 1478 } 1410 pMonomSizeW = pMonomSize/sizeof(void*) + 1; 1411 pMonomSize = pMonomSizeW*sizeof(void*); 1412 } 1413 1414 // Set default Var Indicies 1415 pSetVarIndicies(pVariables); 1416 1417 pOrdSgn = r->OrdSgn; 1418 pVectorOut=(r->order[0]==ringorder_c); 1419 order=r->order; 1420 block0=r->block0; 1421 block1=r->block1; 1422 firstwv=NULL; 1423 polys_wv=r->wvhdl; 1424 /*------- only one real block ----------------------*/ 1425 pLexOrder=FALSE; 1426 pMixedOrder=FALSE; 1427 pFDeg=pDeg; 1428 if (pOrdSgn == 1) pLDeg = ldegb; 1429 else pLDeg = ldeg0; 1430 /*======== ordering type is (_,c) =========================*/ 1431 if ((order[0]==ringorder_unspec) 1432 ||( 1433 ((order[1]==ringorder_c)||(order[1]==ringorder_C)) 1434 && (order[0]!=ringorder_M) 1435 && (order[2]==0)) 1436 ) 1437 { 1438 if ((order[0]!=ringorder_unspec) 1439 && (order[1]==ringorder_C)) 1440 pComponentOrder=-1; 1441 if (pOrdSgn == -1) pLDeg = ldeg0c; 1442 SimpleChoose(order[0],order[1], &pComp0); 1443 SetpSetm(order[0],0); 1444 } 1445 /*======== ordering type is (c,_) =========================*/ 1446 else if (((order[0]==ringorder_c)||(order[0]==ringorder_C)) 1447 && (order[1]!=ringorder_M) 1448 && (order[2]==0)) 1449 { 1450 /* pLDeg = ldeg0; is standard*/ 1451 if (order[0]==ringorder_C) 1452 pComponentOrder=-1; 1453 SimpleChooseC(order[1], &pComp0); 1454 SetpSetm(order[1],1); 1455 } 1456 /*------- more than one block ----------------------*/ 1479 1457 else 1480 1458 { 1481 pLDeg = ldeg1; 1482 } 1483 pFDeg = pWTotaldegree; // may be improved: pTotaldegree for lp/dp/ls/.. blocks 1484 } 1485 if ((pLexOrder) || (pOrdSgn==-1)) 1486 { 1487 test &= ~Sy_bit(OPT_REDTAIL); /* noredTail */ 1459 //pLexOrder=TRUE; 1460 pVectorOut=order[0]==ringorder_c; 1461 if ((pVectorOut)||(order[0]==ringorder_C)) 1462 { 1463 if(block1[1]!=pVariables) pLexOrder=TRUE; 1464 } 1465 else 1466 { 1467 if(block1[0]!=pVariables) pLexOrder=TRUE; 1468 } 1469 /*the number of orderings:*/ 1470 i = 0; 1471 while (order[++i] != 0); 1472 do 1473 { 1474 i--; 1475 HighSet(i, order[i]);/*sets also pMixedOrder to TRUE, if...*/ 1476 SetpSetm(order[i],i); 1477 } 1478 while (i != 0); 1479 1480 pComp0 = BlockComp; 1481 if ((order[0]!=ringorder_c)&&(order[0]!=ringorder_C)) 1482 { 1483 pLDeg = ldeg1c; 1484 } 1485 else 1486 { 1487 pLDeg = ldeg1; 1488 } 1489 // may be improved: pTotaldegree for lp/dp/ls/.. blocks 1490 pFDeg = pWTotaldegree; 1491 } 1492 if ((pLexOrder) || (pOrdSgn==-1)) 1493 { 1494 test &= ~Sy_bit(OPT_REDTAIL); /* noredTail */ 1495 } 1488 1496 } 1489 1497 }
Note: See TracChangeset
for help on using the changeset viewer.