- Timestamp:
- May 6, 2015, 10:00:06 PM (9 years ago)
- Branches:
- (u'spielwiese', '2a584933abf2a2d3082034c7586d38bb6de1a30a')
- Children:
- 52b3cf72ab7fa42d230232612144a2dd8a99aff0a817084b5284694230319ae82cddc45954052311
- Parents:
- b474f1f0a8fd7631ec5bebf5b5158c575cb79c09
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/LIB/gradedModules.lib
rb474f1 r237a06 82 82 int n = size(v); 83 83 84 if (n == 0) { return ( R); }84 if (n == 0) { return ("0"); } 85 85 86 86 ASSUME(0, n > 0 ); … … 180 180 if( typeof( N ) == "list" ) 181 181 { 182 msg = msg + " resolution"; 182 msg = msg + " resolution"; // TODO: what about chain maps? 183 183 if( size(R) >= 2 ) 184 184 { … … 212 212 // typeof( N ) ; attrib( N ); grrange(N); 213 213 214 ASSUME(1, grtest(N) ); 215 216 intvec G = grdeg(N); 217 matrix M = module(N); 218 219 int nc = ncols(M); int nr = nrows(M); 220 int r,c; 221 int d = 1; // number of extra cols/rows for extra info around the central degree(N) block in D 222 intmat D[nr+2*d][nc+2*d]; 223 224 for( c = nc; c > 0; c-- ) 225 { 226 D[1, c+d] = c; // top row indeces 227 D[nr+2*d, c+d] = G[c]; // deg(v) + gr[ leadexp(v)[m] ]; // bottom row with computed column induced degrees 228 } 229 230 intvec gr = grrange(N); // grading weights? 231 232 for( r = nr; r > 0; r-- ) 233 { 234 D[r+d, 1] = gr[r]; // left-most column with grading data 235 for( c = nc; c > 0; c-- ) 236 { 237 D[r+d, c+d] = deg(M[r, c]); // central block with degrees (-1 means zero entry) 238 } 239 D[r+d, nc+2*d] = r; // right-most block with indeces 240 } 241 214 ASSUME(1, grtest(N) ); 215 242 216 msg = msg + " homomorphism"; 243 217 if( size(R) >= 2 ) … … 246 220 R = "R"; 247 221 } 248 222 249 223 msg = msg + ": "; 250 224 225 intvec gr = grrange(N); // grading weights? 251 226 string dst = grsumstr(R, gr); 227 228 intvec G = grdeg(N); 252 229 string src = grsumstr(R, G); 230 231 if( ncols(N) == 0 ) 232 { 233 src = "0"; 234 } 253 235 254 236 lst = msg; … … 274 256 msg = msg + ", given by "; 275 257 // lst = lst + ", given by "; 258 259 260 int nc = ncols(N); int nr = nrows(N); 276 261 277 262 if( size(N) == 0 ) … … 282 267 } else 283 268 { 269 ASSUME(0, nc > 0); 270 271 matrix M = module(N); 272 273 int r,c; 274 int d = 1; // number of extra cols/rows for extra info around the central degree(N) block in D 275 intmat D[nr+2*d][nc+2*d]; 276 277 for( c = nc; c > 0; c-- ) 278 { 279 D[1, c+d] = c; // top row indeces 280 D[nr+2*d, c+d] = G[c]; // deg(v) + gr[ leadexp(v)[m] ]; // bottom row with computed column induced degrees 281 } 282 283 for( r = nr; r > 0; r-- ) 284 { 285 D[r+d, 1] = gr[r]; // left-most column with grading data 286 for( c = nc; c > 0; c-- ) 287 { 288 D[r+d, c+d] = deg(M[r, c]); // central block with degrees (-1 means zero entry) 289 } 290 D[r+d, nc+2*d] = r; // right-most block with indeces 291 } 292 284 293 if( nr == nc) // square matrix // detect diagonal? 285 294 { … … 301 310 msg = msg + "a matrix"; 302 311 } 303 304 print(msg + ", with degrees: " ); 312 313 print(msg + ", with degrees: " ); 305 314 draw(D, d); // print it nicely! 306 315 } … … 408 417 " 409 418 { 410 ASSUME(1, grtest(M) ); 411 419 ASSUME(1, grtest(M) ); 420 412 421 if ( typeof(attrib(M, "degHomog")) == "intvec" ) 413 422 { 414 intvec t = attrib(M, "degHomog"); // graded degrees 423 def t = attrib(M, "degHomog"); // graded degrees 424 425 if( ncols(M) == 0 ) { return (t); } // for now 426 415 427 ASSUME(0, ncols(M) == size(t) ); 416 417 428 return (t); 418 429 } 430 431 ASSUME(0, ncols(M) > 0); 419 432 420 433 ASSUME(0, ncols(M) == size(M) ); … … 956 969 " 957 970 { 971 if( ncols(A) == 0 ) 972 { 973 ASSUME(0, size(w) == nrows(A) ); 974 attrib(A, "isHomog", w); 975 attrib(A, "degHomog", intvec(0)); // FIXME: just for now: no intvec of 0-size :( 976 ASSUME(0, grtest(A) ); 977 return (A); 978 } 979 958 980 module M = module(A); 959 981 ASSUME(0, size(w) >= nrows(M) ); … … 982 1004 ring r=32003,(x,y,z),dp; 983 1005 984 moduleA = grobj( module([x+y, x, 0, 0], [0, x+y, y, 0]), intvec(0,0,0,1) );1006 def A = grobj( module([x+y, x, 0, 0], [0, x+y, y, 0]), intvec(0,0,0,1) ); 985 1007 grview(A); 986 1008 987 moduleF = grobj( module([x,y,0]), intvec(1,1,5) );1009 def F = grobj( module([x,y,0]), intvec(1,1,5) ); 988 1010 grview(F); 989 1011 990 1012 int d = 666; // zero can have any degree... 991 moduleZ = grobj( module([x,0], [0,0,0], [0, y]), intvec(1,2,3), intvec(2, d, 3) );1013 def Z = grobj( module([x,0], [0,0,0], [0, y]), intvec(1,2,3), intvec(2, d, 3) ); 992 1014 grview(Z); 993 1015 … … 996 1018 grrange(Z); // module weights 997 1019 attrib(Z, "degHomog"); // total degrees 1020 1021 // Zero object: 1022 matrix z[3][0]; 1023 def zz = grobj( z, intvec(1,2,3) ); // intvec() ?? 1024 grview(zz); 998 1025 999 1026 } … … 1017 1044 }; 1018 1045 1019 if ( typeof( grrange(N)) != "intvec" )1046 if ( typeof(attrib(N,"isHomog")) != "intvec" ) 1020 1047 { 1021 1048 if(b) { type(N); attrib(N); " ? grtest: Input must be graded!"; }; … … 1030 1057 }; 1031 1058 1059 if( ncols(N) == 0 ) // zero-column matrix? 1060 { 1061 return(1); 1062 } 1063 1032 1064 // if( attrib(N, "rank") != size(gr) ){ return (0); } // wrong rank :( 1033 1065 … … 1102 1134 " 1103 1135 { 1136 ASSUME(0, d >= 0 ); 1137 1138 if( d == 0 ) { return (A); } 1139 1140 if( ncols(A) == 0 ) 1141 { 1142 matrix B[nrows(A) + d][0]; 1143 return (B); 1144 } 1145 1146 1104 1147 module T; T[d] = 0; 1105 1148 T = T, module(transpose(A)); 1106 1149 return( module(transpose(T)) ); 1107 1150 } 1151 example 1152 { "EXAMPLE:"; echo = 2; 1153 ring r; 1154 matrix m[1][0]; 1155 align(m, 3); 1156 } 1157 1108 1158 1109 1159 proc grgroebner(A)
Note: See TracChangeset
for help on using the changeset viewer.