Changeset c13ff56 in git


Ignore:
Timestamp:
Apr 14, 2009, 10:36:17 AM (14 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
Children:
b8973d758f37286564ab8fb1f67367ac731674c7
Parents:
3402b4b654df40779dd0b3d83c4d023a3ef93e0b
Message:
*hannes: format


git-svn-id: file:///usr/local/Singular/svn/trunk@11686 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/LIB/qhmoduli.lib

    r3402b4b rc13ff56  
    11///////////////////////////////////////////////////////////////////////////////
    2 version="$Id: qhmoduli.lib,v 1.14 2009-04-08 14:08:25 Singular Exp $";
     2version="$Id: qhmoduli.lib,v 1.15 2009-04-14 08:36:17 Singular Exp $";
    33category="Singularities";
    44info="
     
    492492  Variables = StabVar(wt);    // possible quasihomogeneous substitutions
    493493  nrVars = 0;
    494   for(i = 1; i <= size(wt); i = i + 1) {
     494  for(i = 1; i <= size(wt); i++)
     495  {
    495496    nrVars = nrVars + size(Variables[i]);
    496497  }
     
    499500
    500501  varString = "s(1.." + string(nrVars) + ")";
    501   if(npars(basering) == 1) {
     502  if(npars(basering) == 1)
     503  {
    502504    parString = "(0, " + parstr(basering) + ")";
    503505  }
     
    527529  nrVars = 0;
    528530  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) -> ...
    530533    if(i > 1) { offset = offset + size(Variables[i - 1]); }
    531534    g = 0;
    532     for(j = 1; j <= size(Variables[i]); j = j + 1) {
     535    for(j = 1; j <= size(Variables[i]); j++)
     536    {
    533537      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      {
    535540        pp = pp * var(Variables[i][j][k]);
    536541        if(Variables[i][j][k] == i) { varSubsList[i] = offset + j;}
     
    562567  coMx = coef(f, vars);          // coefficients of f
    563568
    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.
    565571    j = 1;
    566572    h = 0;
    567     while(j <= ncols(coMx)) {        // all monomials in f
     573    while(j <= ncols(coMx))
     574    {        // all monomials in f
    568575      if(coMx[j][1] == newcoMx[i][1]) { h = coMx[j][2]; j = ncols(coMx) + 1;}
    569576      else {j = j + 1;}
     
    662669  jacobIdstd = std(jacobianId);
    663670  newFs = Fs;
    664   for(i = 1; i <= size(B); i = i + 1) {
     671  for(i = 1; i <= size(B); i++)
     672  {
    665673    basisDegList[i] = deg(B[i], wt);
    666674  }
     
    671679  d = deg(f, wt);
    672680
    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
    674683    upperBasis[i] = SelectMonos(list(B, B), wt, i);    // B must not contain 0's
    675684  }
     
    679688  // it into newFs
    680689
    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
    682692    dbprint(dbPrt, "-- degree = " + string(i) + " of " + string(ub - 1) + " ---------------------------");
    683693    if(size(newFs) < 80) { dbprint(dbPrt, "  polynomial = " + string(newFs - f));}
     
    688698    gmonos = SelectMonos(parts, wt, i);
    689699    common = IntersectionQHM(upperBasis[i][1], gmonos[1]);
    690     if(size(common) == size(gmonos[1])) {
     700    if(size(common) == size(gmonos[1]))
     701    {
    691702      dbprint(dbPrt, " no additional monomials ");
    692703    }
     
    696707    // write g = c[i] * jacobianId[i]
    697708
    698     else {
     709    else
     710    {
    699711      dbprint(dbPrt, "  additional Monomials found, compute the map ");
    700712      g = PSum(gmonos[2]);      // sum of all monomials in g of degree i
     
    704716      gCoeffMx = lift(jacobianId, g - gred);    // compute c[i]
    705717      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      {
    707720        mapId[j] = var(j) - gCoeffMx[1][j];
    708721      }
     
    736749  data = jet(f, ub - 1, wt);
    737750  k = 0;
    738   for(i = 1; i <= size(data); i = i + 1) {
     751  for(i = 1; i <= size(data); i++)
     752  {
    739753    mono = lead(data[i]);
    740     if(deg(mono, wt) < ub) {
     754    if(deg(mono, wt) < ub)
     755    {
    741756      k = k + 1;
    742757      lcInv = 1/leadcoef(mono);
     
    771786
    772787  k = 0;
    773   for(i = 1; i <= size(parts[1]); i = i + 1) {
     788  for(i = 1; i <= size(parts[1]); i++)
     789  {
    774790    mono = parts[1][i];
    775     if(deg(mono, wt) == d) {
    776       k = k + 1;
     791    if(deg(mono, wt) == d)
     792    {
     793      k++;
    777794      monomials[k] = mono;
    778795      terms[k] = parts[2][i];
     
    810827  // compute substitution[1]^degVec[1],...,subs[n]^degVec[n]
    811828
    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    {
    814833      powerList[i] = reduce(substitution[i]^degVec[i], reduceI); // new
    815834    }  // directly for small exponents
    816     else {
     835    else
     836    {
    817837      powerList[i] = PolyPower1(i, substitution[i], degVec[i], reduceI, w1, truncated[i], ub);
    818838    }
     
    821841  g = powerList[1];
    822842  minDeg = w1[1] * degVec[1];
    823   for(i = 2; i <= ncols(substitution); i = i + 1) {
     843  for(i = 2; i <= ncols(substitution); i++)
     844  {
    824845    g = jet(g, ub - w1[i] * degVec[i] - 1, w1);
    825846    h = jet(powerList[i], ub - minDeg - 1, w1);
     
    842863"
    843864{
    844   int SUBSMAXSIZE = 3000;    //
     865  int SUBSMAXSIZE = 3000;
    845866  int i, nrParts, sizeOfPart, currentPos, partSize, maxSIZE;
    846867  poly g, h, gxh, prodComp, @g2;    // replace @g2 by subst.
     
    849870  h = h1;
    850871
    851   if(size(g)*size(h) > SUBSMAXSIZE) {
    852 
     872  if(size(g)*size(h) > SUBSMAXSIZE)
     873  {
    853874    // divide the polynomials with more terms in parts s.t.
    854875    // the product of each part with the other polynomial
     
    861882    partSize = size(g) / nrParts;
    862883    gxh = 0;  // 'g times h'
    863     for(i = 1; i <= nrParts; i = i + 1){
     884    for(i = 1; i <= nrParts; i++)
     885    {
    864886      //print(" loop #" + string(i) + " of " + string(nrParts));
    865887      currentPos = (i - 1) * partSize;
     
    870892      if(size(@g2) < size(prodComp)) { print(" killed " + string(size(prodComp) - size(@g2)) + " terms ");}
    871893      gxh =  reduce(gxh + @g2, reduceI);
    872 
    873     }
    874   }
    875   else {
     894    }
     895  }
     896  else
     897  {
    876898    gxh = reduce(jet(g * h,ub - 1, wt), reduceI);
    877899  }  // compute directly
     
    898920  if(e == 1) { return(f);}
    899921  if(f == 0) { return(1); }
    900   else {
    901 
     922  else
     923  {
    902924    // test if f has been computed to some power
    903 
    904     if(computedPowers[varIndex][1] > 0) {
     925    if(computedPowers[varIndex][1] > 0)
     926    {
    905927      maxPrecomputedPower = computedPowers[varIndex][1];
    906       if(maxPrecomputedPower >= e) {
     928      if(maxPrecomputedPower >= e)
     929      {
    907930        // no computation necessary, f^e has already benn computed
    908931        g = computedPowers[varIndex][2][e - 1];
     
    916939      }
    917940    }
    918     else {    // no precomputed data
     941    else
     942    {    // no precomputed data
    919943      lb = 2;
    920944      ordOfg = wt[varIndex];
    921945      g = f;
    922946    }
    923     for(i = lb; i <= e; i = i + 1) {
     947    for(i = lb; i <= e; i++)
     948    {
    924949      fn = jet(f, ub - ordOfg - 1, wt); // reduce w.r.t. reduceI
    925950      g = PolyProduct(g, fn, reduceI, wt, ub);
    926951      ordOfg = ordOfg + wt[varIndex];
    927952      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
    930957          computedPowers[varIndex] = list(i, list(g));
    931958        }
     
    946973  list temp;
    947974
    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])); }
    949976  return(temp);
    950977}
     
    9761003
    9771004  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  {
    9791007    coeffList[i] = parts[2][i]/parts[1][i];
    9801008    degVecList[i] = leadexp(parts[1][i]);
     
    9881016
    9891017  @ringVars = "(" + varstr(basering) + ", " + parstr(1) + ",";  // precondition
    990   if(nrs > 0) {
     1018  if(nrs > 0)
     1019  {
    9911020    @ringVars = @ringVars + "s(1.." + string(nrs) + "), ";
    9921021  }
     
    10131042  f = imap(RASB, f);
    10141043
    1015   for(i = 1; i <= n; i = i + 1) {      // all "base" variables
     1044  for(i = 1; i <= n; i++)
     1045  {      // all "base" variables
    10161046    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);}
    10181048    degOfSubs[i] = degList;
    10191049  }
     
    10221052
    10231053  g = 0;
    1024   for(i = 1; i <= size(degVecList); i = i + 1) {
     1054  for(i = 1; i <= size(degVecList); i++)
     1055  {
    10251056    truncatedQ = Table("0", "i", 1, n);
    10261057    newSubs = 0;
     
    10331064    // where m' is the monomial m without the j-th variable
    10341065
    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    {
    10381070      subsPoly = 0;      // set substitution to 0
    1039       if(degVec[j] > 0) {
    1040 
     1071      if(degVec[j] > 0)
     1072      {
    10411073        // if variable occurs then check if
    10421074        // substitution[j][k] * (linear part)^(degVec[j]-1) + minDeg[j] < ub
     
    10471079        // to the result and cannot be omitted
    10481080
    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          {
    10511085            subsPoly = subsPoly + substitution[j][k];
    10521086          }
     
    10841118
    10851119  varList = StabVarComb(wt);
    1086   for(i = 1; i <= size(wt); i = i + 1) {
     1120  for(i = 1; i <= size(wt); i = i + 1)
     1121  {
    10871122    subs = 0;
    1088 
    10891123    // 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    {
    10911126      subs[j] = list(i) + list(varList[1][i][j]);
    10921127    }
    10931128    Variables[i] = subs;
    1094     if(size(varList[2][i]) > 0) {
    1095 
     1129    if(size(varList[2][i]) > 0)
     1130    {
    10961131      // built nonlinear substituitons
    10971132      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      {
    10991135        subs[j] = list(i) + varList[2][i][j];
    11001136      }
     
    11161152"
    11171153{
    1118   int mi, ma, i, j, k, uw, ic;
     1154  int mmi, mma, ii, j, k, uw, ic;
    11191155  list index, indices, usedWeights, combList, combinations;
    11201156  list linearSubs, nonlinearSubs;
     
    11261162  uw = 0;
    11271163  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
    11331171      k = 0;
    11341172      index = 0;
    11351173      // 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++;
    11391179          index[k] = j;
    11401180        }
    11411181      }
    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;
    11461186
    11471187      // linear part of the substitution
    11481188
    1149       for(j = 1; j <= size(index); j = j + 1) {
     1189      for(j = 1; j <= size(index); j++)
     1190      {
    11501191        linearSubs[index[j]] = index;
    11511192      }
     
    11531194      // nonlinear part of the substitution
    11541195
    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        }
    11601208      }
    1161       for(j = 1; j <= size(index); j = j + 1) {
    1162         nonlinearSubs[index[j]] = FlattenQHM(combinations);   // flatten one level !
    1163       }
    1164 
    1165       } // end if
    1166 
    11671209    }
    11681210  }
     
    11891231  ok = 1;
    11901232  m = partition[1];
    1191   while(ok) {
    1192     if(i > size(partition)) {
     1233  while(ok)
     1234  {
     1235    if(i > size(partition))
     1236    {
    11931237      ok = 0;
    11941238      p = 0;
     
    11961240    else { p = partition[i];}
    11971241    if(p == m) { i = i + 1;}
    1198     else {
     1242    else
     1243    {
    11991244      k = k + 1;
    12001245      nrList[k] = i - 1 - offset;
     
    12181263  list comb, newC, temp, newIndex;
    12191264
    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    {
    12221269      temp = index[i];
    12231270      comb[i] = temp;
     
    12251272    return(comb);
    12261273  }
    1227   if(size(index) == 1) {
     1274  if(size(index) == 1)
     1275  {
    12281276    temp = Table(string(index[1]), "i", 1, n);
    12291277    comb[1] = temp;
     
    12311279  }
    12321280  newIndex = index;
    1233   for(i = 1; i <= size(index); i = i + 1) {
     1281  for(i = 1; i <= size(index); i = i + 1)
     1282  {
    12341283    if(i > 1) { newIndex = delete(newIndex, 1); }
    12351284    newC = AllSingleCombinations(n - 1, newIndex);
    12361285    k = size(comb);
    12371286    temp = 0;
    1238     for(j = 1; j <= size(newC); j = j + 1) {
     1287    for(j = 1; j <= size(newC); j++)
     1288    {
    12391289      temp[1] = index[i];
    12401290      temp = temp + newC[j];
     
    12631313
    12641314  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    {
    12671319      k = size(comb);
    1268       for(j = 1; j <= size(restC); j = j + 1) {
     1320      for(j = 1; j <= size(restC); j++)
     1321      {
    12691322        //elem = firstC[i] + restC[j];
    12701323        // comb[k + j] = elem;
     
    12881341
    12891342  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    {
    12921347      parts[1] = Table(string(nr[1]), "i", 1, NumFactor(nr[1], n));
    12931348    }
    12941349    return(parts);
    12951350  }
    1296   else {
     1351  else
     1352  {
    12971353    parts =  Partitions(n, nr[1]);
    12981354    restP = Partitions(n, delete(nr, 1));
    12991355
    13001356    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    {
    13021359      temp = Table(string(nr[1]), "i", 1, i);
    13031360      decP = Partitions(n - i*nr[1], delete(nr, 1));
    13041361      k = size(parts);
    1305       for(j = 1; j <= size(decP); j = j + 1) {
     1362      for(j = 1; j <= size(decP); j++)
     1363      {
    13061364        newP = temp + decP[j];        // new partition
    1307         if(!ContainedQ(parts, newP, 1)) {
     1365        if(!ContainedQ(parts, newP, 1))
     1366        {
    13081367          k = k + 1;
    13091368          parts[k] = newP;
     
    13391398  execute("int " + iterator + ";");
    13401399
    1341   for(int @i = lb; @i <= ub; @i++) {
     1400  for(int @i = lb; @i <= ub; @i++)
     1401  {
    13421402    execute(iterator + " = " + string(@i));
    13431403    execute("data[" + string(@i) + "] = " + cmd + ";");
     
    13591419  c = 1;
    13601420
    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    {
    13631425      fList[c] = data[i][j];
    13641426      c = c + 1;
     
    13791441  c = 1;
    13801442
    1381   for(int i = 1; i <= size(l1); i = i + 1) {
     1443  for(int i = 1; i <= size(l1); i++)
     1444  {
    13821445    b = ContainedQ(l2, l1[i]);
    1383     if(b == 1) {
     1446    if(b == 1)
     1447    {
    13841448      l[c] = l1[i];
    1385       c = c + 1;
     1449      c++;
    13861450    }
    13871451  }
     
    13991463  i = 0;
    14001464  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;}
    14041469  }
    14051470  return(pos);
     
    14111476{
    14121477  poly f;
    1413   for(int i = 1; i <= size(e); i = i + 1) {
     1478  for(int i = size(e);i>=1;i--)
     1479  {
    14141480    f = f + e[i];
    14151481  }
    14161482  return(f);
    1417 
    14181483}
    14191484
     
    14301495  int max = data[1];
    14311496
    1432   for(i = 1; i <= size(data); i = i + 1) {
     1497  for(i = size(data); i>1;i--)
     1498  {
    14331499    if(data[i] > max) { max = data[i]; }
    14341500  }
     
    14521518  int min = data[1];
    14531519
    1454   for(i = 1; i <= size(data); i = i + 1) {
     1520  for(i = size(data);i>1; i--)
     1521  {
    14551522    if(data[i] < min) { min = data[i]; }
    14561523  }
Note: See TracChangeset for help on using the changeset viewer.