Changeset 3ed0a6 in git
 Timestamp:
 Dec 2, 2010, 5:34:19 PM (13 years ago)
 Branches:
 (u'spielwiese', '0d6b7fcd9813a1ca1ed4220cfa2b104b97a0a003')
 Children:
 815d74c712bea6b3c721aa0284a36bc1adaad7e4
 Parents:
 0885fd647459512277b7845bd58e1dc03b19d502
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

kernel/polys1.cc
r0885fd r3ed0a6 1208 1208 } 1209 1209 1210 // orders monoms of poly using merge sort (ususally faster than1211 // insertion sort). ASSUMES that pSetm was performed on monoms1212 poly pOrdPolyMerge(poly p)1213 {1214 poly qq,pp,result=NULL;1215 1216 if (p == NULL) return NULL;1217 1218 loop1219 {1220 qq = p;1221 loop1222 {1223 if (pNext(p) == NULL)1224 {1225 result=pAdd(result, qq);1226 pTest(result);1227 return result;1228 }1229 if (pLmCmp(p,pNext(p)) != 1)1230 {1231 pp = p;1232 pIter(p);1233 pNext(pp) = NULL;1234 result = pAdd(result, qq);1235 break;1236 }1237 pIter(p);1238 }1239 }1240 }1241 1242 // orders monoms of poly using insertion sort, performs pSetm on each monom1243 poly pOrdPolyInsertSetm(poly p)1244 {1245 poly qq,result = NULL;1246 1247 #if 01248 while (p != NULL)1249 {1250 qq = p;1251 pIter(p);1252 qq>next = NULL;1253 pSetm(qq);1254 result = pAdd(result,qq);1255 pTest(result);1256 }1257 #else1258 while (p != NULL)1259 {1260 qq = p;1261 pIter(p);1262 qq>next = result;1263 result = qq;1264 pSetm(qq);1265 }1266 p = result;1267 result = NULL;1268 while (p != NULL)1269 {1270 qq = p;1271 pIter(p);1272 qq>next = NULL;1273 result = pAdd(result, qq);1274 }1275 pTest(result);1276 #endif1277 return result;1278 }1279 1280 1210 /*2 1281 1211 *returns a reordered copy of a polynomial, with permutation of the variables … … 1445 1375 } 1446 1376 1447 #if 01448 /*21449 *returns a reordered copy of a polynomial, with permutation of the variables1450 */1451 poly p_PermPoly (poly p, int * perm, ring oldRing,1452 int *par_perm, int OldPar, ring newRing)1453 {1454 int OldpVariables = oldRing>N;1455 poly result = NULL;1456 poly result_last = NULL;1457 poly aq=NULL; /* the map coefficient */1458 poly qq; /* the mapped monomial */1459 1460 while (p != NULL)1461 {1462 if (OldPar==0)1463 {1464 qq = pInit();1465 number n=newRing>cf>nMap(pGetCoeff(p));1466 if ((newRing>minpoly!=NULL)1467 && ((rField_is_Zp_a(newRing))  (rField_is_Q_a(newRing))))1468 {1469 newRing>cf>nNormalize(n);1470 }1471 pGetCoeff(qq)=n;1472 // coef may be zero: pTest(qq);1473 }1474 else1475 {1476 qq=p_ISet(1, newRing);1477 aq=naPermNumber(pGetCoeff(p),par_perm,OldPar, oldRing);1478 if ((newRing>minpoly!=NULL)1479 && ((rField_is_Zp_a(newRing))  (rField_is_Q_a(newRing))))1480 {1481 poly tmp=aq;1482 while (tmp!=NULL)1483 {1484 number n=pGetCoeff(tmp);1485 newRing>cf>nNormalize(n);1486 pGetCoeff(tmp)=n;1487 pIter(tmp);1488 }1489 }1490 //pTest(aq);1491 }1492 p_SetComp(qq, p_GetComp(p,oldRing), newRing);1493 if (newRing>cf>nIsZero(pGetCoeff(qq)))1494 {1495 p_DeleteLm(&qq, newRing);1496 }1497 else1498 {1499 int i;1500 int mapped_to_par=0;1501 for(i=1; i<=OldpVariables; i++)1502 {1503 int e=p_GetExp(p,i,oldRing);1504 if (e!=0)1505 {1506 if (perm==NULL)1507 {1508 p_SetExp(qq,i, e, newRing);1509 }1510 else if (perm[i]>0)1511 p_AddExp(qq,perm[i], e/*p_GetExp( p,i,oldRing)*/, newRing);1512 else if (perm[i]<0)1513 {1514 lnumber c=(lnumber)pGetCoeff(qq);1515 napAddExp(c>z,perm[i],e/*p_GetExp( p,i,oldRing)*/);1516 mapped_to_par=1;1517 }1518 else1519 {1520 /* this variable maps to 0 !*/1521 p_DeleteLm(&qq, newRing);1522 break;1523 }1524 }1525 }1526 if (mapped_to_par1527 && (newRing>minpoly!=NULL))1528 {1529 number n=pGetCoeff(qq);1530 newRing>cf>nNormalize(n);1531 pGetCoeff(qq)=n;1532 }1533 }1534 pIter(p);1535 if (qq!=NULL)1536 {1537 p_Setm(qq, newRing);1538 //pTest(aq);1539 //pTest(qq);1540 if (aq!=NULL) qq=pMult(aq,qq);1541 aq = qq;1542 while (pNext(aq) != NULL) pIter(aq);1543 if (result_last==NULL)1544 {1545 result=qq;1546 }1547 else1548 {1549 pNext(result_last)=qq;1550 }1551 result_last=aq;1552 aq = NULL;1553 }1554 else if (aq!=NULL)1555 {1556 p_Delete(&aq, newRing);1557 }1558 }1559 result=pOrdPolyMerge(result);1560 //pTest(result);1561 return result;1562 }1563 #endif1564 1565 1377 poly ppJet(poly p, int m) 1566 1378 {
Note: See TracChangeset
for help on using the changeset viewer.