Changeset e7c67af in git
- Timestamp:
- Mar 29, 2011, 4:12:19 PM (12 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
- Children:
- 166ebd23be74a96b55b07ae3ee7b95a6fff5d62a
- Parents:
- bc4941560856aa3e6fb913d32837d1d18ad1e01e
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/LIB/multigrading.lib
rbc49415 re7c67af 308 308 } 309 309 } 310 if( !defined(S) )311 {}312 310 */ 313 311 … … 318 316 319 317 def H = attrib(L, attrGroupHNF); 320 if( !defined(H) ||typeof(H) != "intmat")318 if( typeof(H) != "intmat") 321 319 { 322 320 attrib(L, attrGroupHNF, hermiteNormalForm(L)); … … 324 322 325 323 def HH = attrib(L, attrGroupSNF); 326 if( !defined(HH) ||typeof(HH) != "intmat")324 if( typeof(HH) != "intmat") 327 325 { 328 326 attrib(L, attrGroupSNF, smithNormalForm(L)); … … 470 468 string attrGradingGroup = "gradingGroup"; 471 469 472 if( size(#) > 0 ) 473 { 474 if( typeof(#[1]) == "intmat" ) 475 { 476 def L = createGroup(M, #[1]); 477 } 478 479 if( isGroup(#[1]) ) 480 { 481 def L = #[1]; 470 int i = 1; 471 if( size(#) >= i ) 472 { 473 def a = #[i]; 474 if( typeof(a) == "intmat" ) 475 { 476 def L = createGroup(M, a); 477 i++; 478 } 479 480 if( isGroup(a) ) 481 { 482 def L = a; 482 483 483 484 if( !isSublattice(M, L[1]) ) … … 485 486 ERROR("Multigrading is not contained in the grading group!"); 486 487 } 487 } 488 i++; 489 } 490 if( i == 1 ){ ERROR("Wrong arguments: no group given?"); } 491 kill a; 488 492 } 489 493 else … … 492 496 } 493 497 494 if( !defined(L) ){ ERROR("Wrong arguments: no group given?"); }495 498 496 499 attrib(basering, attrMgrad, M); 497 500 attrib(basering, attrGradingGroup, L); 498 501 499 ideal Q = ideal(basering); 500 if( !isHomogeneous(Q ) ) // easy now, but would be hard before setting ring attributes!502 ideal Q = ideal(basering); // quotient ideal is assumed to be a GB! 503 if( !isHomogeneous(Q, "checkGens") ) // easy now, but would be hard before setting ring attributes! 501 504 { 502 505 "Warning: your quotient ideal is not homogenous (multigrading was set anyway)!"; … … 704 707 } 705 708 706 if( !defined(R))709 if( i == 1 ) 707 710 { 708 711 def R = basering; … … 805 808 if( size(#) >= i ) 806 809 { 807 if( ( typeof(#[i]) == "ring" ) or ( typeof(#[i]) == "qring" ) ) 810 def a = #[i]; 811 if( ( typeof(a) == "ring" ) or ( typeof(a) == "qring" ) ) 808 812 { 809 813 i++; 810 814 } 815 kill a; 811 816 } 812 817 … … 820 825 821 826 822 def T = G[2]; 827 def T = G[2]; 823 828 824 829 if( size(#) >= i ) 825 830 { 826 if( #[i] == "hermite" ) 831 def a = #[i]; 832 833 if( typeof(a) != "string" ) 834 { 835 ERROR("Sorry wrong arguments!"); 836 } 837 838 if( a == "hermite" ) 827 839 { 828 840 def M = attrib(T, attrGradingGroupHNF); 829 if( (!defined(M)) or (typeof(M) != "intmat"))841 if( typeof(M) != "intmat" ) 830 842 { 831 843 if( size(G) > 2 ) … … 840 852 } 841 853 842 if( #[i]== "smith" )854 if( a == "smith" ) 843 855 { 844 856 def M = attrib(T, attrGradingGroupSNF); 845 if( (!defined(M)) or (typeof(M) != "intmat"))857 if( typeof(M) != "intmat" ) 846 858 { 847 859 if( size(G) > 2 ) … … 1736 1748 " 1737 1749 { 1738 if( size(#) > 0 ) 1739 { 1740 if( typeof(#[1]) == "intmat" ) 1741 { 1742 intmat H = hermiteNormalForm(#[1]); 1743 } else 1744 { 1745 if( typeof(#[1]) == "list" ) 1746 { 1747 list L = #[1]; 1748 intmat H = attrib(L, "hermite"); // todo 1749 } 1750 } 1751 1752 } 1753 if( !defined(H) ) 1750 int i = 1; 1751 if( size(#) >= i ) 1752 { 1753 def a = #[1]; 1754 if( typeof(a) == "intmat" ) 1755 { 1756 intmat H = hermiteNormalForm(a); 1757 i++; 1758 } 1759 if( typeof(a) == "list" ) 1760 { 1761 list L = a; 1762 intmat H = attrib(L, "hermite"); // todo 1763 i++; 1764 } 1765 kill a; 1766 } 1767 1768 if( i == 1 ) 1754 1769 { 1755 1770 intmat H = getLattice("hermite"); 1756 1771 } 1757 1772 1758 int x, k, i,row;1773 int x, k, row; 1759 1774 1760 1775 int r = nrows(H); … … 1840 1855 " 1841 1856 { 1842 if( size(#) > 0 ) 1843 { 1844 if( typeof(#[1]) == "intmat" ) 1845 { 1846 intmat grad = #[1]; 1847 } 1848 } 1849 1850 if( !defined(grad) ) 1857 int i = 1; 1858 if( size(#) >= i ) 1859 { 1860 def a = #[1]; 1861 if( typeof(a) == "intmat" ) 1862 { 1863 intmat grad = a; 1864 i++; 1865 } 1866 kill a; 1867 } 1868 1869 if( i == 1 ) 1851 1870 { 1852 1871 intmat grad = getVariableWeights(); … … 1854 1873 1855 1874 intmat newgg[nrows(grad)][size(f)-1]; 1856 int i,j;1875 int j; 1857 1876 intvec l = grad*leadexp(f); 1858 1877 intvec v; … … 1961 1980 1962 1981 intmat oldgrad=getVariableWeights(pre); 1963 intmat old tor=getLattice(pre);1982 intmat oldlat=getLattice(pre); 1964 1983 1965 1984 int n=nvars(pre); … … 1970 1989 intmat newgrad[pp][np]; 1971 1990 1991 //This will set the finest grading on the image ring. We will proceed by coarsening this grading until f becomes homogeneous. 1972 1992 for(i=1;i<=np;i++){ newgrad[p+i,i]=1;} 1973 1993 … … 1976 1996 1977 1997 1978 list new tor;1998 list newlat; 1979 1999 intmat toadd; 1980 2000 int columns=0; … … 1987 2007 for(j=1;j<=n;j++){ toadd1[i,j]=oldgrad[i,j];} 1988 2008 } 1989 2009 2010 // This will make the images of homogeneous elements homogeneous, namely the variables of the preimage ring. 1990 2011 for(i=1;i<=n;i++){ 1991 2012 im=f[i]; 1992 2013 //im; 1993 2014 toadd = defineHomogeneous(im, newgrad); 1994 new tor=insert(newtor,toadd);2015 newlat=insert(newlat,toadd); 1995 2016 columns=columns+ncols(toadd); 1996 2017 … … 1999 2020 } 2000 2021 2001 new tor=insert(newtor,toadd1);2022 newlat=insert(newlat,toadd1); 2002 2023 columns=columns+ncols(toadd1); 2003 2024 2004 2025 //If the image ring is a quotient ring by some ideal, we have to coarsen the grading in order to make the ideal homogeneous. 2005 2026 if(typeof(basering)=="qring"){ 2006 2027 //"Entering qring"; … … 2010 2031 //toadd; 2011 2032 columns=columns+ncols(toadd); 2012 new tor=insert(newtor,toadd);2013 } 2014 } 2015 2016 // newtor;2017 intmat imofold tor[pp][ncols(oldtor)];2018 for(i=1; i<=nrows(old tor);i++){2019 for(j=1; j<=ncols(old tor); j++){2020 imofold tor[i,j]=oldtor[i,j];2021 } 2022 } 2023 2024 columns=columns+ncols(old tor);2025 new tor=insert(newtor, imofoldtor);2033 newlat=insert(newlat,toadd); 2034 } 2035 } 2036 2037 //The grading group of the preimage ring might not have been torsion free. We have to add this torsion to the grading group of the image ring. 2038 intmat imofoldlat[pp][ncols(oldlat)]; 2039 for(i=1; i<=nrows(oldlat);i++){ 2040 for(j=1; j<=ncols(oldlat); j++){ 2041 imofoldlat[i,j]=oldlat[i,j]; 2042 } 2043 } 2044 2045 columns=columns+ncols(oldlat); 2046 newlat=insert(newlat, imofoldlat); 2026 2047 2027 2048 intmat gragr[pp][columns]; 2028 2049 columns=0; 2029 for(k=1;k<=size(new tor);k++){2050 for(k=1;k<=size(newlat);k++){ 2030 2051 for(i=1;i<=pp;i++){ 2031 for(j=1;j<=ncols(newtor[k]);j++){gragr[i,j+columns]=newtor[k][i,j];} 2032 } 2033 columns=columns+ncols(newtor[k]); 2034 } 2035 2052 for(j=1;j<=ncols(newlat[k]);j++){gragr[i,j+columns]=newlat[k][i,j];} 2053 } 2054 columns=columns+ncols(newlat[k]); 2055 } 2056 2057 //The following is just for reducing the size of the matrices. 2036 2058 gragr=hermiteNormalForm(gragr); 2037 2059 intmat result[pp][pp]; … … 2389 2411 " 2390 2412 { 2391 if( defined(attrib(A, "grad")) > 0 ) 2392 { 2393 return (attrib(A, "grad")); 2413 def a = attrib(A, "grad"); 2414 if( typeof(a) == "intvec" || typeof(a) == "intmat" ) 2415 { 2416 return (a); 2394 2417 } 2395 2418 … … 2602 2625 ideal I; 2603 2626 poly mp, t, tt; 2627 intmat V; 2604 2628 } 2605 2629 else … … 2609 2633 module I; 2610 2634 vector mp, t, tt; 2635 intmat V = getModuleGrading(p); 2611 2636 } 2612 2637 else … … 2614 2639 ERROR("Wrong ARGUMENT type!"); 2615 2640 } 2616 }2617 2618 if( typeof(p) == "vector" )2619 {2620 intmat V = getModuleGrading(p);2621 }2622 else2623 {2624 intmat V;2625 2641 } 2626 2642 … … 2832 2848 " 2833 2849 { 2850 int @bf = 0; 2834 2851 if( nameof(basering) != "basering" ) 2835 2852 { 2836 def save = basering; 2853 @bf = 1; 2854 def @save@ = basering; 2837 2855 } 2838 2856 … … 2849 2867 intmat R = ( matrix2intmat( MM ) ); // transpose 2850 2868 2851 if( defined(save) > 0)2852 { 2853 setring save;2869 if( @bf == 1 ) 2870 { 2871 setring @save@; 2854 2872 } 2855 2873
Note: See TracChangeset
for help on using the changeset viewer.