Changeset 7a30b9 in git
- Timestamp:
- Sep 29, 1997, 10:51:48 AM (26 years ago)
- Branches:
- (u'spielwiese', 'e7cc1ebecb61be8b9ca6c18016352af89940b21a')
- Children:
- 45251f2adf94ee083a91e1ceace284a181aa49e9
- Parents:
- 735322ba51c2f4f8a528f3a56ff51422cb5918ab
- Location:
- Singular
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/syz.h
r735322b r7a30b9 4 4 * Computer Algebra System SINGULAR * 5 5 ****************************************/ 6 /* $Id: syz.h,v 1. 5 1997-07-09 15:54:06 SingularExp $ */6 /* $Id: syz.h,v 1.6 1997-09-29 08:51:44 siebert Exp $ */ 7 7 /* 8 8 * ABSTRACT: Resolutions … … 43 43 int highdeg_1; 44 44 intvec * resolution; 45 intvec * cw; 45 46 }; 46 47 -
Singular/syz1.cc
r735322b r7a30b9 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: syz1.cc,v 1.1 2 1997-07-10 12:03:43 SingularExp $ */4 /* $Id: syz1.cc,v 1.13 1997-09-29 08:51:48 siebert Exp $ */ 5 5 /* 6 6 * ABSTRACT: resolutions … … 878 878 879 879 /*3 880 * local procedure for of syInitRes for the module case 881 */ 882 static int syChMin(intvec * iv) 883 { 884 int i,j=-1,r=-1; 885 886 for (i=iv->length()-1;i>=0;i--) 887 { 888 if ((*iv)[i]>=0) 889 { 890 if ((j<0) || ((*iv)[i]<j)) 891 { 892 j = (*iv)[i]; 893 r = i; 894 } 895 } 896 } 897 return r; 898 } 899 900 /*3 880 901 * initialize the resolution and puts in the argument as 881 902 * zeroth entre, length must be > 0 882 903 * assumes that the basering is degree-compatible 883 904 */ 884 static SRes syInitRes(ideal arg,int * length, intvec * Tl )905 static SRes syInitRes(ideal arg,int * length, intvec * Tl, intvec * cw=NULL) 885 906 { 886 907 if (idIs0(arg)) return NULL; 887 908 SRes resPairs = (SRes)Alloc0(*length*sizeof(SSet)); 888 909 resPairs[0] = (SSet)Alloc0(IDELEMS(arg)*sizeof(SObject)); 889 intvec * iv = idSort(arg); 890 int i; 891 892 for (i=0;i<IDELEMS(arg);i++) 893 { 894 (resPairs[0])[i].syz = /*pCopy*/(arg->m[(*iv)[i]-1]); 895 arg->m[(*iv)[i]-1] = NULL; 896 (resPairs[0])[i].order = pTotaldegree((resPairs[0])[i].syz); 897 } 898 delete iv; 910 intvec * iv=NULL; 911 int i,j; 912 913 if (idRankFreeModule(arg)==0) 914 { 915 iv = idSort(arg); 916 for (i=0;i<IDELEMS(arg);i++) 917 { 918 (resPairs[0])[i].syz = /*pCopy*/(arg->m[(*iv)[i]-1]); 919 arg->m[(*iv)[i]-1] = NULL; 920 (resPairs[0])[i].order = pTotaldegree((resPairs[0])[i].syz); 921 } 922 } 923 else 924 { 925 iv = new intvec(IDELEMS(arg),1,-1); 926 for (i=0;i<IDELEMS(arg);i++) 927 { 928 (*iv)[i] = pTotaldegree(arg->m[i])+(*cw)[pGetComp(arg->m[i])-1]; 929 } 930 for (i=0;i<IDELEMS(arg);i++) 931 { 932 j = syChMin(iv); 933 if (j<0) break; 934 (resPairs[0])[i].syz = arg->m[j]; 935 arg->m[j] = NULL; 936 (resPairs[0])[i].order = (*iv)[j]; 937 (*iv)[j] = -1; 938 } 939 } 940 if (iv!=NULL) delete iv; 899 941 (*Tl)[0] = IDELEMS(arg); 900 942 return resPairs; … … 924 966 tc = trind1[pGetComp(p)]-1; 925 967 else 926 tc = pGetComp(p) ;968 tc = pGetComp(p)-1; 927 969 loop //while ((j<ie) && (trind1[orc]<=tc+1)) 928 970 { … … 1277 1319 static void syEnterPair(SSet sPairs, SObject * so, int * sPlength,int index) 1278 1320 { 1279 int ll,k,no= pGetOrder((*so).lcm),sP=*sPlength,i;1321 int ll,k,no=(*so).order,sP=*sPlength,i; 1280 1322 poly p=(*so).lcm; 1281 1323 … … 1414 1456 nPm[ii] = NULL; 1415 1457 tso.order = pGetOrder(p) = pTotaldegree(p); 1458 if ((syzstr->cw!=NULL) && (index>0) && (pGetComp(q)>0)) 1459 { 1460 int ii=index-1,jj=pGetComp(q); 1461 while (ii>0) 1462 { 1463 jj = pGetComp(syzstr->res[ii]->m[jj-1]); 1464 ii--; 1465 } 1466 tso.order += (*syzstr->cw)[jj-1]; 1467 } 1416 1468 tso.p1 = rs[ii]; 1417 1469 tso.p2 = q; … … 1444 1496 } 1445 1497 1446 /*3 1447 * looks through the pair set and the given module for 1448 * remaining pairs or generators to consider 1449 * returns a pointer to the first pair and the number of them in the given module 1450 * works with slanted degree (i.e. deg=realdeg-index) 1451 */ 1452 static SSet syChosePairs(syStrategy syzstr, int *index, 1453 int *howmuch, int * actdeg) 1498 static SSet syChosePairsPutIn(syStrategy syzstr, int *index, 1499 int *howmuch, int * actdeg, int an, int en) 1454 1500 { 1455 1501 int newdeg=*actdeg,newindex=-1,i,t,sldeg; … … 1458 1504 SRes resPairs=syzstr->resPairs; 1459 1505 1460 while (*index<syzstr->length) 1506 if (an>syzstr->length) return NULL; 1507 if (en>syzstr->length) en=syzstr->length; 1508 while (*index<en) 1461 1509 { 1462 1510 if (resPairs[*index]!=NULL) … … 1468 1516 while ((i<(*syzstr->Tl)[*index])) 1469 1517 { 1470 p = (resPairs[*index])[i].lcm; 1471 if (p!=NULL) 1518 if ((resPairs[*index])[i].lcm!=NULL) 1472 1519 { 1473 if ( pGetOrder(p)== sldeg)1520 if ((resPairs[*index])[i].order == sldeg) 1474 1521 { 1475 1522 result = &(resPairs[*index])[i]; … … 1477 1524 i++; 1478 1525 while ((i<(*syzstr->Tl)[*index]) && ((resPairs[*index])[i].lcm!=NULL) 1479 && ( pGetOrder((resPairs[*index])[i].lcm)== sldeg))1526 && ((resPairs[*index])[i].order == sldeg)) 1480 1527 { 1481 1528 i++; … … 1494 1541 if ((resPairs[*index])[i].syz!=NULL) 1495 1542 { 1496 if ( pTotaldegree((resPairs[*index])[i].syz)== sldeg)1543 if ((resPairs[*index])[i].order == sldeg) 1497 1544 { 1498 1545 result = &(resPairs[*index])[i]; … … 1500 1547 i++; 1501 1548 while ((i<(*syzstr->Tl)[*index]) && ((resPairs[*index])[i].syz!=NULL) 1502 && ( pTotaldegree((resPairs[*index])[i].syz)== *actdeg))1549 && ((resPairs[*index])[i].order == *actdeg)) 1503 1550 { 1504 1551 i++; … … 1514 1561 (*index)++; 1515 1562 } 1516 *index = 0;1563 *index = an; 1517 1564 //if (TEST_OPT_PROT) Print("(Euler:%d)",euler); 1518 while (*index< syzstr->length)1565 while (*index<en) 1519 1566 { 1520 1567 if (resPairs[*index]!=NULL) … … 1524 1571 { 1525 1572 t = *actdeg+*index; 1526 p = (resPairs[*index])[i].lcm; 1527 if (p!=NULL) 1528 { 1529 if (pGetOrder(p) > t) 1530 t = pGetOrder(p); 1531 } 1532 else if ((resPairs[*index])[i].syz!=NULL) 1533 { 1534 if (pTotaldegree((resPairs[*index])[i].syz) > t) 1535 t = pTotaldegree((resPairs[*index])[i].syz); 1573 if (((resPairs[*index])[i].lcm!=NULL) || 1574 ((resPairs[*index])[i].syz!=NULL)) 1575 { 1576 if ((resPairs[*index])[i].order > t) 1577 t = (resPairs[*index])[i].order; 1536 1578 } 1537 1579 if ((t>*actdeg+*index) && ((newdeg==*actdeg) || (t<newdeg+*index))) … … 1550 1592 *actdeg = newdeg; 1551 1593 *index = newindex; 1552 return syChosePairs (syzstr,index,howmuch,actdeg);1594 return syChosePairsPutIn(syzstr,index,howmuch,actdeg,an,en); 1553 1595 } 1554 1596 else return NULL; 1597 } 1598 1599 /*3 1600 * FOR THE HOMOGENEOUS CASE ONLY! 1601 * looks through the pair set and the given module for 1602 * remaining pairs or generators to consider 1603 * returns a pointer to the first pair and the number of them in the given module 1604 * works with slanted degree (i.e. deg=realdeg-index) 1605 */ 1606 static SSet syChosePairs(syStrategy syzstr, int *index, 1607 int *howmuch, int * actdeg) 1608 { 1609 return syChosePairsPutIn(syzsts,index,howmuch,actdeg,0,syzstr->length); 1610 } 1611 1612 /*3 1613 * FOR THE INHOMOGENEOUS CASE ONLY! 1614 * looks through the pair set and the given module for 1615 * remaining pairs or generators to consider 1616 * returns a pointer to the first pair and the number of them in the given module 1617 * works with slanted degree (i.e. deg=realdeg-index) 1618 * looks first through the 0 and 1 module then through the other 1619 */ 1620 static SSet syChosePairsIH(syStrategy syzstr, int *index, 1621 int *howmuch, int * actdeg, int mindeg) 1622 { 1623 SSet result=NULL; 1624 1625 result = syChosePairsPutIn(syzstr,index,howmuch,actdeg,0,2); 1626 if (result == NULL) 1627 { 1628 *actdeg = mindeg; 1629 result = syChosePairsPutIn(syzstr,index,howmuch,actdeg,2,syzstr->length); 1630 } 1631 return result; 1555 1632 } 1556 1633 … … 1602 1679 * if ((resPairs[*index])[i].syz!=NULL) 1603 1680 * { 1604 * if ( pTotaldegree((resPairs[*index])[i].syz)== *actdeg)1681 * if ((resPairs[*index])[i].order == *actdeg) 1605 1682 * { 1606 1683 * result = &(resPairs[*index])[i]; … … 1608 1685 * i++; 1609 1686 * while ((i<(*Tl)[*index]) && ((resPairs[*index])[i].syz!=NULL) 1610 * && ( pTotaldegree((resPairs[*index])[i].syz)== *actdeg))1687 * && ((resPairs[*index])[i].order == *actdeg)) 1611 1688 * { 1612 1689 * i++; … … 1638 1715 * else if ((resPairs[*index])[i].syz!=NULL) 1639 1716 * { 1640 * if ( pTotaldegree((resPairs[*index])[i].syz)> *actdeg)1641 * t = pTotaldegree((resPairs[*index])[i].syz);1717 * if ((resPairs[*index])[i].order > *actdeg) 1718 * t = (resPairs[*index])[i].order; 1642 1719 * } 1643 1720 * if ((t>*actdeg) && ((newdeg==*actdeg) || (t<newdeg))) … … 1821 1898 Free((ADDRESS)syzstr->fullres,(syzstr->length+1)*sizeof(ideal)); 1822 1899 } 1900 if (syzstr->cw!=NULL) 1901 delete syzstr->cw; 1823 1902 if (syzstr->resolution!=NULL) 1824 1903 delete syzstr->resolution; … … 1858 1937 jj=jj+2; 1859 1938 intvec *result=new intvec(j,jj,0); 1860 IMATELEM(*result,1,1) = idRankFreeModule(syzstr->res[1]);1939 IMATELEM(*result,1,1) = max(1,idRankFreeModule(syzstr->res[1])); 1861 1940 for (i=0;i<jj;i++) 1862 1941 { … … 2697 2776 SSet nextPairs; 2698 2777 syStrategy syzstr=(syStrategy)Alloc0(sizeof(ssyStrategy)); 2778 if ((idIs0(arg)) || 2779 ((idRankFreeModule(arg)>0) && (!idHomModule(arg,NULL,&(syzstr->cw))))) 2780 { 2781 syzstr->minres = (resolvente)Alloc0(sizeof(ideal)); 2782 syzstr->length = 1; 2783 syzstr->minres[0] = idInit(1,arg->rank); 2784 return syzstr; 2785 } 2699 2786 pSetmProc oldSetm=pSetm; 2700 2787 pCompProc oldComp0=pComp0; … … 2753 2840 } 2754 2841 pComp0 = syzcomp2dpc; 2755 syzstr->resPairs = syInitRes(temp,length,syzstr->Tl); 2842 currcomponents = (int*)Alloc0((arg->rank+1)*sizeof(int)); 2843 for (i=0;i<=arg->rank;i++) 2844 currcomponents[i] = i; 2845 syzstr->resPairs = syInitRes(temp,length,syzstr->Tl,syzstr->cw); 2846 Free((ADDRESS)currcomponents,(arg->rank+1)*sizeof(int)); 2756 2847 syzstr->res = (resolvente)Alloc0((*length+1)*sizeof(ideal)); 2757 2848 syzstr->orderedRes = (resolvente)Alloc0((*length+1)*sizeof(ideal)); … … 2774 2865 if (TEST_OPT_PROT) Print("%d",actdeg); 2775 2866 if (TEST_OPT_PROT) Print("(m%d)",index); 2776 currcomponents = syzstr->truecomponents[max(index-1,0)];2777 2867 if (index==0) 2778 2868 i = syInitSyzMod(syzstr,index,len0); 2779 2869 else 2780 2870 i = syInitSyzMod(syzstr,index); 2871 currcomponents = syzstr->truecomponents[max(index-1,0)]; 2781 2872 j = syInitSyzMod(syzstr,index+1); 2782 2873 if (index>0)
Note: See TracChangeset
for help on using the changeset viewer.