Changeset dd5ab89 in git
 Timestamp:
 Apr 29, 2013, 12:43:59 PM (10 years ago)
 Branches:
 (u'jengelhdatetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
 Children:
 aba90e858d998d23e9f343db0210fff2a167df2f
 Parents:
 34636b48632d13ac0387fd040ea2249787e2b993
 gitauthor:
 Martin Lee <martinlee84@web.de>20130429 12:43:59+02:00
 gitcommitter:
 Martin Lee <martinlee84@web.de>20130523 18:18:13+02:00
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

factory/cf_gcd_smallp.cc
r34636b rdd5ab89 537 537 ppB= B/cB; 538 538 539 int sizeNewtonPolyg;540 int ** newtonPolyg= NULL;541 mat_ZZ MM;542 vec_ZZ V;543 bool compressConvexDense= false; //(ppA.level() == 2 && ppB.level() == 2);544 if (compressConvexDense)545 {546 CanonicalForm bufcA= cA;547 CanonicalForm bufcB= cB;548 cA= content (ppA, 1);549 cB= content (ppB, 1);550 ppA /= cA;551 ppB /= cB;552 gcdcAcB *= gcd (cA, cB);553 cA *= bufcA;554 cB *= bufcB;555 if (ppA.isUnivariate()  ppB.isUnivariate())556 {557 if (ppA.level() == ppB.level())558 {559 CanonicalForm result= gcd (ppA, ppB);560 coF= N ((ppA/result)*(cA/gcdcAcB));561 coG= N ((ppB/result)*(cB/gcdcAcB));562 return N (result*gcdcAcB);563 }564 else565 {566 coF= N (ppA*(cA/gcdcAcB));567 coG= N (ppB*(cB/gcdcAcB));568 return N (gcdcAcB);569 }570 }571 572 newtonPolyg= newtonPolygon (ppA,ppB, sizeNewtonPolyg);573 convexDense (newtonPolyg, sizeNewtonPolyg, MM, V);574 575 for (int i= 0; i < sizeNewtonPolyg; i++)576 delete [] newtonPolyg[i];577 delete [] newtonPolyg;578 579 ppA= compress (ppA, MM, V, false);580 ppB= compress (ppB, MM, V, false);581 MM= inv (MM);582 583 if (ppA.isUnivariate() && ppB.isUnivariate())584 {585 if (ppA.level() == ppB.level())586 {587 CanonicalForm result= gcd (ppA, ppB);588 coF= N (decompress ((ppA/result), MM, V)*(cA/gcdcAcB));589 coG= N (decompress ((ppB/result), MM, V)*(cB/gcdcAcB));590 return N (decompress (result, MM, V)*gcdcAcB);591 }592 else593 {594 coF= N (decompress (ppA, MM, V));595 coG= N (decompress (ppB, MM, V));596 return N (gcdcAcB);597 }598 }599 }600 601 539 CanonicalForm lcA, lcB; // leading coefficients of A and B 602 540 CanonicalForm gcdlcAlcB; … … 604 542 lcA= uni_lcoeff (ppA); 605 543 lcB= uni_lcoeff (ppB); 606 607 /*if (fdivides (lcA, lcB))608 {609 if (fdivides (A, B))610 return F/Lc(F);611 }612 if (fdivides (lcB, lcA))613 {614 if (fdivides (B, A))615 return G/Lc(G);616 }*/617 544 618 545 gcdlcAlcB= gcd (lcA, lcB); … … 817 744 ppCoG= mapDown (ppCoG, prim_elem, im_prim_elem, alpha, u, v); 818 745 DEBOUTLN (cerr, "ppH after mapDown= " << ppH); 819 if (compressConvexDense)820 {821 ppH= decompress (ppH, MM, V);822 ppCoF= decompress (ppCoF, MM, V);823 ppCoG= decompress (ppCoG, MM, V);824 }825 746 coF= N ((cA/gcdcAcB)*ppCoF); 826 747 coG= N ((cB/gcdcAcB)*ppCoG); … … 835 756 (fdivides (ppH, ppA, ppCoF) && fdivides (ppH, ppB, ppCoG))) 836 757 { 837 if (compressConvexDense)838 {839 ppH= decompress (ppH, MM, V);840 ppCoF= decompress (ppCoF, MM, V);841 ppCoG= decompress (ppCoG, MM, V);842 }843 758 coF= N ((cA/gcdcAcB)*ppCoF); 844 759 coG= N ((cB/gcdcAcB)*ppCoG); … … 998 913 ppB= B/cB; 999 914 1000 int sizeNewtonPolyg;1001 int ** newtonPolyg= NULL;1002 mat_ZZ MM;1003 vec_ZZ V;1004 bool compressConvexDense= false; //(ppA.level() == 2 && ppB.level() == 2);1005 if (compressConvexDense)1006 {1007 CanonicalForm bufcA= cA;1008 CanonicalForm bufcB= cB;1009 cA= content (ppA, 1);1010 cB= content (ppB, 1);1011 ppA /= cA;1012 ppB /= cB;1013 gcdcAcB *= gcd (cA, cB);1014 cA *= bufcA;1015 cB *= bufcB;1016 if (ppA.isUnivariate()  ppB.isUnivariate())1017 {1018 if (ppA.level() == ppB.level())1019 {1020 CanonicalForm result= gcd (ppA, ppB);1021 coF= N ((ppA/result)*(cA/gcdcAcB));1022 coG= N ((ppB/result)*(cB/gcdcAcB));1023 return N (result*gcdcAcB);1024 }1025 else1026 {1027 coF= N (ppA*(cA/gcdcAcB));1028 coG= N (ppB*(cB/gcdcAcB));1029 return N (gcdcAcB);1030 }1031 }1032 1033 newtonPolyg= newtonPolygon (ppA,ppB, sizeNewtonPolyg);1034 convexDense (newtonPolyg, sizeNewtonPolyg, MM, V);1035 1036 for (int i= 0; i < sizeNewtonPolyg; i++)1037 delete [] newtonPolyg[i];1038 delete [] newtonPolyg;1039 1040 ppA= compress (ppA, MM, V, false);1041 ppB= compress (ppB, MM, V, false);1042 MM= inv (MM);1043 1044 if (ppA.isUnivariate() && ppB.isUnivariate())1045 {1046 if (ppA.level() == ppB.level())1047 {1048 CanonicalForm result= gcd (ppA, ppB);1049 coF= N (decompress ((ppA/result), MM, V)*(cA/gcdcAcB));1050 coG= N (decompress ((ppB/result), MM, V)*(cB/gcdcAcB));1051 return N (decompress (result, MM, V)*gcdcAcB);1052 }1053 else1054 {1055 coF= N (decompress (ppA, MM, V));1056 coG= N (decompress (ppB, MM, V));1057 return N (gcdcAcB);1058 }1059 }1060 }1061 1062 915 CanonicalForm lcA, lcB; // leading coefficients of A and B 1063 916 CanonicalForm gcdlcAlcB; … … 1065 918 lcA= uni_lcoeff (ppA); 1066 919 lcB= uni_lcoeff (ppB); 1067 1068 /*if (fdivides (lcA, lcB))1069 {1070 if (fdivides (ppA, ppB, coG))1071 {1072 coF= 1;1073 if (compressConvexDense)1074 coG= decompress (coG, MM, V);1075 coG= N (coG*(cB/gcdcAcB));1076 return F;1077 }1078 }1079 if (fdivides (lcB, lcA))1080 {1081 if (fdivides (ppB, ppA, coF))1082 {1083 coG= 1;1084 if (compressConvexDense)1085 coF= decompress (coF, MM, V);1086 coF= N (coF*(cA/gcdcAcB));1087 return G;1088 }1089 }*/1090 920 1091 921 gcdlcAlcB= gcd (lcA, lcB); … … 1119 949 H= 0; 1120 950 bool fail= false; 1121 //topLevel= false;951 topLevel= false; 1122 952 bool inextension= false; 1123 953 int p=1; … … 1265 1095 ppCoG= GFMapDown (ppCoG, k); 1266 1096 DEBOUTLN (cerr, "ppH after mapDown= " << ppH); 1267 if (compressConvexDense)1268 {1269 ppH= decompress (ppH, MM, V);1270 ppCoF= decompress (ppCoF, MM, V);1271 ppCoG= decompress (ppCoG, MM, V);1272 }1273 1097 coF= N ((cA/gcdcAcB)*ppCoF); 1274 1098 coG= N ((cB/gcdcAcB)*ppCoG); … … 1286 1110 (fdivides (ppH, ppA, ppCoF) && fdivides (ppH, ppB, ppCoG))) 1287 1111 { 1288 if (compressConvexDense)1289 {1290 ppH= decompress (ppH, MM, V);1291 ppCoF= decompress (ppCoF, MM, V);1292 ppCoG= decompress (ppCoG, MM, V);1293 }1294 1112 coF= N ((cA/gcdcAcB)*ppCoF); 1295 1113 coG= N ((cB/gcdcAcB)*ppCoG); … … 1459 1277 ppB= B/cB; 1460 1278 1461 int sizeNewtonPolyg;1462 int ** newtonPolyg= NULL;1463 mat_ZZ MM;1464 vec_ZZ V;1465 bool compressConvexDense= false; //(ppA.level() == 2 && ppB.level() == 2);1466 if (compressConvexDense)1467 {1468 CanonicalForm bufcA= cA;1469 CanonicalForm bufcB= cB;1470 cA= content (ppA, 1);1471 cB= content (ppB, 1);1472 ppA /= cA;1473 ppB /= cB;1474 gcdcAcB *= gcd (cA, cB);1475 cA *= bufcA;1476 cB *= bufcB;1477 if (ppA.isUnivariate()  ppB.isUnivariate())1478 {1479 if (ppA.level() == ppB.level())1480 {1481 CanonicalForm result= gcd (ppA, ppB);1482 coF= N ((ppA/result)*(cA/gcdcAcB));1483 coG= N ((ppB/result)*(cB/gcdcAcB));1484 return N (result*gcdcAcB);1485 }1486 else1487 {1488 coF= N (ppA*(cA/gcdcAcB));1489 coG= N (ppB*(cB/gcdcAcB));1490 return N (gcdcAcB);1491 }1492 }1493 1494 newtonPolyg= newtonPolygon (ppA,ppB, sizeNewtonPolyg);1495 convexDense (newtonPolyg, sizeNewtonPolyg, MM, V);1496 1497 for (int i= 0; i < sizeNewtonPolyg; i++)1498 delete [] newtonPolyg[i];1499 delete [] newtonPolyg;1500 1501 ppA= compress (ppA, MM, V, false);1502 ppB= compress (ppB, MM, V, false);1503 MM= inv (MM);1504 1505 if (ppA.isUnivariate() && ppB.isUnivariate())1506 {1507 if (ppA.level() == ppB.level())1508 {1509 CanonicalForm result= gcd (ppA, ppB);1510 coF= N (decompress ((ppA/result), MM, V)*(cA/gcdcAcB));1511 coG= N (decompress ((ppB/result), MM, V)*(cB/gcdcAcB));1512 return N (decompress (result, MM, V)*gcdcAcB);1513 }1514 else1515 {1516 coF= N (decompress (ppA, MM, V));1517 coG= N (decompress (ppB, MM, V));1518 return N (gcdcAcB);1519 }1520 }1521 }1522 1523 1279 CanonicalForm lcA, lcB; // leading coefficients of A and B 1524 1280 CanonicalForm gcdlcAlcB; 1525 1281 lcA= uni_lcoeff (ppA); 1526 1282 lcB= uni_lcoeff (ppB); 1527 1528 /*if (fdivides (lcA, lcB))1529 {1530 if (fdivides (A, B))1531 return F/Lc(F);1532 }1533 if (fdivides (lcB, lcA))1534 {1535 if (fdivides (B, A))1536 return G/Lc(G);1537 }*/1538 1283 1539 1284 gcdlcAlcB= gcd (lcA, lcB); … … 1776 1521 (fdivides (ppH, ppA, ppCoF) && fdivides (ppH, ppB, ppCoG))) 1777 1522 { 1778 if (compressConvexDense)1779 {1780 ppH= decompress (ppH, MM, V);1781 ppCoF= decompress (ppCoF, MM, V);1782 ppCoG= decompress (ppCoG, MM, V);1783 }1784 1523 coF= N ((cA/gcdcAcB)*ppCoF); 1785 1524 coG= N ((cB/gcdcAcB)*ppCoG);
Note: See TracChangeset
for help on using the changeset viewer.