Changeset 9cf556a in git
- Timestamp:
- Feb 23, 2015, 7:41:45 PM (9 years ago)
- Branches:
- (u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
- Children:
- d41983a767c9bf708fbafc7dab33313946211698
- Parents:
- 8be7a45ea5f7a9d57fce858bc39c53bb88fbe2bf
- git-author:
- Oleksandr Motsak <motsak@mathematik.uni-kl.de>2015-02-23 19:41:45+01:00
- git-committer:
- Oleksandr Motsak <motsak@mathematik.uni-kl.de>2015-02-23 19:55:29+01:00
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/LIB/gradedModules.lib
r8be7a45 r9cf556a 1 1 /////////////////////////////////////////////////////////////////////////// 2 2 version="version gradedModules.lib 4.0.1.1 Jan_2015 "; // $Id$ 3 category=" General purpose?";3 category="Commutative Algebra"; 4 4 info=" 5 5 LIBRARY: gradedModules.lib Operations with graded modules/matrices/resolutions 6 6 AUTHORS: Oleksandr Motsak <U@D>, where U=motsak, D=mathematik.uni-kl.de 7 @* 7 @* Hanieh Keneshlou <hkeneshlou@yahoo.com> 8 8 KEYWORDS: graded modules, graded homomorphisms, syzygies 9 9 OVERVIEW: 10 The library contains several procedures for operations with graded modules/matrices/resolutions 11 TODO! 10 The library contains several procedures for constructing and manipulating graded modules/matrices/resolutions. 11 NOTE: 12 set assumeLevel to positive integer value in order to auto-check all assumptions. 12 13 REFERENCES: 13 14 [MO] Motsak, O.: Non-commutative Computer Algebra with applications: Graded commutative algebra and related 14 structures in Singular with applications, Ph.D. thesis, TU Kaiserslautern, 2010 TODO!?15 structures in Singular with applications, Ph.D. thesis, TU Kaiserslautern, 2010 15 16 PROCEDURES: 16 17 grzero() presentation of basering(0)^1 … … 36 37 static proc pad(int m, string s, string c){ string r = s; while( size(r) < m ){ r = c + r; } return(r); } 37 38 static proc mstring( int m, string c){ if( m < 0 ) { return (c); }; return (string(m)); } 38 static proc zstring( int m, int b, string c){ if(b) { return (c); }; return (string(m)); }39 39 // view helper 40 static proc draw ( intmat D, int vec zc, intd )40 static proc draw ( intmat D, int d ) 41 41 { 42 42 // print(D); return (); … … 50 50 { 51 51 head = head + pad(max, string(D[1 , c]), " ") + " "; 52 foot = foot + pad(max, zstring(D[nr, c], zc[c - d], "?"), " ") + " ";52 foot = foot + pad(max, string(D[nr, c]), " ") + " "; 53 53 } 54 54 // last head/foot enties: 55 55 head = head + pad(max, string(D[1 , c]), " "); 56 foot = foot + pad(max, zstring(D[nr, c], zc[c-d], "?"), " ");56 foot = foot + pad(max, string(D[nr, c]), " "); 57 57 // head/foot dash lines: 58 58 string dash = repeat( (max + 1) * (nc - 2*d) , "-"); … … 74 74 } 75 75 76 proc grview(def N) 77 " 78 PURPOSE: print the degree/grading data about the GRADED matrix/module/ideal N 76 proc grview(N) 77 "USAGE: grview(M), graded object M 78 RETURN: nothing 79 PURPOSE: print the degree/grading data about the GRADED matrix/module/ideal/mapping object M 80 ASSUME: M must be graded 81 EXAMPLE: example grsum; shows an example 79 82 " 80 83 { … … 89 92 // typeof( N ) ; attrib( N ); attrib(N, "isHomog"); 90 93 91 ASSUME(0, /* input must be graded! */ typeof(attrib(N, "isHomog")) == "intvec" );92 93 94 // input should be graded: 94 intvec gr = attrib(N, "isHomog"); // grading weights? 95 ASSUME(0, /* input must be correctly graded! */ nrows(N) == size(gr) ); 96 97 // intvec gr = attrib( N, "isHomog" ); // module(N); "grading: ", gr; 98 95 ASSUME(1, grtest(N) ); 96 97 intvec G = grdeg(N); 99 98 matrix M = module(N); 99 100 100 int nc = ncols(M); int nr = nrows(M); 101 101 int r,c; … … 103 103 intmat D[nr+2*d][nc+2*d]; 104 104 105 module L = module(N); L = lead(L); vector v;106 int m = 1 + nvars(basering);107 intvec zc = 0:nc;108 105 for( c = nc; c > 0; c-- ) 109 106 { 110 107 D[1, c+d] = c; // top row indeces 111 v = L[c]; 112 if( v != 0 ) 113 { 114 D[nr+2*d, c+d] = deg(v) + gr[ leadexp(v)[m] ]; // bottom row with computed column induced degrees 115 } else 116 { 117 // D[nr+2*d, c+d] = 0; // TODO: 0/-1 is valid :( 118 zc[c] = 1; 119 } 120 } 108 D[nr+2*d, c+d] = G[c]; // deg(v) + gr[ leadexp(v)[m] ]; // bottom row with computed column induced degrees 109 } 110 111 intvec gr = attrib(N, "isHomog"); // grading weights? 121 112 122 113 for( r = nr; r > 0; r-- ) … … 129 120 D[r+d, nc+2*d] = r; // right-most block with indeces 130 121 } 131 draw(D, zc,d); // print it nicely!122 draw(D, d); // print it nicely! 132 123 } 133 124 … … 200 191 201 192 // Q@Wolfram: what should be done with zero gens!? 202 proc grdeg( def M, list # ) 203 "graded degrees of gens(i.e. columns)" 204 { 205 // use initial grading if given 206 if( size(#) == 1 ) 207 { 208 def w = #[1]; 209 if( typeof(w) == "intvec" ) 210 { 211 if( nrows(M) == size(w) ) 212 { 213 attrib(M, "isHomog", w); 214 } 215 } 216 kill w; 217 } 218 193 proc grdeg(M) 194 "USAGE: grdeg(M), graded object M 195 RETURN: intvec of degrees 196 PURPOSE: graded degrees of columns (generators) of M 197 ASSUME: M must be a graded object (matrix/module/ideal/mapping) 198 NOTE: if M has zero cols it shoud have attrib(M,'degHomog') set. 199 EXAMPLE: example grsum; shows an example 200 " 201 { 219 202 ASSUME(1, grtest(M) ); 220 203 204 if ( typeof(attrib(M, "degHomog")) == "intvec" ) 205 { 206 intvec t = attrib(M, "degHomog"); // graded degrees 207 ASSUME(0, ncols(M) == size(t) ); 208 209 return (t); 210 } 211 212 ASSUME(0, ncols(M) == size(M) ); 213 221 214 def w = attrib(M, "isHomog"); // grading weights? 222 215 … … 230 223 intvec c = leadexp(L[1..m])[n]; // their module-components 231 224 232 w = intvec(-6665, w); // 0?????233 intvec gr = w[ 1+c]; // weights225 // w = intvec(-6665), w; // 0????? 226 intvec gr = w[c]; // + 1]; // weights????? 234 227 235 228 gr = gr + d; // finally we compute their graded degrees 236 229 237 return (gr); // do we need g or w[c] ?230 return (gr); 238 231 } 239 232 … … 257 250 ASSUME(1, issorted(gr[pivot], s)); 258 251 259 module N = grobj(module(M[pivot]), w ); // reorder the starting ideal/module252 module N = grobj(module(M[pivot]), w, intvec(gr[pivot])); // reorder the starting ideal/module 260 253 261 254 // "reorder: "; grview(N); … … 264 257 } 265 258 259 static proc gtranspose(M) 260 "??????" 261 { 262 ASSUME(1, grtest(M) ); 263 return ( grobj(transpose(M), -grdeg(M), -attrib(M, "isHomog")) ); 264 } 265 266 266 267 proc grtranspose(def M) 267 268 " 268 transpose graded module/map or a chain complex?...269 transpose&reorder graded module/map or a chain complex?... 269 270 " 270 271 { … … 311 312 ASSUME(1, grtest(M) ); 312 313 313 // TODO: something is wrong here:314 315 314 intvec d; module N; 316 315 317 316 (N,d) = reorder(M, -1); 318 317 319 kill M; module M = grobj(transpose(N), -d );318 kill M; module M = grobj(transpose(N), -d, -attrib(N, "isHomog")); 320 319 321 320 // "b"; grview(M); … … 333 332 return (N); 334 333 } 335 336 337 334 338 335 proc grorder(def M) … … 382 379 (N,d) = reorder(M, 1); kill M; 383 380 384 module M = grobj(transpose(N), -d ); kill N,d;381 module M = grobj(transpose(N), -d, -attrib(N, "isHomog")); kill N,d; 385 382 386 383 // "b"; grview(M); … … 390 387 (N,d) = reorder(M, -1); kill M; 391 388 392 module M = grobj(transpose(N), -d );389 module M = grobj(transpose(N), -d, -attrib(N, "isHomog")); 393 390 394 391 // "c"; grview(M); … … 471 468 " 472 469 { 473 return ( grobj(module([0]), intvec(0) ) );470 return ( grobj(module([0]), intvec(0), intvec(0)) ); 474 471 } 475 472 … … 515 512 module S = module(A), T; 516 513 517 return(grobj(S, c)); 514 intvec da = grdeg(A); 515 intvec db = grdeg(B); 516 intvec dc = da, db; 517 518 return(grobj(S, c, dc)); 518 519 } 519 520 example … … 580 581 " 581 582 { 583 ASSUME(1, grtest(M) ); 584 582 585 intvec a = attrib(M, "isHomog"); 583 return (grobj(M, intvec( a - intvec(d:size(a))) )); 584 } 585 586 a = a - intvec(d:size(a)); 587 588 intvec t = attrib(M, "degHomog"); 589 t = t - intvec(d:size(t)); 590 591 return (grobj(M, a, t)); 592 } 593 594 595 proc grisequal (def A, def B) 596 " 597 TODO 598 " 599 { 600 ASSUME(1, grtest(A) ); 601 ASSUME(1, grtest(B) ); 602 603 int ra = nrows(A); 604 int rb = nrows(B); 605 606 intvec wa = attrib(A, "isHomog"); 607 intvec wb = attrib(B, "isHomog"); 608 609 if( (ra != rb) || (ncols(A) != ncols(B)) ){ return (0); } // TODO: ??? 610 611 intvec da = grdeg(A); 612 intvec db = grdeg(B); 613 614 return ( (da == db) && (wa == wb) && 615 (size(module(matrix(A) - matrix(B))) == 0) ); // TODO: ??? 616 } 617 618 proc grtwist(int a, int d) 619 " 620 matrix presentation for twisted polynomial ring S(d)^a 621 " 622 { 623 ASSUME(0, a > 0); 624 625 module Z; Z[a] = [0]; 626 intvec w = -intvec(d:a); 627 Z = grobj(Z, w, w); // will set the rank as well 628 ASSUME(2, grisequal(Z, grpower( grshift(grzero(), d), a ) )); // optional check 629 return(Z); 630 } 631 632 proc grobj(def A, intvec w, list #) 633 " 634 TODO 635 " 636 { 637 module M = module(A); 638 ASSUME(0, size(w) >= nrows(M) ); 639 640 attrib(M, "rank", size(w)); 641 attrib(M, "isHomog", w); 642 643 if( size(#) > 0 ) 644 { 645 ASSUME(0, typeof(#[1]) == "intvec" ); 646 ASSUME(0, size(#[1]) == ncols(M) ); 647 attrib(M, "degHomog", #[1]); 648 } 649 else 650 { 651 ASSUME(0, /* no zero cols please! */ size(M) == ncols(M) ); 652 attrib(M, "degHomog", grdeg(M)); 653 } 654 655 ASSUME(0, grtest(M) ); 656 return (M); 657 } 586 658 587 659 proc grtest(def N) … … 595 667 596 668 intvec gr = attrib(N, "isHomog"); // grading weights... 597 if ( nrows(N) >size(gr) ) { return (0); }; // wrong number of rows?669 if ( nrows(N) != size(gr) ) { return (0); }; // wrong number of rows? 598 670 599 671 // if( attrib(N, "rank") != size(gr) ){ return (0); } // wrong rank :( 600 672 601 673 if ( typeof(attrib(N, "degHomog")) == "intvec" ) 674 { 675 intvec T = attrib(N, "degHomog"); // graded degrees 676 if ( ncols(N) != size(T) ) { return (0); }; // wrong number of cols? 677 678 int k = nvars(basering) + 1; // index of mod. column in the leadexp 679 680 module L = lead(module(N)); vector v; 681 682 // checking T for non-zero N[i] 683 int i = size(T); 684 685 for (; i > 0; i-- ) 686 { 687 v = L[i]; 688 if( v != 0 ) 689 { 690 if( (deg(v) + gr[ leadexp(v)[k] ]) != T[i] ) { return (0); }; // wrong T[i] 691 } 692 } 693 694 // TODO: check t on nonzero cols... 695 } else 696 { 697 if( ncols(N) != size(N) ) { return (0); }; 698 } 699 602 700 // if( !homog(N) ) { return (0); }; // N should be homogenous 603 701 604 605 702 return (1); 606 703 } 607 608 proc grisequal (def A, def B) 609 "TODO" 610 { 611 ASSUME(1, grtest(A) ); 612 ASSUME(1, grtest(B) ); 613 614 int ra = nrows(A); 615 int rb = nrows(B); 616 617 intvec wa = attrib(A, "isHomog"); 618 intvec wb = attrib(B, "isHomog"); 619 620 if( (ra != rb) || (ncols(A) != ncols(B)) ){ return (0); } // TODO: ??? 621 return ( (wa == wb) && 622 (size(module(matrix(A) - matrix(B))) == 0) ); // TODO: ??? 623 } 624 625 proc grtwist(int a, int d) 626 " 627 matrix presentation for twisted polynomial ring S(d)^a 628 " 629 { 630 module Z; Z[a] = [0]; 631 Z = grobj(Z, -intvec(d:a)); // will set the rank as well 632 633 ASSUME(2, grisequal(Z, grpower( grshift(grzero(), d), a ) )); // optional check 634 return(Z); 635 } 636 637 proc grobj(def A, intvec w) 638 "" 639 { 640 module M = module(A); 641 ASSUME(0, size(w) >= nrows(M) ); 642 attrib(M, "rank", size(w)); 643 attrib(M, "isHomog", w); 644 ASSUME(1, grtest(M) ); 645 return (M); 646 } 647 704 648 705 649 706 static proc align( def A, int d)
Note: See TracChangeset
for help on using the changeset viewer.