Changeset e9478b in git
- Timestamp:
- Jul 9, 2015, 12:28:29 PM (8 years ago)
- Branches:
- (u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
- Children:
- 38301d00726a0671f6dbc3f82923b5c9f6964c5d8af20e00f50d423ec4162319c3d9f63fdc7e796f
- Parents:
- ba52f58eed2a6367c0d09410b064a3fdc2c7170f
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/LIB/gradedModules.lib
rba52f58 re9478b 31 31 grsum(M,N) direct sum of two graded modules coker(M) + coker(N) 32 32 grpower(M,p) direct p-th power of graded module coker(M) 33 grtranspose(M) un-ordered graded transpose of map M 33 grtranspose(M) un-ordered graded transpose of map M 34 34 grgens(M) try to compute submodule generators of coker(M) 35 35 grpres(F) presentation of submodule generated by columns of F … … 51 51 mappingcone(M,N) mapping cone? 52 52 grlifting3(A,B) RND! chain lifting? probably wrong one 53 mappingcone3(A,B) mapping cone3? 53 mappingcone3(A,B) mapping cone3? 54 54 grrange(M) get the row-weightings 55 55 grneg(A) graded object given by -A 56 56 matrixpres(a) matrix presentation of direct sum of Omega^{a[i]}(i) 57 57 "; 58 58 59 59 // grisequal(A,B) check whether A is exactly eqal to B? TODO: isomorphic! 60 60 … … 86 86 87 87 v = -v; // NOTE: due to Mathematical meanings of Singular data 88 88 89 89 90 90 int lst = v[1]; 91 int cnt = 1; 91 int cnt = 1; 92 92 93 93 string p = R; … … 95 95 96 96 int k, d; 97 for (k = 2; k <= n; k++ ) 97 for (k = 2; k <= n; k++ ) 98 98 { 99 99 d = v[k]; 100 100 if( d == lst ) { cnt = cnt + 1; } 101 else 101 else 102 102 { 103 103 if (cnt > 1){ p = p + "^" + string(cnt); } … … 120 120 def E = grtwist(2, 0); 121 121 def v = grrange(E); // grdeg(E); 122 grsumstr("", v ); 122 grsumstr("", v ); 123 123 } 124 124 … … 180 180 { 181 181 int n = size(N); ASSUME(0, n > 0); 182 182 183 183 string msg1 = ""; 184 184 if( size(R) >= 2 ) … … 186 186 msg1 = msg1 + "(let R:="+R+")"; 187 187 R = "R"; // !!! 188 } 188 } 189 189 msg1 = msg1 + ": " ; 190 190 191 191 192 192 193 193 list arr; arr[n] = list(); 194 194 int exact = (1==1); 195 195 196 196 int i = 1; 197 197 198 198 ASSUME(1, grtest(N[i])); 199 199 200 200 string dst = grsumstr(R, grrange(N[i])); 201 201 string src = grsumstr(R, grdeg(N[i])); 202 202 203 203 arr[i] = list(dst, src); 204 204 205 205 i = i + 1; 206 206 207 207 while( i <= n ) 208 208 { 209 209 ASSUME(1, grtest(N[i])); 210 210 211 211 dst = grsumstr(R, grrange(N[i])); 212 212 213 213 if( exact && (src != dst) ) 214 214 { … … 218 218 219 219 src = grsumstr(R, grdeg(N[i])); 220 220 221 221 arr[i] = list(dst, src); 222 222 … … 236 236 msg = msg + newline + arr[i][1] + " <-- "+o+"_" + string(i) + " --"; 237 237 }; 238 238 239 239 msg = msg + newline + arr[n][2]; 240 msg = msg + ", given by maps: "; 240 msg = msg + ", given by maps: "; 241 241 } else 242 242 { 243 243 // print(arr); 244 244 245 msg = msg + "-object collection"; 245 msg = msg + "-object collection"; 246 246 o = "o"; 247 247 248 248 // for( i = 1; i <= n; i++ ) 249 249 // { 250 250 // msg = msg + newline + arr[i][1] + " <-- "+o+"_" + string(i) + " -- " + arr[i][2]; 251 // }; 252 msg = msg + ", given by the following maps (named here as "+o+"_[1 .. "+string(n)+"]): "; 251 // }; 252 msg = msg + ", given by the following maps (named here as "+o+"_[1 .. "+string(n)+"]): "; 253 253 } 254 254 … … 257 257 258 258 for( i = 1; i <= size(N); i++ ) 259 { 259 { 260 260 print( o+"_" + string(i) + " :" ); 261 grview( N[i] ); 261 grview( N[i] ); 262 262 }; 263 263 … … 268 268 269 269 ASSUME(1, grtest(N) ); 270 270 271 271 msg = msg + " homomorphism"; 272 272 if( size(R) >= 2 ) … … 280 280 intvec gr = grrange(N); // grading weights? 281 281 string dst = grsumstr(R, gr); 282 282 283 283 intvec G = grdeg(N); 284 284 string src = grsumstr(R, G); 285 285 286 286 if( ncols(N) == 0 ) 287 287 { 288 288 src = "0"; 289 } 289 } 290 290 291 291 lst = msg; 292 292 293 if( (size(lst) + size(dst) + size(src) + 4) > 80 ) 294 { 293 if( (size(lst) + size(dst) + size(src) + 4) > 80 ) 294 { 295 295 if( (size(lst) + size(dst)) > 80 ) { msg = msg + newline; lst = ""; } 296 296 … … 312 312 // lst = lst + ", given by "; 313 313 314 314 315 315 int nc = ncols(N); int nr = nrows(N); 316 316 … … 323 323 { 324 324 ASSUME(0, nc > 0); 325 325 326 326 matrix M = module(N); 327 327 328 328 int r,c; 329 329 int d = 1; // number of extra cols/rows for extra info around the central degree(N) block in D … … 361 361 } 362 362 363 } else 364 { 363 } else 364 { 365 365 msg = msg + "a matrix"; 366 366 } 367 367 368 print(msg + ", with degrees: " ); 369 draw(D, d); // print it nicely! 368 print(msg + ", with degrees: " ); 369 draw(D, d); // print it nicely! 370 370 } 371 371 } … … 462 462 " 463 463 { 464 ASSUME(1, grtest(M) ); 465 464 ASSUME(1, grtest(M) ); 465 466 466 if ( typeof(attrib(M, "degHomog")) == "intvec" ) 467 467 { … … 469 469 470 470 if( size(t) == 0 ){ return (t); } // ZERO! 471 471 472 472 ASSUME(2, ncols(M) == size(t) ); 473 473 return (t); … … 629 629 "Input degrees: "; grview(I); 630 630 631 def RR = grres(I, 0, 1); list L = RR; 631 def RR = grres(I, 0, 1); list L = RR; 632 632 633 633 " = Non-minimal betti numbers: "; print(betti(L, 0), "betti"); … … 830 830 831 831 ring r=32003,(x,y,z),dp; 832 832 833 833 grview( grtwists ( intvec(-4, 1, 6 )) ); 834 834 … … 843 843 " 844 844 { 845 ASSUME(0, a > 0); 845 ASSUME(0, a > 0); 846 846 def Z = grtwists( intvec(d:a) ); // will set the rank as well 847 847 // ASSUME(2, grisequal(Z, grpower( grshift(grzero(), d), a ) )); // optional check … … 931 931 932 932 def SS = grobj(S, c, dc); 933 933 934 934 ASSUME(0, size( grrange(SS) ) == (size(a) + size(b)) ); 935 935 ASSUME(0, size( grdeg(SS) ) == (size(da) + size(db)) ); 936 936 ASSUME(0, ncols( SS ) == size( grdeg(SS) ) ); 937 937 ASSUME(0, nrows( SS ) == size( grrange(SS) ) ); 938 938 939 939 return(SS); 940 940 } … … 984 984 { 985 985 ASSUME(1, grtest(M) ); 986 987 986 987 988 988 989 989 intvec a = grrange(M); … … 993 993 { 994 994 "!! Warning: shifting '0 <- 0' leaves it as it unchanged!"; 995 return (M); 996 } 997 995 return (M); 996 } 997 998 998 a = a - intvec(d:size(a)); 999 999 t = t - intvec(d:size(t)); … … 1056 1056 { 1057 1057 ASSUME(0, size(w) >= nrows(A) ); 1058 1058 1059 1059 module M = module(A); 1060 1060 … … 1063 1063 1064 1064 intvec @ww = 0:0; 1065 1065 1066 1066 if( size(#) > 0 ) 1067 1067 { 1068 1068 ASSUME(0, typeof(#[1]) == "intvec" ); 1069 1069 1070 1070 @ww = intvec( #[1] ); 1071 1071 … … 1077 1077 } 1078 1078 } 1079 1079 1080 1080 ASSUME(0, size(@ww) == ncols(M) ); 1081 1081 } … … 1091 1091 M = freemodule(0); 1092 1092 } 1093 1093 1094 1094 attrib( M, "rank", size(w) ); 1095 1095 attrib( M, "isHomog", w ); 1096 1096 1097 1097 // ASSUME(0, /* PROBLEM WITH ZERO COLUMNS / THEIR DEGREES! */ (ncols(M) == 0) ); 1098 1098 } 1099 1099 } 1100 1100 1101 1101 // type(@ww); type(M); 1102 1102 1103 1103 ASSUME(0, size(@ww) == ncols(M) ); // ?! 1104 1104 1105 1105 attrib(M, "degHomog", @ww); 1106 1106 … … 1132 1132 grview( grobj( freemodule(0), intvec(1,2,3) ) ); 1133 1133 1134 matrix z1[0][3]; grview( grobj( z1, 0:0, intvec(1,2,3) ) ); 1134 matrix z1[0][3]; grview( grobj( z1, 0:0, intvec(1,2,3) ) ); 1135 1135 grview( grobj( freemodule(0), 0:0, intvec(1,2,3) ) ); 1136 1136 1137 1137 matrix z0[0][0]; grview( grobj( z0, 0:0 ) ); 1138 1138 grview( grobj( freemodule(0), 0:0 ) ); 1139 1140 1139 1140 1141 1141 1142 1142 } … … 1145 1145 "USAGE: grtest(M[,b]), anyting M, optionally int b 1146 1146 RETURN: 1 if M is a valid graded object, 0 otherwise 1147 PURPOSE: validate a graded object. Print an invalid object message if b is not given 1147 PURPOSE: validate a graded object. Print an invalid object message if b is not given 1148 1148 NOTE: M should be an ideal or module or matrix, with weighting attribute 1149 1149 'isHomog' and optionally total graded degrees attribute 'degHomog'. … … 1169 1169 if ( nrows(N) != size(gr) ) 1170 1170 { 1171 if(b) { " ? grtest: Input has wrong number of rows!"; }; 1171 if(b) { " ? grtest: Input has wrong number of rows!"; }; 1172 1172 return (0); 1173 1173 }; … … 1177 1177 return(1); 1178 1178 } 1179 1179 1180 1180 // if( attrib(N, "rank") != size(gr) ){ return (0); } // wrong rank :( 1181 1181 … … 1189 1189 return (1); 1190 1190 } 1191 1191 1192 1192 if ( ncols(N) != size(T) ) 1193 1193 { 1194 if(b) { " ? grtest: Input has wrong number of cols!"; }; 1194 if(b) { " ? grtest: Input has wrong number of cols!"; }; 1195 1195 return (0); 1196 1196 }; 1197 1197 1198 1198 int k = nvars(basering) + 1; // index of mod. column in the leadexp 1199 1199 … … 1259 1259 { 1260 1260 ASSUME(0, d >= 0 ); 1261 1261 1262 1262 if( d == 0 ) { return (A); } 1263 1263 1264 1264 if( ncols(A) == 0 ) 1265 1265 { 1266 1266 matrix B[nrows(A) + d][0]; 1267 return (B); 1268 } 1269 1267 return (B); 1268 } 1269 1270 1270 module T; T[d] = 0; 1271 1271 T = T, module(transpose(A)); … … 1281 1281 matrix m[0][2]; 1282 1282 type( align(m, 3) ); 1283 } 1283 } 1284 1284 1285 1285 … … 1302 1302 module A = grobj( module([x+y, x, 0, 0], [0, x+y, y, 0]), intvec(0,0,0,1) ); 1303 1303 grview(A); 1304 1304 1305 1305 module B = grgroebner(A); 1306 1306 grview(B); … … 1324 1324 ring r=32003,(x,y,z),dp; 1325 1325 1326 module A = grgroebner( grobj( module([x+y, x, 0, 3], [0, x+y, y, 2], [y, y, z, 1]), intvec(0,0,0,1) ) ); 1326 module A = grgroebner( grobj( module([x+y, x, 0, 3], [0, x+y, y, 2], [y, y, z, 1]), intvec(0,0,0,1) ) ); 1327 1327 grview(A); 1328 1328 1329 1329 grview(grsyz(A)); 1330 1331 module X = grgroebner( grobj( module([x]), intvec(2) ) ); 1330 1331 module X = grgroebner( grobj( module([x]), intvec(2) ) ); 1332 1332 grview(X); 1333 1333 1334 1334 // syzygy module should be zero! 1335 1335 grview(grsyz(X)); 1336 1337 1336 1337 1338 1338 } 1339 1339 … … 1351 1351 intvec a = grdeg(A); 1352 1352 intvec b = grrange(B); 1353 1353 1354 1354 ASSUME(0, (size(a) == size(b)) && (a == b)); // == for intvec :( 1355 1355 … … 1361 1361 ring r=32003,(x,y,z),dp; 1362 1362 1363 module A = grobj( module([x+y, x, 0, 3], [0, x+y, y, 2], [y, y, z, 1]), intvec(0,0,0,1) ); 1363 module A = grobj( module([x+y, x, 0, 3], [0, x+y, y, 2], [y, y, z, 1]), intvec(0,0,0,1) ); 1364 1364 grview(A); 1365 1365 1366 1366 A = grgroebner(A); 1367 1367 grview(A); 1368 1368 1369 1369 module B = grsyz(A); 1370 1370 grview(B); 1371 1371 print(B); 1372 1372 1373 1373 module D = grprod( A, B ); 1374 1374 grview(D); … … 1384 1384 "USAGE: grres(M, l[, b]), graded object M, int l, int b 1385 1385 RETURN: graded resolution = list of graded objects 1386 PURPOSE: compute graded resolution of M (of length l) and minimise it if b was given 1386 PURPOSE: compute graded resolution of M (of length l) and minimise it if b was given 1387 1387 EXAMPLE: example grres; shows an example 1388 1388 " … … 1392 1392 1393 1393 intvec v = grrange(A); 1394 1394 1395 1395 int b = (size(#) > 0); 1396 1396 if(b) { list r = res(A, l, #[1]); } else { list r = res(A, l); } 1397 1397 1398 1398 l = size(r); 1399 1399 1400 1400 int i; 1401 1401 1402 1402 for ( i = 1; i <= l; i++ ) 1403 1403 { … … 1411 1411 r[i] = grobj(r[i], v); v = grdeg(r[i]); 1412 1412 } 1413 1413 1414 1414 i = i-1; 1415 1415 … … 1421 1421 ring r=32003,(x,y,z),dp; 1422 1422 1423 module A = grobj( module([x+y, x, 0, 3], [0, x+y, y, 2], [y, y, z, 1]), intvec(0,0,0,1) ); 1423 module A = grobj( module([x+y, x, 0, 3], [0, x+y, y, 2], [y, y, z, 1]), intvec(0,0,0,1) ); 1424 1424 grview(A); 1425 1425 1426 1426 module B = grgroebner(A); 1427 1427 grview(B); … … 1438 1438 RETURN: graded object 1439 1439 PURPOSE: graded transpose of M 1440 NOTE: no reordering is performend by this procedure 1440 NOTE: no reordering is performend by this procedure 1441 1441 EXAMPLE: example grtranspose; shows an example 1442 1442 " … … 1457 1457 1458 1458 module K = grsyz( L ); grview(K); 1459 1459 1460 1460 1461 1461 // Corner cases: 0 <- 0! … … 1463 1463 grview( grtranspose( Z ) ); 1464 1464 1465 1465 1466 1466 // Corner cases: * <- 0 1467 1467 matrix M1[3][0]; 1468 1468 1469 1469 module Z1 = grobj( M1, intvec(-1, 0, 1) ); grview(Z1); 1470 1470 grview( grtranspose( Z1 ) ); 1471 1472 1471 1472 1473 1473 // Corner cases: 0 <- * 1474 1474 matrix M2[0][3]; … … 1476 1476 module Z2 = grobj( M2, 0:0, intvec(-1, 0, 1) ); grview(Z2); 1477 1477 grview( grtranspose( Z2 ) ); 1478 1478 1479 1479 } 1480 1480 … … 1482 1482 proc grgens(def M) 1483 1483 "USAGE: grgens(M), graded object M (map) 1484 RETURN: graded object 1484 RETURN: graded object 1485 1485 PURPOSE: try compute graded generators of coker(M) and return them as columns 1486 1486 of a graded map. … … 1492 1492 1493 1493 module N = grtranspose( grsyz( grtranspose(M) ) ); 1494 1494 1495 1495 // ASSUME(3, grisequal( grgroebner(M), grgroebner( grpres( N ) ) ) ); // FIXME: not always true!? 1496 1496 1497 1497 return ( N ); 1498 1498 } … … 1505 1505 1506 1506 module N = grgens(M); 1507 1507 1508 1508 grview( N ); print(N); // fine == M 1509 1509 1510 1510 1511 module A = grobj( module([x+y, x, 0, 3], [0, x+y, y, 2], [y, y, z, 1]), intvec(0,0,0,1) ); 1511 module A = grobj( module([x+y, x, 0, 3], [0, x+y, y, 2], [y, y, z, 1]), intvec(0,0,0,1) ); 1512 1512 1513 1513 A = grgroebner(A); grview(A); … … 1518 1518 1519 1519 grview( grgens( grzero() ) ); 1520 1520 1521 1521 } 1522 1522 … … 1534 1534 1535 1535 // ASSUME(3, grisequal( M, grgens( N ) ) ); 1536 1536 1537 1537 return ( N ); 1538 1538 } … … 1545 1545 grview(A); 1546 1546 1547 "graded transpose: "; def B = grtranspose(A); grview( B ); print(B); 1547 "graded transpose: "; def B = grtranspose(A); grview( B ); print(B); 1548 1548 1549 1549 "... syzygy: "; def C = grsyz(B); grview(C); … … 1553 1553 "... and back to presentation: "; def E = grsyz( D ); grview(E); print(E); 1554 1554 1555 def F = grgens( E ); grview(F); print(F); 1555 def F = grgens( E ); grview(F); print(F); 1556 1556 def G = grpres( F ); grview(G); print(G); 1557 1557 1558 1558 1559 1559 def M = grtwists( intvec(-2, 0, 4, 4) ); grview(M); 1560 1560 1561 1561 def N = grgens(M); grview( N ); print(N); 1562 1563 def L = grpres( N ); grview( L ); print(L); 1562 1563 def L = grpres( N ); grview( L ); print(L); 1564 1564 } 1565 1565 … … 1652 1652 module N; 1653 1653 1654 if(i>n) 1654 if(i>n) 1655 1655 { // no middle part 1656 1656 if(a[1]>0) … … 1659 1659 1660 1660 if(a[n+1]>0) 1661 { N=grsum(N,grtwist(a[n+1],-1));} 1662 } 1661 { N=grsum(N,grtwist(a[n+1],-1));} 1662 } 1663 1663 else 1664 1664 { N=grtwist(a[n+1],-1);} 1665 1666 return (N); // grorder(N)); 1665 1666 return (N); // grorder(N)); 1667 1667 } 1668 else // i <= n: middle part is present, a_i != 0 1668 else // i <= n: middle part is present, a_i != 0 1669 1669 { // a = a1 ... | i:2, a_2 ..... i: n, a_n | .... i: n+1a_(n+1) 1670 1670 j = i - 1; … … 1697 1697 1698 1698 1699 return ((N)); // return (grorder(N)); 1699 return ((N)); // return (grorder(N)); 1700 1700 } 1701 1701 } … … 1704 1704 ring r = 32003,(x(0..4)),dp; 1705 1705 1706 def N1 = KeneshlouMatrixPresentation(intvec(2,0,0,0,0)); 1706 def N1 = KeneshlouMatrixPresentation(intvec(2,0,0,0,0)); 1707 1707 grview(N1); 1708 1708 … … 1738 1738 ASSUME(1, grtest(B)); 1739 1739 ASSUME(0, grrange(A)==grrange(B)); 1740 1740 1741 1741 intvec v = grrange(A); 1742 1742 intvec w=grdeg(A),grdeg(B); … … 1746 1746 { "EXAMPLE:"; echo = 2; 1747 1747 ring r; 1748 1748 1749 1749 module R=grobj(module([x,y,z]),intvec(0:3)); 1750 1750 grview(R); … … 1771 1771 // matrix U; 1772 1772 matrix L =lift(A,B/*,U*/); // module(B*U) = module(matrix(A)*L) 1773 1773 1774 1774 return(grobj(L, grdeg(A), grdeg(B))); 1775 1775 } … … 1782 1782 1783 1783 1784 module D=grobj(module([y,0,z],[x2+y2,z,0]),intvec(0,1,0)); 1784 module D=grobj(module([y,0,z],[x2+y2,z,0]),intvec(0,1,0)); 1785 1785 grview(D); 1786 1786 … … 1788 1788 grview(G); 1789 1789 1790 ASSUME(0, grisequal( grprod(D, G), P) ); 1790 ASSUME(0, grisequal( grprod(D, G), P) ); 1791 1791 } 1792 1792 … … 1807 1807 1808 1808 module Z = grobj(freemodule(0),intvec(0:0),intvec(0:0)); 1809 1809 1810 1810 grrange(Z); 1811 1811 grdeg(Z); 1812 1812 1813 1813 grview(Z); 1814 1814 … … 1838 1838 grtranspose( grprod( N, alpha1 ) ) ) 1839 1839 ) ); // alpha0! 1840 1840 1841 1841 } 1842 1842 example … … 1899 1899 1900 1900 ASSUME(0, t >= 2); 1901 1901 1902 1902 list P; 1903 1903 1904 1904 "t: ", t; 1905 1905 1906 1906 P[1]= grrndmap( rM[1], rN[1] ); // alpha1 1907 1907 1908 if(t==2){return(P[1]);} 1909 1908 if(t==2){return(P[1]);} 1909 1910 1910 for(k=2; k<=t; k++) 1911 1911 { 1912 P[k] = grlift( grprod(P[k-1],rM[k]), rN[k] ); 1913 grview(P[k]); 1914 1915 } 1916 1912 P[k] = grlift( grprod(P[k-1],rM[k]), rN[k] ); 1913 grview(P[k]); 1914 1915 } 1916 1917 1917 return(P); 1918 1918 1919 1919 } 1920 1920 example … … 1923 1923 ring r=32003,(x,y,z),dp; 1924 1924 1925 module P=grobj(module([xy,0,xz]),intvec(0,1,0)); 1925 module P=grobj(module([xy,0,xz]),intvec(0,1,0)); 1926 1926 grview(P); 1927 1927 1928 module D=grobj(module([y,0,z],[x2+y2,z,0]),intvec(0,1,0)); 1928 module D=grobj(module([y,0,z],[x2+y2,z,0]),intvec(0,1,0)); 1929 1929 grview(D); 1930 1930 … … 1937 1937 module D=grobj(module([y,0,z],[x2+y2,z,0], [z3, xy, xy2]),intvec(0,1,0)); 1938 1938 D = grgroebner(D); 1939 grview( grres(D, 0)); 1939 grview( grres(D, 0)); 1940 1940 1941 1941 def G=grlifting(D, D); … … 1951 1951 def M = KeneshlouMatrixPresentation(intvec(0,0,1,0)); 1952 1952 grview( grres(M, 0) ); 1953 1953 1954 1954 // module N = grshift(kos[3], 1); // psi, Syz_2(K(1)) 1955 1955 def N = KeneshlouMatrixPresentation(intvec(0,1,0,0)); … … 1966 1966 proc mappingcone(M,N) 1967 1967 "USAGE: mappingcone(M,N), M,N graded objects 1968 RETURN: chain complex (as a list) 1968 RETURN: chain complex (as a list) 1969 1969 PURPOSE: construct a free resolution of the cokernel of a random map between Img(M), and Img(N). 1970 1970 EXAMPLE: example mappingcone; shows an example … … 2026 2026 2027 2027 // correct 2028 proc grrndmap(def S, def D, list #) 2028 proc grrndmap(def S, def D, list #) 2029 2029 "USAGE: grrndmap(S,D), graded objects S and D 2030 2030 RETURN: graded object … … 2092 2092 // 0<---M<----F0<----F1<----F2<----F3<---- 2093 2093 // |p1 |p2 2094 // 2094 // 2095 2095 // 0<---N<----G0<----G1<----G2<----G3<---- 2096 2096 // B(g1) g2 g3 2097 // 2097 // 2098 2098 proc grlifting2(A,B) 2099 2099 "USAGE: grlifting2(A,B), graded objects A and B (matrices defining maps) 2100 RETURN: map of chain complexes (as a list) 2100 RETURN: map of chain complexes (as a list) 2101 2101 PURPOSE: construct a map of chain complexes between free resolution of 2102 2102 M=coker(A) and N=coker(B). … … 2127 2127 P[1]=grrndmap2(A,B); 2128 2128 2129 // A(or B)=0 2129 // A(or B)=0 2130 2130 if(t==1){return(P[1])}; 2131 2131 2132 2132 for(k=2;k<=t;k++) 2133 2133 { … … 2161 2161 def T=grlifting2(DD,PP); T; 2162 2162 2163 // def Z=grlifting2(P,D); Z; // WRONG!!! 2164 2163 // def Z=grlifting2(P,D); Z; // WRONG!!! 2164 2165 2165 } 2166 2166 … … 2171 2171 proc mappingcone2(A,B) 2172 2172 "USAGE: mappingcone2(A,B), graded objects A and B (matrices defining maps) 2173 RETURN: chain complex (as a list) 2173 RETURN: chain complex (as a list) 2174 2174 PURPOSE: construct the free resolution of a cokernel of a random map between M=coker(A), and N=coker(B) 2175 2175 EXAMPLE: example mappingcone2; … … 2234 2234 */ 2235 2235 2236 proc grlifting3(A,B) 2236 proc grlifting3(A,B) 2237 2237 "TODO: grlifting4 was newer and had more documentation than this proc, but was removed... Please verify and update! 2238 2238 " … … 2247 2247 list rN = grres(B,0,1); 2248 2248 print( betti(rN), "betti"); 2249 2249 2250 2250 int i,j,k; 2251 2251 … … 2260 2260 } 2261 2261 int t=min(i,j); 2262 2262 2263 2263 list P; 2264 2264 2265 2265 "t: ", t; 2266 2266 // grview(rM[t]); grview(rN[t]); 2267 2267 2268 2268 P[t]= grrndmap2(rM[t],rN[t]); 2269 2269 grview(P[t]); … … 2312 2312 //def I=KeneshlouMatrixPresentation(intvec(2,3,0,6,2)); 2313 2313 //def J=KeneshlouMatrixPresentation(intvec(4,0,1,2,1)); 2314 //def N=grlifting3(I,J); grview(N); 2314 //def N=grlifting3(I,J); grview(N); 2315 2315 } 2316 2316 … … 2318 2318 "USAGE: grneg(A), graded object A 2319 2319 RETURN: graded object 2320 PURPOSE: graded map defined by -A 2320 PURPOSE: graded map defined by -A 2321 2321 EXAMPLE: example grneg; shows an example 2322 2322 " … … 2341 2341 proc mappingcone3(A,B) 2342 2342 "USAGE: mappingcone3(A,B), graded objects A and B (matrices defining maps) 2343 RETURN: chain complex (as a list) 2343 RETURN: chain complex (as a list) 2344 2344 PURPOSE: construct a free resolution of the cokernel of a random map between M=coker(A), and N=coker(B) 2345 2345 EXAMPLE: example mappingcone3; shows an example … … 2376 2376 2377 2377 T[i]=grtranspose(D); 2378 2378 2379 2379 kill A, B, C, D, v, w, r, s, zero; 2380 2380 } … … 2394 2394 def F=grlifting3(A,T); grview(F); 2395 2395 2396 // BUG in the proc 2396 // BUG in the proc 2397 2397 def G=mappingcone3(A,T); grview(G); 2398 2398 … … 2403 2403 ideal P=groebner(flatten(U[2])); 2404 2404 resolution L=mres(P,0); 2405 print(betti(L),"betti"); 2405 print(betti(L),"betti"); 2406 2406 */ 2407 2407 … … 2421 2421 def I=KeneshlouMatrixPresentation(intvec(2,3,0,6,2)); 2422 2422 def J=KeneshlouMatrixPresentation(intvec(4,0,1,2,1)); 2423 // def N=grlifting3(I,J); 2423 // def N=grlifting3(I,J); 2424 2424 // 2nd module does not lie in the first: 2425 2425 // def NN=mappingcone3(I,J); // ???????? … … 2458 2458 module N; 2459 2459 2460 if(i>n) 2460 if(i>n) 2461 2461 { // no middle part 2462 2462 if(a[1]>0) … … 2465 2465 2466 2466 if(a[n+1]>0) 2467 { N=grsum(N,grtwist(a[n+1],0));} 2468 } 2467 { N=grsum(N,grtwist(a[n+1],0));} 2468 } 2469 2469 else 2470 2470 { N=grtwist(a[n+1],0);} 2471 2472 return (N); // grorder(N)); 2471 2472 return (N); // grorder(N)); 2473 2473 } 2474 2474 2475 else // i <= n: middle part is present, a_i != 0 2475 else // i <= n: middle part is present, a_i != 0 2476 2476 { // a = a1 ... | i:2, a_2 ..... i: n, a_n | .... i: n+1a_(n+1) 2477 2477 module I = maxideal(1); … … 2505 2505 2506 2506 2507 return ((N)); // return (grorder(N)); 2507 return ((N)); // return (grorder(N)); 2508 2508 } 2509 2509 } … … 2518 2518 grview(S); 2519 2519 2520 def N1 = matrixpres(intvec(2,0,0,0,0)); 2520 def N1 = matrixpres(intvec(2,0,0,0,0)); 2521 2521 grview(N1); 2522 2522 -
Singular/LIB/surf.lib
rba52f58 re9478b 274 274 275 275 string surf_call; i = 0; 276 276 277 277 if (isWindows()) 278 278 { … … 303 303 else 304 304 { 305 surf_call = "surfer"; 305 surf_call = "surfer"; 306 306 surf_call = surf_call + " " + l + " >/dev/null 2>&1"; 307 307 "Close window to exit from `surfer`."; 308 308 i = system("sh", surf_call); 309 310 if ( (i != 0) && isMacOSX() ) 309 310 if ( (i != 0) && isMacOSX() ) 311 311 { 312 312 "*!* Sorry: calling `surfer` failed ['"+surf_call+"']" + newline 313 313 + " (The shell returned the error code " + string(i) + "." + newline 314 + "But since we are on Mac OS X, let us try to open SURFER.app instead..." + newline 314 + "But since we are on Mac OS X, let us try to open SURFER.app instead..." + newline 315 315 + "Appropriate SURFER.app is available for instance at http://www.mathematik.uni-kl.de/~motsak/files/SURFER.dmg"; 316 316 317 317 // fallback, will only work if SURFER.app is available (e.g. in /Applications) 318 318 // get SURFER.app e.g. from http://www.mathematik.uni-kl.de/~motsak/files/SURFER.dmg 319 319 // note that the newer (Java-based) variant of Surfer may not support command line usage yet :( 320 320 321 321 surf_call = "open -a SURFER -W --args -t -s"; 322 322 surf_call = surf_call + " " + l + " >/dev/null 2>&1"; … … 324 324 i = system("sh", surf_call); 325 325 } 326 327 328 326 327 328 329 329 } 330 330 system("sh", "/bin/rm " + l); … … 381 381 { 382 382 string s = system("uname"); 383 383 384 384 for (int i = 1; i <= size(s)-2; i = i + 1) 385 385 { -
Singular/dyn_modules/singmathic/singmathic.cc
rba52f58 re9478b 468 468 result->rtyp=NONE; 469 469 470 if (arg == NULL || arg->next != NULL || 470 if (arg == NULL || arg->next != NULL || 471 471 ((arg->Typ() != IDEAL_CMD) &&(arg->Typ() != MODUL_CMD))){ 472 472 WerrorS("Syntax: mathicgb(<ideal>/<module>)"); -
Singular/dyn_modules/syzextra/mod_main.cc
rba52f58 re9478b 82 82 for (int j=0; j<l; j++) 83 83 if (id->m[j] != NULL && p_GetComp(id->m[j], r) > 0) 84 return TRUE; 84 return TRUE; 85 85 86 86 return FALSE; // rank: 1, only zero or no entries? can be an ideal OR module... BUT in the use-case should better be an ideal! … … 91 91 92 92 93 93 94 94 95 95 static inline void NoReturn(leftv& res) … … 1550 1550 const int iLimit = r->typ[pos].data.is.limit; 1551 1551 const ideal F = r->typ[pos].data.is.F; 1552 1552 1553 1553 ideal FF = id_Copy(F, r); 1554 1554 -
Singular/extra.cc
rba52f58 re9478b 3769 3769 } 3770 3770 else 3771 #endif 3771 #endif 3772 3772 /*==================== Error =================*/ 3773 3773 Werror( "(extended) system(\"%s\",...) %s", sys_cmd, feNotImplemented ); -
Tst/New/grmodexamples.tst
rba52f58 re9478b 28 28 example grgroebner; 29 29 example grsyz; 30 30 31 31 example grprod; 32 32 example grres; 33 33 34 34 example grtwists; 35 35 … … 38 38 example grgens; 39 39 example grpres; 40 40 41 41 tst_status(1);$ -
Tst/Short/bug_newstruct2.tst
rba52f58 re9478b 99 99 newstruct("TBoom", "TUndefined boom , int something"); 100 100 newstruct("TWrong", "int value, TUndefined undefined"); 101 101 102 102 TWrong f; 103 103 type(f.undefined); -
Tst/Short/bug_tr678_680.tst
rba52f58 re9478b 7 7 ideal I = (2*v+3)*y^2*z+(2*v+1)*y^2+(v-2),(-3*v-1)*x*z^2+(v)*x^2+(-3*v-1)*z^2,(3*v)*x^3+(-v); 8 8 def L1 = primdecSY (I); 9 def L2 = primdecSY ( std(I) ); 9 def L2 = primdecSY ( std(I) ); 10 10 size(L1); 11 11 size(L2); -
Tst/Short/bug_tr704.tst
rba52f58 re9478b 6 6 minpoly = (vv^2+1); 7 7 ideal I = x; 8 radical(I); 8 radical(I); 9 9 10 10 ring r = (0),(x,y),dp; -
Tst/Short/bug_tr709.tst
rba52f58 re9478b 9 9 10 10 //here is the problem 11 idealsEqual( radical( L2[2][1] ), L2[2][2] ); // 0 11 idealsEqual( radical( L2[2][1] ), L2[2][2] ); // 0 12 12 L2[2][2] ; 13 13 radical( L2[2][1] ); -
factory/NTLconvert.cc
rba52f58 re9478b 502 502 } 503 503 else 504 { 504 { 505 505 const long * rep = 506 506 #if NTL_MAJOR_VERSION <= 6 -
kernel/GBEngine/kstd2.cc
rba52f58 re9478b 110 110 const ring r=currRing; 111 111 const poly p=L->p; 112 112 113 113 pAssume(~not_sev == p_GetShortExpVector(p, r)); 114 114 -
kernel/GBEngine/syz0.cc
rba52f58 re9478b 660 660 else 661 661 { 662 pDelete(&toRed); 663 662 pDelete(&toRed); 663 664 664 pDelete(&syz); 665 665 for(k=j;k<Fl;k++) pDelete(&(pairs[k])); 666 666 omFreeSize((ADDRESS)pairs,(Fl + gencQ)*sizeof(poly)); 667 667 668 668 669 669 for(k=0;k<IDELEMS(result);k++) pDelete(&((*Shdl)[k])); 670 670 … … 673 673 //no polynom for reduction 674 674 WerrorS("ideal not a standard basis"); 675 675 676 676 return result; 677 677 } … … 903 903 904 904 if (errorreported) 905 { 905 { 906 906 for (j=0;j<*length;j++) idDelete( &res[j] ); 907 907 omFreeSize((ADDRESS)res,*length*sizeof(ideal)); … … 947 947 res[syzIndex+1] = sySchreyersSyzygiesFM(res[syzIndex],&modcomp); 948 948 if (errorreported) 949 { 949 { 950 950 for (j=0;j<*length;j++) idDelete( &res[j] ); 951 951 omFreeSize((ADDRESS)res,*length*sizeof(ideal)); -
libpolys/coeffs/longrat.h
rba52f58 re9478b 101 101 assume( nCoeff_is_Q (r) ); 102 102 n_Test(q, r); 103 103 104 104 if (SR_HDL(q) & SR_INT) 105 105 return TRUE; // immidiate int 106 106 107 107 return ( q->s == 3 ); 108 108 } -
libpolys/polys/ext_fields/transext.cc
rba52f58 re9478b 193 193 Print("ERROR in %s:%d: non-integer Q coeff in num. poly\n",f,l); 194 194 Print("TERM: "); p_wrp(p, ntRing); PrintLn(); 195 return FALSE; 195 return FALSE; 196 196 } 197 197 … … 206 206 if (! nlIsInteger( p_GetCoeff(p, ntRing), ntCoeffs) ) 207 207 { 208 Print("ERROR in %s:%d: non-integer Q coeff in den. poly\n",f,l); 208 Print("ERROR in %s:%d: non-integer Q coeff in den. poly\n",f,l); 209 209 Print("TERM: "); p_wrp(p, ntRing); PrintLn(); 210 return FALSE; 210 return FALSE; 211 211 } 212 212 … … 220 220 return FALSE; 221 221 } 222 222 223 223 if( !n_IsOne(pGetCoeff(den), ntCoeffs) ) 224 { 225 Print("ERROR in %s:%d: non-monic den. poly / Zp\n",f,l); 224 { 225 Print("ERROR in %s:%d: non-monic den. poly / Zp\n",f,l); 226 226 Print("NUM: "); p_Write(num, ntRing); 227 227 Print("DEN: "); p_Write(den, ntRing); … … 229 229 } 230 230 } 231 231 232 232 poly gcd = singclap_gcd_r( num, den, ntRing ); 233 233 … … 244 244 245 245 return TRUE; 246 247 248 246 247 248 249 249 if(p_IsConstant(den, ntRing) && (n_IsOne(pGetCoeff(den), ntCoeffs))) 250 250 { … … 336 336 //check_N(*a,cf); 337 337 ntTest(*a); // !!! 338 338 339 339 fraction f = (fraction)(*a); 340 340 if (IS0(f)) return; … … 1815 1815 { 1816 1816 n_Test(a, src); 1817 1817 1818 1818 if (n_IsZero(a, src)) return NULL; 1819 1819 assume(src->rep == dst->extRing->cf->rep); … … 1830 1830 if (n_IsOne(nn,src)) DEN(ff)=NULL; 1831 1831 else DEN(ff)=p_NSet(nn,dst->extRing); 1832 1832 1833 1833 n_Test((number)ff,dst); 1834 1834 //check_N((number)ff,dst); -
libpolys/polys/simpleideals.h
rba52f58 re9478b 14 14 /// thoughout Singular. Basic use-cases for it are: 15 15 /// * ideal/module: nrows = 1, ncols >=0 and rank:1 for ideals, rank>=0 for modules 16 /// * matrix: nrows, ncols >=0, rank == nrows! see mp_* procedures 16 /// * matrix: nrows, ncols >=0, rank == nrows! see mp_* procedures 17 17 /// NOTE: the m member point to memory chunk of size (ncols*nrows*sizeof(poly)) or is NULL 18 18 struct sip_sideal
Note: See TracChangeset
for help on using the changeset viewer.