Changeset 4b2e47 in git
- Timestamp:
- May 7, 2012, 7:00:38 PM (11 years ago)
- Branches:
- (u'spielwiese', '828514cf6e480e4bafc26df99217bf2a1ed1ef45')
- Children:
- f3746721cf443ba4cbafcb32045986a9aa9ca197
- Parents:
- 8f57c0f58364149bf1fbc74361c05edbe29a0b09
- git-author:
- Oleksandr Motsak <motsak@mathematik.uni-kl.de>2012-05-07 19:00:38+02:00
- git-committer:
- Oleksandr Motsak <motsak@mathematik.uni-kl.de>2012-05-10 18:23:39+02:00
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/LIB/schreyer.lib
r8f57c0 r4b2e47 457 457 } 458 458 459 /* static */ proc SSinit( moduleM)459 /* static */ proc SSinit(def M) 460 460 { 461 461 if( (typeof(M) != "module") && (typeof(M) != "ideal") ) … … 472 472 "SSinit::Input"; 473 473 type(M); 474 DetailedPrint(M);474 // DetailedPrint(M); 475 475 attrib(M); 476 476 } … … 556 556 attrib(M); 557 557 attrib(M, "isHomog"); 558 DetailedPrint(M);558 // DetailedPrint(M); 559 559 } 560 560 … … 580 580 { 581 581 "SSinit::MRES"; 582 DetailedPrint(MRES); 582 MRES; 583 // DetailedPrint(MRES); 583 584 attrib(MRES, "isHomog"); 584 585 attrib(S); … … 627 628 L; 628 629 "iCompShift: ", iCompShift; 629 630 630 } 631 631 … … 644 644 { 645 645 a = L[i]; 646 "a: ", a;646 // "a: ", a; 647 647 c = leadcomp(a); 648 648 r = int(c); 649 aa = a[r]; 649 650 if(r > 0) 651 { 652 aa = a[r]; 653 } else 654 { 655 aa = a; 656 } 650 657 651 658 M = 0; … … 654 661 { 655 662 b = L[j]; 656 "b: ", b;663 // "b: ", b; 657 664 658 665 if( leadcomp(b) == c ) 659 666 { 660 bb = b[r]; 667 if(r > 0) 668 { 669 bb = b[r]; 670 } else 671 { 672 bb = b; 673 } 661 674 662 675 M[j] = (lcm(aa, bb) / aa); 663 676 } 664 677 } 678 679 // TODO: add quotient relations here... 665 680 666 681 M = simplify(M, 1 + 2 + 32); … … 682 697 } 683 698 699 attrib(S, "isSB", 1); 700 684 701 return (S); 685 702 686 703 } 687 704 688 proc Traverse(mult, index, Leads, Tails, LSyz) 689 { 690 691 692 } 693 694 705 proc SSReduce(poly m, def t, def L, def T, module LS) 706 { 707 int @DEBUG = !system("with", "ndebug"); 708 709 if( @DEBUG ) 710 { 711 "SSReduce::Input: "; 712 713 "mult: ", m; 714 "term: ", t; 715 "L: ", L; 716 "T: ", T; 717 "LS: ", LS; 718 } 719 720 vector s = 0; 721 722 if( t == 0 ) 723 { 724 return (s); 725 } 726 727 def product = m * t; 728 729 bigint c = leadcomp(t); 730 int r = int(c); 731 732 733 def a, b, nf; 734 735 // looking for an appropriate reducer 736 for( int k = ncols(L); k > 0; k-- ) 737 { 738 a = L[k]; 739 // with the same mod. component 740 if( leadcomp(a) == c ) 741 { 742 b = - (leadmonomial(product) / leadmonomial(L[k])); 743 // which divides the product 744 if( b != 0 ) 745 { 746 // "b: ", b; 747 nf = NF(b * gen(k), LS); 748 749 // "NF: ", nf; 750 // while the complement (the fraction) is not reducible by leading syzygies 751 if( nf != 0 ) 752 { 753 s = b * gen(k) + SSTraverse(b, k, L, T, LS); 754 break; 755 } 756 } 757 } 758 } 759 if( @DEBUG ) 760 { 761 "SSReduce::Output: ", s; 762 } 763 return (s); 764 } 765 766 proc SSTraverse(poly m, int i, def L, def T, module LS) 767 { 768 int @DEBUG = !system("with", "ndebug"); 769 770 if( @DEBUG ) 771 { 772 "SSTraverse::Input: "; 773 774 "index: ", i; 775 "mult: ", m; 776 777 "lead: ", L[i]; 778 "tail: ", T[i]; 779 780 "LSyz: ", LS; 781 } 782 783 // reduce the product m * ( L[i] + T[i] ): 784 // SSReduce(m, L[i], L, T, LS); 785 786 def @tail = T[i]; def @l; 787 788 vector s = 0; 789 790 while( size(@tail) > 0 ) 791 { 792 @l = lead(@tail); 793 s = s + SSReduce(m, @l, L, T, LS); 794 @tail = @tail - @l; 795 } 796 797 if( @DEBUG ) 798 { 799 "SSTraverse::Output: ", s; 800 } 801 return (s); 802 } 695 803 696 804 // module (N, LL, TT) = SSComputeSyzygy(L, T, @RANK); // shift syz.comp by @RANK! … … 712 820 } 713 821 714 715 // !!!!!!!!!!!!!!!!!!!!!!!!!!!! TODO !!!!!!!!!!!!!!!!!!!!!!!!!!!! //716 // !!!!!!!!!!!!!!!!!!!!!!!!!!!! TODO !!!!!!!!!!!!!!!!!!!!!!!!!!!! //717 // !!!!!!!!!!!!!!!!!!!!!!!!!!!! TODO !!!!!!!!!!!!!!!!!!!!!!!!!!!! //718 // !!!!!!!!!!!!!!!!!!!!!!!!!!!! TODO !!!!!!!!!!!!!!!!!!!!!!!!!!!! //719 // !!!!!!!!!!!!!!!!!!!!!!!!!!!! TODO !!!!!!!!!!!!!!!!!!!!!!!!!!!! //720 // !!!!!!!!!!!!!!!!!!!!!!!!!!!! TODO !!!!!!!!!!!!!!!!!!!!!!!!!!!! //721 // !!!!!!!!!!!!!!!!!!!!!!!!!!!! TODO !!!!!!!!!!!!!!!!!!!!!!!!!!!! //722 723 822 def a; bigint c; int r, k; poly aa; 724 823 725 def LS = SSComputeLeadingSyzygyTerms(L, 0); // iCompShift // 0? 726 for(k = ncols(LS); k >= 0; k-- ) 727 { 728 a = LS[k]; 729 "A: ", a; 730 c = leadcomp(a); 731 r = int(c); 732 aa = a[r]; 733 734 Traverse(aa, r, L, T, LS); 735 } 736 737 824 module LL = SSComputeLeadingSyzygyTerms(L, 0); // iCompShift // 0? 825 826 module TT, SYZ; 827 828 if( size(LL) > 0 ) 829 { 830 intvec iv_ds = sort(LL, "ds", 1)[2]; // ,1 => reversed! 831 LL = LL[iv_ds]; 832 833 vector @tail; 834 835 for(k = ncols(LL); k > 0; k-- ) 836 { 837 a = LL[k]; 838 c = leadcomp(a); r = int(c); 839 840 if (r > 0) 841 { 842 aa = a[r]; 843 } else 844 { 845 aa = a; 846 } 847 // "A: ", a, " --->>>> ", aa, " **** [", r, "]: "; 848 @tail = SSReduce(aa, L[r], L, T, LL) + SSTraverse(aa, r, L, T, LL); 849 TT[k] = @tail; 850 SYZ[k] = a + @tail; 851 } 852 } 853 854 module Z; 855 Z = 0; Z[iCompShift] = 0; Z = Z, transpose(LL); LL = transpose(Z); 856 Z = 0; Z[iCompShift] = 0; Z = Z, transpose(TT); TT = transpose(Z); 857 Z = 0; Z[iCompShift] = 0; Z = Z, transpose(SYZ); SYZ = transpose(Z); 858 859 860 /* 738 861 def opts = option(get); option(redSB); option(redTail); 739 862 module SYZ = std(syz(M)); // TODO: !!!!!!!!!!! … … 742 865 "SYZ: "; SYZ; print(SYZ); 743 866 744 module Z; Z[iCompShift] = 0; Z = Z, transpose(SYZ); SYZ = transpose(Z);745 746 867 "shifted SYZ: "; SYZ; print(SYZ); 747 868 … … 750 871 LL = lead(SYZ); // TODO: WRONG ORDERING!!!!!!!! 751 872 TT = Tail(SYZ); 752 753 754 // !!!!!!!!!!!!!!!!!!!!!!!!!!!! TODO !!!!!!!!!!!!!!!!!!!!!!!!!!!! // 755 // !!!!!!!!!!!!!!!!!!!!!!!!!!!! TODO !!!!!!!!!!!!!!!!!!!!!!!!!!!! // 756 // !!!!!!!!!!!!!!!!!!!!!!!!!!!! TODO !!!!!!!!!!!!!!!!!!!!!!!!!!!! // 757 // !!!!!!!!!!!!!!!!!!!!!!!!!!!! TODO !!!!!!!!!!!!!!!!!!!!!!!!!!!! // 758 // !!!!!!!!!!!!!!!!!!!!!!!!!!!! TODO !!!!!!!!!!!!!!!!!!!!!!!!!!!! // 759 // !!!!!!!!!!!!!!!!!!!!!!!!!!!! TODO !!!!!!!!!!!!!!!!!!!!!!!!!!!! // 760 // !!!!!!!!!!!!!!!!!!!!!!!!!!!! TODO !!!!!!!!!!!!!!!!!!!!!!!!!!!! // 761 762 intvec iv_ds = sort(LL, "ds", 1)[2]; // ,1 => reversed! 763 LL = LL[iv_ds]; 764 TT = TT[iv_ds]; 873 */ 765 874 766 875 if( @DEBUG ) … … 786 895 "SSstep::NextInducedRing"; 787 896 "basering: ", basering; attrib(basering); 788 // DetailedPrint(basering);789 897 } 790 898 … … 835 943 @V; 836 944 @RANK; 837 DetailedPrint(MRES);945 // DetailedPrint(MRES); 838 946 attrib(MRES, "isHomog"); 839 947 } … … 887 995 { 888 996 "SSstep::NextSyzOutput: "; 889 DetailedPrint(N);997 // DetailedPrint(N); 890 998 attrib(N); 891 999 } … … 960 1068 961 1069 module M = maxideal(1); M; 962 def S = SS syz(M); setring S; S;1070 def S = SSres(M, 0); setring S; S; 963 1071 "Only the first syzygy: "; 964 1072 RES; LRES; TRES; … … 972 1080 ideal M = w^2 - x*z, w*x - y*z, x^2 - w*y, x*y - z^2, y^2 - w*z; 973 1081 974 def S = SS syz(M); setring S; S;1082 def S = SSres(M, 0); setring S; S; 975 1083 "Only the first syzygy: "; 976 1084 RES; LRES; TRES; … … 1070 1178 // exportto(Schreyer, Syzextra::noop); 1071 1179 exportto(Schreyer, Syzextra::DetailedPrint); 1072 // exportto(Schreyer, Syzextra::leadmonom);1180 exportto(Schreyer, Syzextra::leadmonomial); 1073 1181 exportto(Schreyer, Syzextra::leadcomp); 1074 1182 // exportto(Schreyer, Syzextra::leadrawexp); … … 1102 1210 // exportto(Schreyer, Syzextra_g::noop); 1103 1211 exportto(Schreyer, Syzextra_g::DetailedPrint); 1104 // exportto(Schreyer, Syzextra_g::leadmonom);1212 exportto(Schreyer, Syzextra_g::leadmonomial); 1105 1213 exportto(Schreyer, Syzextra_g::leadcomp); 1106 1214 // exportto(Schreyer, Syzextra_g::leadrawexp); -
dyn_modules/syzextra/mod_main.cc
r8f57c0 r4b2e47 298 298 299 299 300 /// Get leading monom (no module component)300 /// Get leading term without a module component 301 301 static BOOLEAN leadmonom(leftv res, leftv h) 302 302 { … … 316 316 317 317 m = p_LmInit(p, r); 318 p_SetCoeff0(m, n_ Init(1, r), r);318 p_SetCoeff0(m, n_Copy(p_GetCoeff(p, r), r), r); 319 319 320 320 // if( p_GetComp(m, r) != 0 ) … … 344 344 NoReturn(res); 345 345 346 if ((h!=NULL) && (h->Typ()==VECTOR_CMD || h->Typ()==POLY_CMD) && (h->Data() != NULL))346 if ((h!=NULL) && (h->Typ()==VECTOR_CMD || h->Typ()==POLY_CMD)) 347 347 { 348 348 const ring r = currRing; … … 350 350 const poly p = (poly)(h->Data()); 351 351 352 assume( p != NULL ); 353 assume( p_LmTest(p, r) ); 354 355 const unsigned long iComp = p_GetComp(p, r); 356 357 assume( iComp > 0 ); // p is a vector 352 if (p != NULL ) 353 { 354 assume( p != NULL ); 355 assume( p_LmTest(p, r) ); 356 357 const unsigned long iComp = p_GetComp(p, r); 358 359 // assume( iComp > 0 ); // p is a vector 360 361 res->data = reinterpret_cast<void *>(jjLONG2N(iComp)); 362 } else 363 res->data = reinterpret_cast<void *>(jjLONG2N(0)); 364 358 365 359 366 res->rtyp = BIGINT_CMD; 360 res->data = reinterpret_cast<void *>(jjLONG2N(iComp));361 362 367 return FALSE; 363 368 } … … 785 790 #define ADD(A,B,C,D,E) ADD0(A->iiAddCproc, B, C, D, E) 786 791 ADD(psModulFunctions, currPack->libname, "DetailedPrint", FALSE, DetailedPrint); 787 ADD(psModulFunctions, currPack->libname, "leadmonom ", FALSE, leadmonom);792 ADD(psModulFunctions, currPack->libname, "leadmonomial", FALSE, leadmonom); 788 793 ADD(psModulFunctions, currPack->libname, "leadcomp", FALSE, leadcomp); 789 794 ADD(psModulFunctions, currPack->libname, "leadrawexp", FALSE, leadrawexp);
Note: See TracChangeset
for help on using the changeset viewer.