Changeset facd12 in git


Ignore:
Timestamp:
Jun 19, 2007, 5:44:44 PM (17 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', '17f1d200f27c5bd38f5dfc6e8a0879242279d1d8')
Children:
f7aaec31bd73e9e5b3b2bd84ee5ff4fab2de4691
Parents:
6bdcaf53c26a95f7c01a3b87d3aa5dc9ac9640fa
Message:
*hannes: format


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

Legend:

Unmodified
Added
Removed
  • Singular/LIB/kskernel.lib

    r6bdcaf rfacd12  
    1 
    21////////////////////////////////////////////////////////////////
    32info="
     
    87
    98PROCEDURES:
    10  KSker(p,q);          kernel of the Kodaira-Spencer map of 
     9 KSker(p,q);          kernel of the Kodaira-Spencer map of
    1110                      a versal deformation of an irreducible
    12                       plane curve singularity 
     11                      plane curve singularity
    1312 KSconvert(M);        kernel of the Kodaira-Spencer map in
    14                       quasihomogeneous variables T with 
     13                      quasihomogeneous variables T with
    1514                      corresponding negative degrees
    16  KSlinear(M);         matrix of linear terms of the kernel of 
     15 KSlinear(M);         matrix of linear terms of the kernel of
    1716                      the Kodaira-Spencer map
    18  KScoef(i,j,P,Q,qq);  coefficient of the given term in the matrix 
     17 KScoef(i,j,P,Q,qq);  coefficient of the given term in the matrix
    1918                      of kernel of the Kodaira-Spencer map
    20  StringF(i,j,p,q);    expression in variables T(i) with non-resolved 
    21                       brackets for the further computation of 
    22                       coefficient in the matrix of kernel of the 
     19 StringF(i,j,p,q);    expression in variables T(i) with non-resolved
     20                      brackets for the further computation of
     21                      coefficient in the matrix of kernel of the
    2322                      Kodaira-Spencer map
    2423";
     24LIB "general.lib";
    2525////////////////////////////////////////////////////////////////
    2626
     
    3535  k=0;done=0;
    3636  for (i=t+1;i<nrows(M);i++)
    37   { 
    38     if (m>v[i])  { m=v[i];k=i;done=1; } 
    39   }
    40   if (done==1) 
    41   {   
    42     for (i=1;i<=3;i++)     
     37  {
     38    if (m>v[i])  { m=v[i];k=i;done=1; }
     39  }
     40  if (done==1)
     41  {
     42    for (i=1;i<=3;i++)
    4343    {
    4444      done=M[k,i];M[k,i]=M[t,i];M[t,i]=done;
     
    4646    i=v[k];v[k]=v[t];v[t]=i;
    4747  }
    48 return(M);
     48  return(M);
    4949}
    5050
    5151//---------------------------- sub procedure --------------------
    5252// sorts M by the third row, ascending
    53 proc sorter(intmat M) 
     53proc sorter(intmat M)
    5454{
    5555  intvec v;
     
    5757  for (i=1;i<=nrows(M);i++)
    5858  { v[i]=M[i,3]; }
    59   export (v); 
     59  export (v);
    6060  int n=1;
    6161  while (n<=nrows(M))
    62   { 
     62  {
    6363    M=minim(M,n);
    64     n++; 
     64    n++;
    6565  }
    6666  kill v;
     
    7070//---------------------------- sub procedure --------------------
    7171// M is a sorted matrix of triples {i,j,k(i,j)}
    72 // returns a list of coefficients of p 
     72// returns a list of coefficients of p
    7373// wrt. the base {x^i y^j,(i,j) in (M[i,j,k])}=B_u
    7474proc MonoDec(poly p, matrix M)
     
    8383  {
    8484    V=leadexp(q);
    85     while ( !((V[1]==M[k,1]) && (V[2]==M[k,2])) ) 
    86     {
    87       if (k>=nM) 
    88       { 
    89         print("error in monomial base");
    90         return(0);
     85    while ( !((V[1]==M[k,1]) && (V[2]==M[k,2])) )
     86    {
     87      if (k>=nM)
     88      {
     89        ERROR("error in monomial base");
     90        return(0);
    9191      }
    9292      k++;
    9393    }
    9494    VC=VC+leadcoef(q)*gen(k);
    95     q=q-lead(q); 
     95    q=q-lead(q);
    9696    k=1;
    9797  }
     
    101101
    102102//----------------------------- main program --------------------
    103 proc KSker (int p,q) 
     103proc KSker (int p,q)
    104104"USAGE:  KSker(int p,q); p,q relatively prime integers
    105105RETURN:  nothing; exports ring KSring, matrix KSkernel and list 'weights';
    106          KSkernel is a matrix of coefficients of the 
     106         KSkernel is a matrix of coefficients of the
    107107         generators of the kernel of Kodaira-Spencer map,
    108108         'weights' is a list of degrees for variables T
     
    110110"
    111111{
    112 option(redSB);
    113 option(redTail);
    114 int c;
    115 int i,j;
    116 int k=0;
    117 list LM;
    118 list tmp;
    119 for (i=0;i<=p-2;i++)
    120 
    121   for (j=0;j<=q-2;j++)
    122   {
    123     c=(i*q)+(j*p)-(p*q);
    124     if (c>0)
    125     {
    126       k++;
    127       tmp[1]=i;
    128       tmp[2]=j;
    129       tmp[3]=c; // index of T
    130       LM[k]=tmp;
    131       tmp=0;
    132     }
    133   }
    134 }
    135 if (k==0)
    136 {
    137   print("The kernel of the Kodaira-Spencer map equals zero");
    138   return();
    139 }
    140 if (k==1)
    141 {
    142   ring KSring=0,(T(1)),ws(c);
    143   matrix KSkernel[1][1]=c*T(1);
     112  option(redSB);
     113  option(redTail);
     114  int c;
     115  int i,j;
     116  int k=0;
     117  list LM;
     118  list tmp;
     119  for (i=0;i<=p-2;i++)
     120  {
     121    for (j=0;j<=q-2;j++)
     122    {
     123      c=(i*q)+(j*p)-(p*q);
     124      if (c>0)
     125      {
     126        k++;
     127        tmp[1]=i;
     128        tmp[2]=j;
     129        tmp[3]=c; // index of T
     130        LM[k]=tmp;
     131        tmp=0;
     132      }
     133    }
     134  }
     135  if (k==0)
     136  {
     137    "The kernel of the Kodaira-Spencer map equals zero";
     138    return();
     139  }
     140  if (k==1)
     141  {
     142    ring KSring=0,(T(1)),ws(c);
     143    matrix KSkernel[1][1]=c*T(1);
     144    export KSring;
     145    export KSkernel;
     146    return();
     147  }
     148  int cnt=k; // the total number of T's, now k>1
     149  intmat M[k][3]; // matrix with triples (i,j,k)
     150  for (i=1; i<=k; i++)
     151  {
     152    M[i,1] = LM[i][1];
     153    M[i,2] = LM[i][2];
     154    M[i,3] = LM[i][3];
     155  }
     156  kill LM;
     157  M = sorter(M); // now the third column of M contains ordered ascending values
     158  list weights;
     159  for (i=1; i<=k; i++)
     160  {
     161    weights[i] = M[i,3]; // positive weights for Ws ordering
     162    M[i,3]   = i;
     163  }
     164  export weights;
     165  ring RT=0,(x,y,T(1..k)),(Ws(q,p),dp);
     166  poly F=x^p+y^q;
     167  i=0;j=0;
     168  for (k=1;k<=cnt;k++)
     169  {
     170    i = M[k,1];
     171    j = M[k,2];
     172    F = F + T(k)*x^i*y^j;
     173  }
     174  ideal I = diff(F,x),diff(F,y);
     175  I = std(I);
     176  k=0;
     177  list normal;
     178  poly mul;
     179  for (i=0;i<=p-2;i++)
     180  {
     181    for (j=0;j<=q-2;j++)
     182    {
     183      c = p*q - ((i+2)*q+(j+2)*p);
     184      if ( c > 0 )
     185      {
     186        mul = x^i*y^j*p*q*F;
     187        k++;
     188        normal[k] = NF(mul,I);
     189      }
     190    }
     191  }
     192  // now we separate T's from (x,y) by treating T's as parameters
     193  ring ST=(0,T(1..k)),(x,y),Ws(q,p);
     194  setring ST;
     195  list Snormal = imap(RT,normal);
     196  ideal SI = imap(RT,I);
     197  kill RT;
     198  SI = std(SI);
     199  module L;
     200  for (i=1; i<=size(Snormal); i++)
     201  {
     202    Snormal[i] = NF(Snormal[i],SI);
     203    L[i] = MonoDec(Snormal[i],M);
     204    if (L[i]==0) // MonoDec has detected non-basis element
     205    {
     206      "Try reducing the input";
     207      return(0);
     208    }
     209  }
     210  // now L is a module in T's
     211  ring KSring=0,(T(1..k)),(C,ws(-weights[1..k]));
     212  module TL=imap(ST,L);
     213  kill ST;
     214  // sort it descendently
     215  TL = sort(TL)[1];
     216  // make the coefficients positive
     217  if ((leadcoef(TL[1,1])<0) || (leadcoef(TL[k,k])<0)) { TL = -TL;}
     218  matrix KSkernel=matrix(TL);
    144219  export KSring;
    145220  export KSkernel;
     221  kill M;
    146222  return();
    147 }
    148 LIB "general.lib";
    149 int cnt=k; // the total number of T's, now k>1
    150 intmat M[k][3]; // matrix with triples (i,j,k)
    151 for (i=1; i<=k; i++)
    152 {
    153   M[i,1] = LM[i][1];
    154   M[i,2] = LM[i][2];
    155   M[i,3] = LM[i][3];
    156 }
    157 kill LM;
    158 M = sorter(M); // now the third column of M contains ordered ascending values
    159 list weights;
    160 for (i=1; i<=k; i++)
    161 {
    162   weights[i] = M[i,3]; // positive weights for Ws ordering
    163   M[i,3]   = i;
    164 }
    165 export weights;
    166 ring RT=0,(x,y,T(1..k)),(Ws(q,p),dp);
    167 poly F=x^p+y^q;
    168 i=0;j=0;
    169 for (k=1;k<=cnt;k++)
    170 {
    171   i = M[k,1];
    172   j = M[k,2];
    173   F = F + T(k)*x^i*y^j;
    174 }     
    175 ideal I = diff(F,x),diff(F,y);
    176 I = std(I);
    177 k=0;
    178 list normal;
    179 poly mul;
    180 for (i=0;i<=p-2;i++)
    181 
    182   for (j=0;j<=q-2;j++)
    183   {
    184     c = p*q - ((i+2)*q+(j+2)*p);
    185     if ( c > 0 )
    186     {
    187       mul = x^i*y^j*p*q*F;
    188       k++;
    189       normal[k] = NF(mul,I);
    190     }
    191   }
    192 }
    193 // now we separate T's from (x,y) by treating T's as parameters
    194 ring ST=(0,T(1..k)),(x,y),Ws(q,p);
    195 setring ST;
    196 list Snormal = imap(RT,normal);
    197 ideal SI = imap(RT,I);
    198 kill RT;
    199 SI = std(SI);
    200 module L;
    201 for (i=1; i<=size(Snormal); i++)
    202 {
    203   Snormal[i] = NF(Snormal[i],SI);
    204   L[i] = MonoDec(Snormal[i],M);
    205   if (L[i]==0) // MonoDec has detected non-basis element
    206   {
    207     print("Try reducing the input");
    208     return(0);
    209   }
    210 }
    211 // now L is a module in T's
    212 ring KSring=0,(T(1..k)),(C,ws(-weights[1..k]));
    213 module TL=imap(ST,L);
    214 kill ST;
    215 // sort it descendently
    216 TL = sort(TL)[1];
    217 // make the coefficients positive
    218 if ((leadcoef(TL[1,1])<0) || (leadcoef(TL[k,k])<0)) { TL = -TL;}
    219 matrix KSkernel=matrix(TL);
    220 export KSring;
    221 export KSkernel;
    222 kill M;
    223 return();
    224223}
    225224example
    226225{ "EXAMPLE:"; echo=2;
    227226   int p=6;
    228    int q=7; 
     227   int q=7;
    229228   KSker(p,q);
    230229   setring KSring;
     
    236235// need global variable "weights"
    237236proc KSconvert(matrix M)
    238 "USAGE:  KSconvert(matrix M); 
    239          M is a matrix of coefficients of the generators of 
    240          the kernel of Kodaira-Spencer map in variables T(i) 
    241          from the basering. To be called after the procedure 
     237"USAGE:  KSconvert(matrix M);
     238         M is a matrix of coefficients of the generators of
     239         the kernel of Kodaira-Spencer map in variables T(i)
     240         from the basering. To be called after the procedure
    242241         KSker(p,q)
    243 RETURN:  nothing; exports ring KSring2 and matrix KSkernel2 within it, 
     242RETURN:  nothing; exports ring KSring2 and matrix KSkernel2 within it,
    244243         such that KSring2 resp. KSkernel2 are in variables
    245244         T(w) with weights -w. These weights are computed
     
    278277{ "EXAMPLE:"; echo=2;
    279278   int p=6;
    280    int q=7; 
     279   int q=7;
    281280   KSker(p,q);
    282281   setring KSring;
    283282   KSconvert(KSkernel);
    284283   setring KSring2;
    285    print(KSkernel2);   
     284   print(KSkernel2);
    286285}
    287286
    288287proc KSlinear(matrix M)
    289 "USAGE:  KSlinear(matrix M); 
    290          computes matrix of linear terms of the kernel of the 
    291          Kodaira-Spencer map. To be called after the procedure 
     288"USAGE:  KSlinear(matrix M);
     289         computes matrix of linear terms of the kernel of the
     290         Kodaira-Spencer map. To be called after the procedure
    292291         KSker(p,q)
    293 RETURN:  nothing; but replaces elements of the matrix KSkernel 
     292RETURN:  nothing; but replaces elements of the matrix KSkernel
    294293         in the ring Ksring with their leading monomials
    295294         wrt. the local ordering (ls)
     
    315314{ "EXAMPLE:"; echo=2;
    316315   int p=6;
    317    int q=7; 
     316   int q=7;
    318317   KSker(p,q);
    319318   setring KSring;
    320319   KSlinear(KSkernel);
    321    print(KSkernel);   
     320   print(KSkernel);
    322321}
    323322
     
    327326proc seq(int p,q)
    328327// computes u,v such that 1<=u<=p-1, qu=1(mod p)
    329 //                        1<=v<=q-1, pv=1(mod q)   
     328//                        1<=v<=q-1, pv=1(mod q)
    330329{
    331330  int u=1;  int v=1;
     
    333332  {
    334333    if (((q*u)%p)==1) {break;}
    335    } 
     334   }
    336335  for(v=1; v<=q-1; v++)
    337336  {
     
    347346  int result=0;
    348347  int s=size(u);
    349   int w=s; 
    350   if (s==0) { "size of list is 0"; return(result); } 
     348  int w=s;
     349  if (s==0) { "size of list is 0"; return(result); }
    351350  if (b<0 ) { "negative b in MIX"; return(result); }
    352351  while ((w>1) && (u[w]>b)) { w--;} // min w=1
    353   if (w>1) 
    354   { 
    355     return(w); 
     352  if (w>1)
     353  {
     354    return(w);
    356355  }
    357356  else // w<=1
    358357  {
    359     if ( (w==1) && (u[w]> b) ) 
    360     { 
    361       w=0; 
     358    if ( (w==1) && (u[w]> b) )
     359    {
     360      w=0;
    362361      return(w);
    363     } 
     362    }
    364363  }
    365364  return(w);
     
    369368proc bracket(int r, int s)
    370369{
    371   int b=s-r; 
     370  int b=s-r;
    372371  int q;
    373372  int k=1;
     
    375374  F=F+"*(";
    376375  while (b>0) // simulate repeat ... until b==0
    377   { 
     376  {
    378377    q=mix(b,u);
    379378    while (q>0)
     
    382381      if (u[q]==(s-r))   // adding T's of max degree
    383382      {
    384         F=F+"T("+ string(q) +")"+ "+";
    385       }
    386       else 
    387       { 
    388         if (S[(1+r+u[q])]!="u")
     383        F=F+"T("+ string(q) +")"+ "+";
     384      }
     385      else
     386      {
     387        if (S[(1+r+u[q])]!="u")
    389388        {
    390           F=F+"T("+ string(q) +")";
    391           bracket(r+u[q],s);
     389          F=F+"T("+ string(q) +")";
     390          bracket(r+u[q],s);
    392391         }
    393392      }
     
    395394      if (q==0) {b=0;}
    396395    } // end  while q>0
    397     SF=size(F); 
    398     if (F[SF]!="+") 
    399     { 
     396    SF=size(F);
     397    if (F[SF]!="+")
     398    {
    400399      if (SF<=2) { F="";}
    401400      else { F=F[1..SF-2];}
     
    422421  {
    423422    e=(e+a)%p; e1=(e1+b)%q;
    424     if ( (e==(p-1)) || (e1==(q-1)) ) { S=S+" "; } 
     423    if ( (e==(p-1)) || (e1==(q-1)) ) { S=S+" "; }
    425424    else
    426425    {
     
    434433      }
    435434    }
    436   } 
     435  }
    437436  export S;
    438437  export u;
     
    443442proc StringF(int i, int j,int p, int q)
    444443"USAGE:  StringF(int i,j,p,q);
    445 RETURN:  nothing; exports string F which contains an expression 
    446          in variables T(i) with non-resolved brackets 
     444RETURN:  nothing; exports string F which contains an expression
     445         in variables T(i) with non-resolved brackets
    447446EXAMPLE: example StringF; shows an example
    448447"
     
    497496    t  = u[(qq[k])];
    498497    if (e>=(P-1))
    499     { 
     498    {
    500499      aux = (U*t)%P;
    501500      aux = aux/P;
     
    506505      if (e1>=(Q-1))
    507506      {
    508         aux = (V*t)%Q;
    509         aux = aux/Q;
    510         C = C*aux;
     507        aux = (V*t)%Q;
     508        aux = aux/Q;
     509        C = C*aux;
    511510      }
    512511    }
     
    531530 c; // it is a coefficient of T1*T2*T3^2 in C[2,9] for x^5+y^14
    532531}
    533 
    534 
    535 
Note: See TracChangeset for help on using the changeset viewer.