Changeset 94cd93 in git
 Timestamp:
 Jan 19, 2015, 2:40:39 PM (9 years ago)
 Branches:
 (u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
 Children:
 a7c8b1fd065150adf6d6165eac463687c886eaae
 Parents:
 777f8bb0bd3e850c5c7084702f167df3c1b53113
 gitauthor:
 Oleksandr Motsak <motsak@mathematik.unikl.de>20150119 14:40:39+01:00
 gitcommitter:
 Oleksandr Motsak <motsak@mathematik.unikl.de>20150119 15:05:24+01:00
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

Singular/LIB/gradedModules.lib
r777f8b r94cd93 5 5 LIBRARY: gradedModules.lib Operations with graded modules/matrices/resolutions 6 6 AUTHOR: Oleksandr Motsak <U@D>, where U={motsak}, D={mathematik.unikl.de} 7 Hanieh Keneshlou <hkeneshlou@yahoo.com> 7 8 KEYWORDS: graded modules, graded homomorphisms, syzygies 8 9 OVERVIEW: 9 10 @* The library contains several procedures for operations with graded modules/matrices/resolutions 10 11 @* TODO! 11 12 NOTE: 12 @* try @code{example TestGRRes; } from examples13 @* try @code{example TestGRRes; example grsum; } from examples 13 14 PROCEDURES: 14 15 16 grzero() presentation of basering(0)^1 17 grshift(M,d) shift graded module M by d 18 grtwist(r,d) presentation of basering(d)^r 19 grsum(M,N) direct sum of two graded modules M \oplus N 20 grpower(M,p) direct pth power of graded module M 15 21 grview(M) view the graded structure of M 16 22 grdeg(M) compute graded degrees of M … … 22 28 @* 23 29 [MO] Motsak, O.: Noncommutative Computer Algebra with applications: Graded commutative algebra and related 24 structures in Singular with applications, Ph.D. thesis, TU Kaiserslautern, 2010 ?30 structures in Singular with applications, Ph.D. thesis, TU Kaiserslautern, 2010 TODO!? 25 31 "; 26 27 32 28 33 ////////////////////////////////////////////////////////////////////////////////////////////////////////// … … 77 82 " 78 83 { 79 if( size(N) == 0 ) { return (); }84 // if( size(N) == 0 ) { return (); } 80 85 81 86 if( typeof( N ) == "list" ) … … 107 112 D[1, c+d] = c; // top row indeces 108 113 v = L[c]; 109 D[nr+2*d, c+d] = deg(v) + gr[ leadexp(v)[m] ]; // bottom row with computed column induced degrees 114 if( v != 0 ) 115 { 116 D[nr+2*d, c+d] = deg(v) + gr[ leadexp(v)[m] ]; // bottom row with computed column induced degrees 117 } else 118 { 119 D[nr+2*d, c+d] = 0; // TODO: 0/1 is valid :( 120 } 110 121 } 111 122 … … 115 126 for( c = nc; c > 0; c ) 116 127 { 117 D[r+d, c+d] = deg(M[r, c]); // central block with degrees 118 // if( D[r+d, c+d] < 0 ) { D[r+d, c+d] = 0; } 128 D[r+d, c+d] = deg(M[r, c]); // central block with degrees (1 means zero entry) 119 129 } 120 130 D[r+d, nc+2*d] = r; // rightmost block with indeces … … 217 227 def w = attrib(M, "isHomog"); // grading weights? 218 228 ASSUME(0, /* input must be correctly graded! */ nrows(M) == size(w) ); 219 229 230 if( size(M) == 0 ) { return (w); } // TODO??? 231 220 232 int m = ncols(M); // m > 0 in Singular! 221 int n = nvars(basering) + 1; // index of mod. column in the leadexp 233 int n = nvars(basering) + 1; // index of mod. column in the leadexp 222 234 223 235 module L = lead(M[1..m]); // leading moduleterms for input column vectors … … 584 596 } 585 597 598 ///////////////////////////////////////////////////////// 599 600 // ???? 601 proc grzero() 602 "presentation of S(0)^1 603 TODO: can we return this as an undefined value????? 604 " 605 { 606 module Z = 0; 607 attrib(Z,"isHomog",intvec(0)); 608 return (Z); 609 } 610 611 proc grpower(def A, int p) 612 " 613 compute A \oplus ... \opuls A (ptimes) 614 " 615 { 616 if(p==0){ return ( grzero() ); } // just ERROR ??? 617 618 ASSUME(0, p > 0); 619 620 if(p==1){ return(A); } 621 622 def N = grsum(A,A); 623 624 if(p==2){ return(N); } 625 626 // TODO: replace recursion with a loop! 627 // see http://en.wikipedia.org/wiki/Exponentiation_by_squaring 628 if((p%2)==0) 629 { return ( grpower(N, p div 2) ); } 630 else 631 { return ( grsum( A, grpower(N, (p1) div 2) )); } 632 } 633 634 635 proc grsum(def A,def B) 636 " 637 direct sum of graded modules 638 " 639 { 640 intvec a = attrib(A, "isHomog"); 641 intvec b = attrib(B, "isHomog"); 642 intvec c = a,b; 643 int r = nrows(A); 644 645 ASSUME( 0, r == size(a) ); 646 647 module T; T[r] = 0; T = T, module(transpose(B)); 648 module AB = module(A), transpose(T); 649 650 attrib(AB, "isHomog", c); 651 return(AB); 652 } 653 example 654 { "EXAMPLE:"; echo = 2; int assumeLevel = 5; 655 656 ring r=32003,(x,y,z),dp; 657 658 grview(grpower( grshift(grzero(), 10), 5 ) ); 659 660 module A = [x+y, x, 0 ], [0, x+y, y]; 661 attrib(A,"isHomog", intvec(1,1,1)); 662 grview(A); 663 664 matrix B[2][2] = z,0, 0,z; 665 attrib(B,"isHomog", intvec(2,3)); 666 grview(B); 667 668 def C = grsum(A,B); 669 670 print(C); 671 homog(C); 672 grview(C); 673 674 def D = grsum(grpower(A, 2), grpower(B, 2)); 675 676 print(D); 677 homog(D); 678 grview(D); 679 680 def D10 = grshift(D, 10); 681 682 print(D10); 683 homog(D10); 684 grview(D10); 685 686 ""; def T = grtwist(5, 10); 687 688 print(T); 689 homog(T); 690 grview(T); 691 692 ""; def TT = grsum(grtwist(3, 0), grtwist(5,1)); 693 694 print(TT); 695 homog(TT); 696 grview(TT); 697 } 698 699 proc grshift( def M, int d) 700 " 701 shift graded module M by delta so that 1 is in M_d 702 " 703 { 704 intvec a = attrib(M, "isHomog"); 705 attrib(M, "isHomog", intvec( a + intvec(d:size(a))) ); 706 return (M); 707 } 708 709 proc grisequal (def A, def B) 710 "TODO" 711 { 712 return (1==1); // TODO! 713 } 714 715 proc grtwist(int a, int d) 716 " 717 matrix presentation for twisted polynomial ring S(d)^a 718 " 719 { 720 matrix zero[a][a]; // TODO ??? 721 module Z = zero; 722 attrib(Z, "isHomog", intvec(d:a)); 723 724 ASSUME(2, grisequal(Z, grpower( grshift(grzero(), d), a ) )); // optional check 725 return(Z); 726 }
Note: See TracChangeset
for help on using the changeset viewer.