Changeset b2fb0c in git
- Timestamp:
- May 25, 2012, 10:39:54 PM (12 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- 8b368ff67a7ef888aa2e3b02b2f425f07dc87cc1
- Parents:
- d058ea0445faa86f5ef796da196fbee35884b543
- git-author:
- Oleksandr Motsak <motsak@mathematik.uni-kl.de>2012-05-25 22:39:54+02:00
- git-committer:
- Oleksandr Motsak <motsak@mathematik.uni-kl.de>2014-05-07 04:41:43+02:00
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/LIB/schreyer.lib
rd058ea rb2fb0c 1040 1040 // -------------------------------------------------------- // 1041 1041 1042 /// TODO: save shortcut LM(m) * "t" ->?1043 proc SS ReduceTerm(poly m, def t, def L, def T, list #)1042 /// TODO: save shortcut (syz: |-.->) LM(LM(m) * "t") -> syz? 1043 proc SSFindReducer(def product, def syzterm, def L, def T, list #) 1044 1044 { 1045 1045 if( typeof( attrib(basering, "DEBUG") ) == "int" ) … … 1051 1051 } 1052 1052 1053 1054 if( @DEBUG ) 1055 { 1056 "SSFindReducer::Input: "; 1057 1058 "syzterm: ", syzterm; 1059 "product: ", product; 1060 "L: ", L; 1061 "T: ", T; 1062 if( size(#) > 0 ) 1063 { 1064 "LSyz: ", #; 1065 } 1066 } 1067 1068 1069 if( typeof( attrib(basering, "SYZCHECK") ) == "int" ) 1070 { 1071 int @SYZCHECK = attrib(basering, "SYZCHECK"); 1072 } else 1073 { 1074 int @SYZCHECK = @DEBUG; 1075 } 1076 1077 if( @SYZCHECK && (syzterm != 0) ) 1078 { 1079 def @@c = leadcomp(syzterm); int @@r = int(@@c); 1080 def @@product = leadmonomial(syzterm) * L[@@r]; 1081 1082 if( @@product != product) 1083 { 1084 "product: ", product, ", @@product: ", @@product; 1085 "ERROR: 'syzterm' results in wrong product !!!???"; 1086 $ 1087 } 1088 } 1089 1090 // def product = m * t; 1091 1092 bigint c = leadcomp(product); int r = int(c); 1093 1094 def a, b, bb; 1095 1096 vector nf = [0]; 1097 1098 // looking for an appropriate diviser 1099 for( int k = ncols(L); k > 0; k-- ) 1100 { 1101 a = L[k]; 1102 // with the same mod. component 1103 if( leadcomp(a) == c ) 1104 { 1105 b = - (leadmonomial(product) / leadmonomial(L[k])); 1106 1107 // which divides the product: looking for the 1st appropriate one! 1108 if( b != 0 ) 1109 { 1110 bb = b * gen(k); 1111 1112 if (size(bb + syzterm) == 0) // cannot allow something like: a*gen(i) - a*gen(i) 1113 { 1114 nf = [0]; 1115 } else 1116 { 1117 nf = bb; 1118 } 1119 1120 // new syz. term should not be in <LS = #> 1121 if( size(#) > 0 ) 1122 { 1123 if( typeof(#[1]) == "module" ) 1124 { 1125 nf = NF(bb, #[1]); 1126 } 1127 } 1128 1129 // while the complement (the fraction) is not reducible by leading syzygies 1130 if( nf != 0 ) // nf must be == bb!!! 1131 { 1132 /// TODO: save shortcut LM(m) * T[i] -> ? 1133 1134 // choose ANY such reduction... (with the biggest index?) 1135 break; 1136 } 1137 } 1138 } 1139 } 1140 if( @DEBUG ) 1141 { 1142 "SSFindReducer::Output: ", nf; 1143 } 1144 return (nf); 1145 } 1146 1147 1148 1149 1150 1151 /// TODO: save shortcut (syz: |-.->) LM(m) * "t" -> ? 1152 proc SSReduceTerm(poly m, def t, def syzterm, def L, def T, list #) 1153 { 1154 if( typeof( attrib(basering, "DEBUG") ) == "int" ) 1155 { 1156 int @DEBUG = attrib(basering, "DEBUG"); 1157 } else 1158 { 1159 int @DEBUG = !system("with", "ndebug"); 1160 } 1161 1162 1053 1163 if( @DEBUG ) 1054 1164 { 1055 1165 "SSReduce::Input: "; 1056 1166 1167 "syzterm: ", syzterm; 1057 1168 "mult: ", m; 1058 1169 "term: ", t; … … 1065 1176 // "attrib(LS, 'isSB')", attrib(LS, "isSB"); 1066 1177 } 1067 1068 vector s = 0; 1069 1070 if( t == 0 ) 1071 { 1072 return (s); 1073 } 1074 1075 def product = m * t; 1076 1077 bigint c = leadcomp(t); 1078 int r = int(c); 1079 1080 def a, b, nf, bb; 1081 1082 // looking for an appropriate reducer 1083 for( int k = ncols(L); k > 0; k-- ) 1084 { 1085 a = L[k]; 1086 // with the same mod. component 1087 if( leadcomp(a) == c ) 1088 { 1089 b = - (leadmonomial(product) / leadmonomial(L[k])); 1090 1091 // which divides the product 1092 if( b != 0 ) 1093 { 1094 // "b: ", b; 1095 bb = b * gen(k); 1096 nf = bb; 1097 1098 if( size(#) > 0 ) 1099 { 1100 if( typeof(#[1]) == "module" ) 1101 { 1102 nf = NF(bb, #[1]); 1103 // "NF: ", nf; 1104 } 1105 } 1106 1107 // while the complement (the fraction) is not reducible by leading syzygies 1108 if( nf != 0 ) 1109 { 1110 /// TODO: save shortcut LM(m) * T[i] -> ? 1111 1112 // choose ANY such reduction... (with the biggest index?) 1113 s = bb + SSTraverseTail(b, T[k], L, T, #); 1114 break; 1115 } 1116 } 1117 } 1118 } 1178 1179 1180 if( typeof( attrib(basering, "SYZCHECK") ) == "int" ) 1181 { 1182 int @SYZCHECK = attrib(basering, "SYZCHECK"); 1183 } else 1184 { 1185 int @SYZCHECK = @DEBUG; 1186 } 1187 1188 if( @SYZCHECK && (syzterm != 0) ) 1189 { 1190 def @@c = leadcomp(syzterm); int @@r = int(@@c); 1191 poly @@m = leadmonomial(syzterm); def @@t = L[@@r]; 1192 1193 if( (@@m != m) || (@@t != t)) 1194 { 1195 "m: ", m, ", t: ", t; 1196 "@@m: ", @@m, ", @@t: ", @@t; 1197 "ERROR: 'syzterm' results in wrong m * t !!!"; 1198 $ 1199 } 1200 } 1201 1202 vector s = [0]; 1203 1204 if( size(t) > 0 ) 1205 { 1206 def product = m * t; 1207 1208 s = SSFindReducer(product, syzterm, L, T, #); 1209 1210 if( size(s) != 0 ) 1211 { 1212 poly b = leadmonomial(s); 1213 1214 def c = leadcomp(s); int k = int(c); 1215 1216 s = s + SSTraverseTail(b, T[k], L, T, #); // !!! 1217 } 1218 } 1219 1119 1220 if( @DEBUG ) 1120 1221 { 1121 1222 "SSReduceTerm::Output: ", s; 1122 1223 } 1224 1123 1225 return (s); 1124 1226 } 1227 1125 1228 1126 1229 // TODO: store m * @tail -.-^-.-^-.--> ? … … 1156 1259 { 1157 1260 @l = lead(@tail); 1158 s = s + SSReduceTerm(m, @l, L, T, #);1261 s = s + SSReduceTerm(m, @l, [0], L, T, #); // :( 1159 1262 @tail = @tail - @l; 1160 1263 } … … 1214 1317 { 1215 1318 @TAILREDSYZ = attrib(basering, "TAILREDSYZ"); 1216 // @TAILREDSYZ; 1217 } 1319 } 1320 1321 int @HYBRIDNF = 0; 1322 if( typeof( attrib(basering, "HYBRIDNF") ) == "int" ) 1323 { 1324 @HYBRIDNF = attrib(basering, "HYBRIDNF"); 1325 } 1326 1327 module LL; 1328 def a2; int r2; poly aa2; 1218 1329 1219 1330 /// Get the critical leading syzygy terms 1220 1331 if( @LEAD2SYZ ) // & 2nd syz. term 1221 1332 { 1222 def a2; int r2; poly aa2; 1223 module LL, LL2; 1333 module LL2; 1224 1334 (LL, LL2) = SSCompute2LeadingSyzygyTerms(L); // ++ 1225 1335 } else 1226 1336 { 1227 moduleLL = SSComputeLeadingSyzygyTerms(L);1228 } 1229 1230 module TT, SYZ; 1337 LL = SSComputeLeadingSyzygyTerms(L); 1338 } 1339 1340 module TT, SYZ; def spoly; 1231 1341 1232 1342 if( size(LL) > 0 ) … … 1234 1344 list LS; 1235 1345 1236 if( @TAILREDSYZ 1346 if( @TAILREDSYZ) 1237 1347 { 1238 1348 LS = list(LL); 1239 1349 } 1240 1350 1241 1351 vector @tail; 1242 1352 … … 1247 1357 // "A: ", a, " --->>>> ", aa, " **** [", r, "]: "; 1248 1358 1249 /// TODO: save shortcut (aa) * T[r] -> ? 1250 @tail = SSTraverseTail(aa, T[r], L, T, LS); 1251 1252 // get the 2nd syzygy term... 1253 1254 if( @LEAD2SYZ ) // with the 2nd syz. term: 1255 { 1256 a2 = LL2[k]; c = leadcomp(a2); r2 = int(c); aa2 = leadmonomial(a2); 1257 @tail = @tail + 1258 /// TODO: save shortcut (aa2) * T[r2] -> ? 1259 a2 + SSTraverseTail(aa2, T[r2], L, T, LS); 1359 // NF reduction: 1360 if( !@HYBRIDNF ) 1361 { 1362 /// TODO: save shortcut (aa) * T[r] -> ? 1363 @tail = SSTraverseTail(aa, T[r], L, T, LS); 1364 // // @tail = SSTraverseTail(a, L, T, LS); 1365 1366 // get the 2nd syzygy term... 1367 1368 if( @LEAD2SYZ ) // with the 2nd syz. term: 1369 { 1370 a2 = LL2[k]; c = leadcomp(a2); r2 = int(c); aa2 = leadmonomial(a2); 1371 1372 @tail = @tail + a2 + 1373 /// TODO: save shortcut (aa2) * T[r2] -> ? 1374 SSTraverseTail(aa2, T[r2], L, T, LS); 1375 // // SSTraverseTail(a2, L, T, LS); 1376 } else 1377 { 1378 @tail = @tail + 1379 SSReduceTerm(aa, L[r], a, L, T, LS); 1380 // // SSReduceTerm(a, L, T, LS); 1381 } 1260 1382 } else 1261 1383 { 1262 @tail = @tail + SSReduceTerm(aa, L[r], L, T, LS); 1263 } 1384 spoly = aa * T[r]; 1385 1386 if( @LEAD2SYZ ) 1387 { 1388 a2 = LL2[k]; 1389 } else 1390 { 1391 a2 = SSFindReducer( aa * L[r], a, L, T, LS); 1392 } 1393 1394 if ( (@SYZCHECK || @DEBUG) ) 1395 { 1396 if( size(a2) == 0 ) // if syzterm == 0!!!! 1397 { 1398 "ERROR: could not find the 2nd syzygy term during the hybrid NF!!!"; 1399 $ 1400 } 1401 } 1402 1403 c = leadcomp(a2); r2 = int(c); aa2 = leadmonomial(a2); 1404 1405 spoly = spoly + aa2 * T[r2]; 1406 @tail = a2; 1407 1408 while (size(spoly) > 0) 1409 { 1410 a2 = SSFindReducer( lead(spoly), [0], L, T, LS); 1411 spoly = Tail(spoly); 1412 1413 if( size(a2) != 0) 1414 { 1415 c = leadcomp(a2); r2 = int(c); aa2 = leadmonomial(a2); 1416 1417 spoly = spoly + aa2 * T[r2]; 1418 @tail = @tail + a2; 1419 } 1420 } 1421 1422 } 1264 1423 1265 1424 TT[k] = @tail; … … 1268 1427 } 1269 1428 1270 /*1271 def opts = option(get); option(redSB); option(redTail);1272 module SYZ = std(syz(M));1273 option(set, opts); kill opts;1274 1275 module LL = lead(SYZ); // TODO: WRONG ORDERING!!!!!!!!1276 module TT = Tail(SYZ);1277 */1278 1279 1429 if( @DEBUG ) 1280 1430 { … … 1499 1649 1500 1650 ideal M = maxideal(1); M; 1651 1501 1652 def S = SSres(M, 0); setring S; S; 1502 1653 MRES;
Note: See TracChangeset
for help on using the changeset viewer.