Changeset c13ff56 in git
- Timestamp:
- Apr 14, 2009, 10:36:17 AM (14 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
- Children:
- b8973d758f37286564ab8fb1f67367ac731674c7
- Parents:
- 3402b4b654df40779dd0b3d83c4d023a3ef93e0b
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/LIB/qhmoduli.lib
r3402b4b rc13ff56 1 1 /////////////////////////////////////////////////////////////////////////////// 2 version="$Id: qhmoduli.lib,v 1.1 4 2009-04-08 14:08:25Singular Exp $";2 version="$Id: qhmoduli.lib,v 1.15 2009-04-14 08:36:17 Singular Exp $"; 3 3 category="Singularities"; 4 4 info=" … … 492 492 Variables = StabVar(wt); // possible quasihomogeneous substitutions 493 493 nrVars = 0; 494 for(i = 1; i <= size(wt); i = i + 1) { 494 for(i = 1; i <= size(wt); i++) 495 { 495 496 nrVars = nrVars + size(Variables[i]); 496 497 } … … 499 500 500 501 varString = "s(1.." + string(nrVars) + ")"; 501 if(npars(basering) == 1) { 502 if(npars(basering) == 1) 503 { 502 504 parString = "(0, " + parstr(basering) + ")"; 503 505 } … … 527 529 nrVars = 0; 528 530 offset = 0; 529 for(i = 1; i <= size(wt); i = i + 1) { // build the substitution t(i) -> ... 531 for(i = 1; i <= size(wt); i++) 532 { // build the substitution t(i) -> ... 530 533 if(i > 1) { offset = offset + size(Variables[i - 1]); } 531 534 g = 0; 532 for(j = 1; j <= size(Variables[i]); j = j + 1) { 535 for(j = 1; j <= size(Variables[i]); j++) 536 { 533 537 pp = 1; 534 for(k = 2; k <= size(Variables[i][j]); k = k + 1) { 538 for(k = 2; k <= size(Variables[i][j]); k++) 539 { 535 540 pp = pp * var(Variables[i][j][k]); 536 541 if(Variables[i][j][k] == i) { varSubsList[i] = offset + j;} … … 562 567 coMx = coef(f, vars); // coefficients of f 563 568 564 for(i = 1; i <= ncols(newcoMx); i = i + 1) { // build the system of eqns via coeff. comp. 569 for(i = 1; i <= ncols(newcoMx); i++) 570 { // build the system of eqns via coeff. comp. 565 571 j = 1; 566 572 h = 0; 567 while(j <= ncols(coMx)) { // all monomials in f 573 while(j <= ncols(coMx)) 574 { // all monomials in f 568 575 if(coMx[j][1] == newcoMx[i][1]) { h = coMx[j][2]; j = ncols(coMx) + 1;} 569 576 else {j = j + 1;} … … 662 669 jacobIdstd = std(jacobianId); 663 670 newFs = Fs; 664 for(i = 1; i <= size(B); i = i + 1) { 671 for(i = 1; i <= size(B); i++) 672 { 665 673 basisDegList[i] = deg(B[i], wt); 666 674 } … … 671 679 d = deg(f, wt); 672 680 673 for(i = d + 1; i < ub; i = i + 1) { // base[1] = monomials of degree i 681 for(i = d + 1; i < ub; i++) 682 { // base[1] = monomials of degree i 674 683 upperBasis[i] = SelectMonos(list(B, B), wt, i); // B must not contain 0's 675 684 } … … 679 688 // it into newFs 680 689 681 for(i = d + 1; i < ub; i = i + 1) { // ub instead of @UB 690 for(i = d + 1; i < ub; i = i + 1) 691 { // ub instead of @UB 682 692 dbprint(dbPrt, "-- degree = " + string(i) + " of " + string(ub - 1) + " ---------------------------"); 683 693 if(size(newFs) < 80) { dbprint(dbPrt, " polynomial = " + string(newFs - f));} … … 688 698 gmonos = SelectMonos(parts, wt, i); 689 699 common = IntersectionQHM(upperBasis[i][1], gmonos[1]); 690 if(size(common) == size(gmonos[1])) { 700 if(size(common) == size(gmonos[1])) 701 { 691 702 dbprint(dbPrt, " no additional monomials "); 692 703 } … … 696 707 // write g = c[i] * jacobianId[i] 697 708 698 else { 709 else 710 { 699 711 dbprint(dbPrt, " additional Monomials found, compute the map "); 700 712 g = PSum(gmonos[2]); // sum of all monomials in g of degree i … … 704 716 gCoeffMx = lift(jacobianId, g - gred); // compute c[i] 705 717 mapId = var(1) - gCoeffMx[1][1]; // generate the map 706 for(j = 2; j <= size(gCoeffMx); j = j + 1) { 718 for(j = 2; j <= size(gCoeffMx); j++) 719 { 707 720 mapId[j] = var(j) - gCoeffMx[1][j]; 708 721 } … … 736 749 data = jet(f, ub - 1, wt); 737 750 k = 0; 738 for(i = 1; i <= size(data); i = i + 1) { 751 for(i = 1; i <= size(data); i++) 752 { 739 753 mono = lead(data[i]); 740 if(deg(mono, wt) < ub) { 754 if(deg(mono, wt) < ub) 755 { 741 756 k = k + 1; 742 757 lcInv = 1/leadcoef(mono); … … 771 786 772 787 k = 0; 773 for(i = 1; i <= size(parts[1]); i = i + 1) { 788 for(i = 1; i <= size(parts[1]); i++) 789 { 774 790 mono = parts[1][i]; 775 if(deg(mono, wt) == d) { 776 k = k + 1; 791 if(deg(mono, wt) == d) 792 { 793 k++; 777 794 monomials[k] = mono; 778 795 terms[k] = parts[2][i]; … … 810 827 // compute substitution[1]^degVec[1],...,subs[n]^degVec[n] 811 828 812 for(i = 1; i <= ncols(substitution); i = i + 1) { 813 if(size(substitution[i]) < 3 || degVec[i] < 4) { 829 for(i = 1; i <= ncols(substitution); i++) 830 { 831 if(size(substitution[i]) < 3 || degVec[i] < 4) 832 { 814 833 powerList[i] = reduce(substitution[i]^degVec[i], reduceI); // new 815 834 } // directly for small exponents 816 else { 835 else 836 { 817 837 powerList[i] = PolyPower1(i, substitution[i], degVec[i], reduceI, w1, truncated[i], ub); 818 838 } … … 821 841 g = powerList[1]; 822 842 minDeg = w1[1] * degVec[1]; 823 for(i = 2; i <= ncols(substitution); i = i + 1) { 843 for(i = 2; i <= ncols(substitution); i++) 844 { 824 845 g = jet(g, ub - w1[i] * degVec[i] - 1, w1); 825 846 h = jet(powerList[i], ub - minDeg - 1, w1); … … 842 863 " 843 864 { 844 int SUBSMAXSIZE = 3000; //865 int SUBSMAXSIZE = 3000; 845 866 int i, nrParts, sizeOfPart, currentPos, partSize, maxSIZE; 846 867 poly g, h, gxh, prodComp, @g2; // replace @g2 by subst. … … 849 870 h = h1; 850 871 851 if(size(g)*size(h) > SUBSMAXSIZE) {852 872 if(size(g)*size(h) > SUBSMAXSIZE) 873 { 853 874 // divide the polynomials with more terms in parts s.t. 854 875 // the product of each part with the other polynomial … … 861 882 partSize = size(g) / nrParts; 862 883 gxh = 0; // 'g times h' 863 for(i = 1; i <= nrParts; i = i + 1){ 884 for(i = 1; i <= nrParts; i++) 885 { 864 886 //print(" loop #" + string(i) + " of " + string(nrParts)); 865 887 currentPos = (i - 1) * partSize; … … 870 892 if(size(@g2) < size(prodComp)) { print(" killed " + string(size(prodComp) - size(@g2)) + " terms ");} 871 893 gxh = reduce(gxh + @g2, reduceI); 872 873 874 }875 else{894 } 895 } 896 else 897 { 876 898 gxh = reduce(jet(g * h,ub - 1, wt), reduceI); 877 899 } // compute directly … … 898 920 if(e == 1) { return(f);} 899 921 if(f == 0) { return(1); } 900 else {901 922 else 923 { 902 924 // test if f has been computed to some power 903 904 if(computedPowers[varIndex][1] > 0){925 if(computedPowers[varIndex][1] > 0) 926 { 905 927 maxPrecomputedPower = computedPowers[varIndex][1]; 906 if(maxPrecomputedPower >= e) { 928 if(maxPrecomputedPower >= e) 929 { 907 930 // no computation necessary, f^e has already benn computed 908 931 g = computedPowers[varIndex][2][e - 1]; … … 916 939 } 917 940 } 918 else { // no precomputed data 941 else 942 { // no precomputed data 919 943 lb = 2; 920 944 ordOfg = wt[varIndex]; 921 945 g = f; 922 946 } 923 for(i = lb; i <= e; i = i + 1) { 947 for(i = lb; i <= e; i++) 948 { 924 949 fn = jet(f, ub - ordOfg - 1, wt); // reduce w.r.t. reduceI 925 950 g = PolyProduct(g, fn, reduceI, wt, ub); 926 951 ordOfg = ordOfg + wt[varIndex]; 927 952 if(g == 0) { break; } 928 if((i > maxPrecomputedPower) && !truncated) { 929 if(maxPrecomputedPower == 0) { // init computedPowers 953 if((i > maxPrecomputedPower) && !truncated) 954 { 955 if(maxPrecomputedPower == 0) 956 { // init computedPowers 930 957 computedPowers[varIndex] = list(i, list(g)); 931 958 } … … 946 973 list temp; 947 974 948 for(i = 1; i <= size(@index); i = i + 1) { temp[i] = string(var(@index[i])); }975 for(i = 1; i <= size(@index); i++) { temp[i] = string(var(@index[i])); } 949 976 return(temp); 950 977 } … … 976 1003 977 1004 parts = MonosAndTerms(f, wt, ub); 978 for(i = 1; i <= size(parts[1]); i = i + 1) { 1005 for(i = 1; i <= size(parts[1]); i = i + 1) 1006 { 979 1007 coeffList[i] = parts[2][i]/parts[1][i]; 980 1008 degVecList[i] = leadexp(parts[1][i]); … … 988 1016 989 1017 @ringVars = "(" + varstr(basering) + ", " + parstr(1) + ","; // precondition 990 if(nrs > 0) { 1018 if(nrs > 0) 1019 { 991 1020 @ringVars = @ringVars + "s(1.." + string(nrs) + "), "; 992 1021 } … … 1013 1042 f = imap(RASB, f); 1014 1043 1015 for(i = 1; i <= n; i = i + 1) { // all "base" variables 1044 for(i = 1; i <= n; i++) 1045 { // all "base" variables 1016 1046 computedPowers[i] = list(0); 1017 for(j = 1; j <= size(substitution[i]); j = j + 1) { degList[j] = deg(substitution[i][j], w1);}1047 for(j = 1; j <= size(substitution[i]); j++) { degList[j] = deg(substitution[i][j], w1);} 1018 1048 degOfSubs[i] = degList; 1019 1049 } … … 1022 1052 1023 1053 g = 0; 1024 for(i = 1; i <= size(degVecList); i = i + 1) { 1054 for(i = 1; i <= size(degVecList); i++) 1055 { 1025 1056 truncatedQ = Table("0", "i", 1, n); 1026 1057 newSubs = 0; … … 1033 1064 // where m' is the monomial m without the j-th variable 1034 1065 1035 for(j = 1; j <= size(degVec); j = j + 1) { minDeg[j] = d - degVec[j] * wt[j]; } 1036 1037 for(j = 1; j <= size(degVec); j = j + 1) { 1066 for(j = 1; j <= size(degVec); j++) { minDeg[j] = d - degVec[j] * wt[j]; } 1067 1068 for(j = 1; j <= size(degVec); j++) 1069 { 1038 1070 subsPoly = 0; // set substitution to 0 1039 if(degVec[j] > 0) {1040 1071 if(degVec[j] > 0) 1072 { 1041 1073 // if variable occurs then check if 1042 1074 // substitution[j][k] * (linear part)^(degVec[j]-1) + minDeg[j] < ub … … 1047 1079 // to the result and cannot be omitted 1048 1080 1049 for(k = 1; k <= size(substitution[j]); k = k + 1) { 1050 if(degOfSubs[j][k] + (degVec[j] - 1) * wt[j] + minDeg[j] < ub) { 1081 for(k = 1; k <= size(substitution[j]); k++) 1082 { 1083 if(degOfSubs[j][k] + (degVec[j] - 1) * wt[j] + minDeg[j] < ub) 1084 { 1051 1085 subsPoly = subsPoly + substitution[j][k]; 1052 1086 } … … 1084 1118 1085 1119 varList = StabVarComb(wt); 1086 for(i = 1; i <= size(wt); i = i + 1) { 1120 for(i = 1; i <= size(wt); i = i + 1) 1121 { 1087 1122 subs = 0; 1088 1089 1123 // built linear substituitons 1090 for(j = 1; j <= size(varList[1][i]); j = j + 1) { 1124 for(j = 1; j <= size(varList[1][i]); j++) 1125 { 1091 1126 subs[j] = list(i) + list(varList[1][i][j]); 1092 1127 } 1093 1128 Variables[i] = subs; 1094 if(size(varList[2][i]) > 0) {1095 1129 if(size(varList[2][i]) > 0) 1130 { 1096 1131 // built nonlinear substituitons 1097 1132 subs = 0; 1098 for(j = 1; j <= size(varList[2][i]); j = j + 1) { 1133 for(j = 1; j <= size(varList[2][i]); j++) 1134 { 1099 1135 subs[j] = list(i) + varList[2][i][j]; 1100 1136 } … … 1116 1152 " 1117 1153 { 1118 int m i, ma,i, j, k, uw, ic;1154 int mmi, mma, ii, j, k, uw, ic; 1119 1155 list index, indices, usedWeights, combList, combinations; 1120 1156 list linearSubs, nonlinearSubs; … … 1126 1162 uw = 0; 1127 1163 ic = 0; 1128 mi = Min(wt); 1129 ma = Max(wt); 1130 1131 for(i = mi; i <= ma; i = i + 1) { 1132 if(ContainedQ(wt, i)) { // find variables of weight i 1164 mmi = Min(wt); 1165 mma = Max(wt); 1166 1167 for(ii = mmi; ii <= mma; ii++) 1168 { 1169 if(ContainedQ(wt, ii)) 1170 { // find variables of weight ii 1133 1171 k = 0; 1134 1172 index = 0; 1135 1173 // collect the indices of all variables of weight i 1136 for(j = 1; j <= size(wt); j = j + 1) { 1137 if(wt[j] == i) { 1138 k = k + 1; 1174 for(j = 1; j <= size(wt); j++) 1175 { 1176 if(wt[j] == ii) 1177 { 1178 k++; 1139 1179 index[k] = j; 1140 1180 } 1141 1181 } 1142 uw = uw + 1;1143 usedWeights[uw] = i ;1144 ic = ic + 1;1145 indices[i ] = index;1182 uw++; 1183 usedWeights[uw] = ii; 1184 ic++; 1185 indices[ii] = index; 1146 1186 1147 1187 // linear part of the substitution 1148 1188 1149 for(j = 1; j <= size(index); j = j + 1) { 1189 for(j = 1; j <= size(index); j++) 1190 { 1150 1191 linearSubs[index[j]] = index; 1151 1192 } … … 1153 1194 // nonlinear part of the substitution 1154 1195 1155 if(uw > 1) { // variables of least weight do not allow nonlinear subs. 1156 1157 partitions = Partitions(i, delete(usedWeights, uw)); 1158 for(j = 1; j <= size(partitions); j = j + 1) { 1159 combinations[j] = AllCombinations(partitions[j], indices); 1196 if(uw > 1) 1197 { // variables of least weight do not allow nonlinear subs. 1198 1199 partitions = Partitions(ii, delete(usedWeights, uw)); 1200 for(j = 1; j <= size(partitions); j++) 1201 { 1202 combinations[j] = AllCombinations(partitions[j], indices); 1203 } 1204 for(j = 1; j <= size(index); j++) 1205 { 1206 nonlinearSubs[index[j]] = FlattenQHM(combinations); // flatten one level ! 1207 } 1160 1208 } 1161 for(j = 1; j <= size(index); j = j + 1) {1162 nonlinearSubs[index[j]] = FlattenQHM(combinations); // flatten one level !1163 }1164 1165 } // end if1166 1167 1209 } 1168 1210 } … … 1189 1231 ok = 1; 1190 1232 m = partition[1]; 1191 while(ok) { 1192 if(i > size(partition)) { 1233 while(ok) 1234 { 1235 if(i > size(partition)) 1236 { 1193 1237 ok = 0; 1194 1238 p = 0; … … 1196 1240 else { p = partition[i];} 1197 1241 if(p == m) { i = i + 1;} 1198 else { 1242 else 1243 { 1199 1244 k = k + 1; 1200 1245 nrList[k] = i - 1 - offset; … … 1218 1263 list comb, newC, temp, newIndex; 1219 1264 1220 if(n == 1) { 1221 for(i = 1; i <= size(index); i = i + 1) { 1265 if(n == 1) 1266 { 1267 for(i = 1; i <= size(index); i++) 1268 { 1222 1269 temp = index[i]; 1223 1270 comb[i] = temp; … … 1225 1272 return(comb); 1226 1273 } 1227 if(size(index) == 1) { 1274 if(size(index) == 1) 1275 { 1228 1276 temp = Table(string(index[1]), "i", 1, n); 1229 1277 comb[1] = temp; … … 1231 1279 } 1232 1280 newIndex = index; 1233 for(i = 1; i <= size(index); i = i + 1) { 1281 for(i = 1; i <= size(index); i = i + 1) 1282 { 1234 1283 if(i > 1) { newIndex = delete(newIndex, 1); } 1235 1284 newC = AllSingleCombinations(n - 1, newIndex); 1236 1285 k = size(comb); 1237 1286 temp = 0; 1238 for(j = 1; j <= size(newC); j = j + 1) { 1287 for(j = 1; j <= size(newC); j++) 1288 { 1239 1289 temp[1] = index[i]; 1240 1290 temp = temp + newC[j]; … … 1263 1313 1264 1314 if(size(restC) == 0) { comb = firstC;} 1265 else { 1266 for(i = 1; i <= size(firstC); i = i + 1) { 1315 else 1316 { 1317 for(i = 1; i <= size(firstC); i++) 1318 { 1267 1319 k = size(comb); 1268 for(j = 1; j <= size(restC); j = j + 1) { 1320 for(j = 1; j <= size(restC); j++) 1321 { 1269 1322 //elem = firstC[i] + restC[j]; 1270 1323 // comb[k + j] = elem; … … 1288 1341 1289 1342 if(size(nr) == 0) { return(list());} 1290 if(size(nr) == 1) { 1291 if(NumFactor(nr[1], n) > 0) { 1343 if(size(nr) == 1) 1344 { 1345 if(NumFactor(nr[1], n) > 0) 1346 { 1292 1347 parts[1] = Table(string(nr[1]), "i", 1, NumFactor(nr[1], n)); 1293 1348 } 1294 1349 return(parts); 1295 1350 } 1296 else { 1351 else 1352 { 1297 1353 parts = Partitions(n, nr[1]); 1298 1354 restP = Partitions(n, delete(nr, 1)); 1299 1355 1300 1356 parts = parts + restP; 1301 for(i = 1; i <= n / nr[1]; i = i + 1) { 1357 for(i = 1; i <= n / nr[1]; i = i + 1) 1358 { 1302 1359 temp = Table(string(nr[1]), "i", 1, i); 1303 1360 decP = Partitions(n - i*nr[1], delete(nr, 1)); 1304 1361 k = size(parts); 1305 for(j = 1; j <= size(decP); j = j + 1) { 1362 for(j = 1; j <= size(decP); j++) 1363 { 1306 1364 newP = temp + decP[j]; // new partition 1307 if(!ContainedQ(parts, newP, 1)) { 1365 if(!ContainedQ(parts, newP, 1)) 1366 { 1308 1367 k = k + 1; 1309 1368 parts[k] = newP; … … 1339 1398 execute("int " + iterator + ";"); 1340 1399 1341 for(int @i = lb; @i <= ub; @i++) { 1400 for(int @i = lb; @i <= ub; @i++) 1401 { 1342 1402 execute(iterator + " = " + string(@i)); 1343 1403 execute("data[" + string(@i) + "] = " + cmd + ";"); … … 1359 1419 c = 1; 1360 1420 1361 for(i = 1; i <= size(data); i = i + 1) { 1362 for(j = 1; j <= size(data[i]); j = j + 1) { 1421 for(i = 1; i <= size(data); i++) 1422 { 1423 for(j = 1; j <= size(data[i]); j++) 1424 { 1363 1425 fList[c] = data[i][j]; 1364 1426 c = c + 1; … … 1379 1441 c = 1; 1380 1442 1381 for(int i = 1; i <= size(l1); i = i + 1) { 1443 for(int i = 1; i <= size(l1); i++) 1444 { 1382 1445 b = ContainedQ(l2, l1[i]); 1383 if(b == 1) { 1446 if(b == 1) 1447 { 1384 1448 l[c] = l1[i]; 1385 c = c + 1;1449 c++; 1386 1450 } 1387 1451 } … … 1399 1463 i = 0; 1400 1464 pos = 0; 1401 while(!pos && i < size(data)) { 1402 i = i + 1; 1403 if(data[i] == elem) { pos = i;} 1465 while(i < size(data)) 1466 { 1467 i++; 1468 if(data[i] == elem) { pos = i; break;} 1404 1469 } 1405 1470 return(pos); … … 1411 1476 { 1412 1477 poly f; 1413 for(int i = 1; i <= size(e); i = i + 1) { 1478 for(int i = size(e);i>=1;i--) 1479 { 1414 1480 f = f + e[i]; 1415 1481 } 1416 1482 return(f); 1417 1418 1483 } 1419 1484 … … 1430 1495 int max = data[1]; 1431 1496 1432 for(i = 1; i <= size(data); i = i + 1) { 1497 for(i = size(data); i>1;i--) 1498 { 1433 1499 if(data[i] > max) { max = data[i]; } 1434 1500 } … … 1452 1518 int min = data[1]; 1453 1519 1454 for(i = 1; i <= size(data); i = i + 1) { 1520 for(i = size(data);i>1; i--) 1521 { 1455 1522 if(data[i] < min) { min = data[i]; } 1456 1523 }
Note: See TracChangeset
for help on using the changeset viewer.