Changeset 513673 in git for Singular/LIB/realclassify.lib


Ignore:
Timestamp:
Oct 15, 2013, 3:15:25 PM (11 years ago)
Author:
Andreas Steenpass <steenpass@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
3630419158783d9329a9e0d3d501208a60c71b10
Parents:
c21a6b6ea8d600f0dee5b13cbb0c042d2fe7e574
git-author:
Andreas Steenpass <steenpass@mathematik.uni-kl.de>2013-10-15 15:15:25+02:00
git-committer:
Andreas Steenpass <steenpass@mathematik.uni-kl.de>2013-10-15 15:19:17+02:00
Message:
chg: update realclassify.lib

The implementation of the splitting lemma has been changed.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/LIB/realclassify.lib

    rc21a6b r513673  
    2828";
    2929
     30LIB "linalg.lib";
    3031LIB "elim.lib";
    3132LIB "primdec.lib";
     
    475476USAGE:    realmorsesplit(f[, mu]); f poly, mu int
    476477RETURN:   a list consisting of the corank of f, the inertia index, an upper
    477           bound for the determinacy, the residual form of f and
    478           the transformation
     478          bound for the determinacy, and the residual form of f
    479479NOTE:     The characteristic of the basering must be zero, the monomial order
    480480          must be local, f must be contained in maxideal(2) and the Milnor
     
    486486EXAMPLE:  example morsesplit; shows an example"
    487487{
    488   /* auxiliary variables */
    489   int i, j;
     488  int i;
    490489
    491490  /* error check */
     
    532531  }
    533532
    534   /* preliminary stuff */
    535   list S;
     533  /* compute the determinacy */
    536534  int k = determinacy(f, mu);
    537535  f = jet(f, k);
    538   def br = basering;
    539   map Phi = br, maxideal(1);
    540   map phi;
    541   poly a, p, r;
    542 
    543   /* treat the variables one by one */
     536
     537  /* get jet(f, 2) right */
     538  matrix H = concat(jet(jacob(jacob(f)), 0)/2, unitmat(n));
     539  H = sym_reduce(H);
     540  intvec perm_zero;
     541  intvec perm_neg;
     542  intvec perm_pos;
     543  int c;
     544  int lambda;
    544545  for(i = 1; i <= n; i++)
    545546  {
    546     if(jet(f, 2)/var(i) == 0)
    547     {
    548       S = insert(S, i);
    549     }
    550     else
    551     {
    552       f, a, p, r = rewriteformorsesplit(f, k, i);
    553       if(jet(a, 0) == 0)
    554       {
    555         for(j = i+1; j <= n; j++)
    556         {
    557           if(jet(f, 2)/(var(i)*var(j)) != 0)
    558           {
    559             break;
    560           }
    561         }
    562         phi = br, maxideal(1);
    563         phi[j] = var(j)+var(i);
    564         Phi = phi(Phi);
    565         f = phi(f);
    566       }
    567       f, a, p, r = rewriteformorsesplit(f, k, i);
    568       while(p != 0)
    569       {
    570         phi = br, maxideal(1);
    571         phi[i] = var(i)-p/(2*jet(a, 0));
    572         Phi = phi(Phi);
    573         f = phi(f);
    574         f, a, p, r = rewriteformorsesplit(f, k, i);
    575       }
    576     }
    577   }
    578 
    579   /* sort variables according to corank */
    580   int cr = size(S);
    581   phi = br, 0:n;
    582   j = 1;
    583   for(i = size(S); i > 0; i--)
    584   {
    585     phi[S[i]] = var(j);
    586     j++;
    587   }
     547    if(H[i, i] == 0)
     548    {
     549      perm_zero = perm_zero, i;
     550      c++;
     551    }
     552    if(H[i, i] < 0)
     553    {
     554      perm_neg = perm_neg, i;
     555      lambda++;
     556    }
     557    if(H[i, i] > 0)
     558    {
     559      perm_pos = perm_pos, i;
     560    }
     561  }
     562  intvec perm;
     563  if(size(perm_zero) > 1)
     564  {
     565    perm = perm, perm_zero[2..size(perm_zero)];
     566  }
     567  if(size(perm_neg) > 1)
     568  {
     569    perm = perm, perm_neg[2..size(perm_neg)];
     570  }
     571  if(size(perm_pos) > 1)
     572  {
     573    perm = perm, perm_pos[2..size(perm_pos)];
     574  }
     575  perm = perm[2..size(perm)];
     576  matrix T[n][n];
     577  matrix D[1][n];
    588578  for(i = 1; i <= n; i++)
    589579  {
    590     if(phi[i] == 0)
    591     {
    592       phi[i] = var(j);
    593       j++;
    594     }
    595   }
    596   Phi = phi(Phi);
     580    T[1..n, i] = H[perm[i], (n+1)..(2*n)];
     581    D[1, i] = H[perm[i], perm[i]];
     582  }
     583  map phi = basering, matrix(maxideal(1))*transpose(T);
    597584  f = phi(f);
    598 
    599   /* compute the inertia index lambda */
    600   int lambda;
    601   list negCoeff, posCoeff;
    602   number ai;
    603   poly f2 = jet(f, 2);
    604   for(i = 1; i <= n; i++)
    605   {
    606     ai = number(f2/var(i)^2);
    607     if(ai < 0)
    608     {
    609       lambda++;
    610       negCoeff = insert(negCoeff, i);
    611     }
    612     if(ai > 0)
    613     {
    614       posCoeff = insert(posCoeff, i);
    615     }
    616   }
    617 
    618   /* sort variables according to lambda */
    619   phi = br, maxideal(1);
    620   j = cr+1;
    621   for(i = size(negCoeff); i > 0; i--)
    622   {
    623     phi[negCoeff[i]] = var(j);
    624     j++;
    625   }
    626   for(i = size(posCoeff); i > 0; i--)
    627   {
    628     phi[posCoeff[i]] = var(j);
    629     j++;
    630   }
    631   Phi = phi(Phi);
    632   f = phi(f);
    633 
    634   /* compute residual form */
    635   phi = br, maxideal(1);
    636   for(i = size(S)+1; i <= n; i++)
    637   {
    638     phi[i] = 0;
    639   }
    640   f = phi(f);
    641 
    642   return(list(cr, lambda, k, f, Phi));
     585  f = jet(f, k);
     586
     587  /* separate the variables */
     588  phi = basering, maxideal(1);
     589  map corank_part = basering, maxideal(1);
     590  for(i = c+1; i <= n; i++)
     591  {
     592    corank_part[i] = 0;
     593  }
     594  poly h = f-jet(f, 2)-corank_part(f);
     595  poly hi;
     596  while(h != 0)
     597  {
     598    for(i = c+1; i <= n; i++)
     599    {
     600      hi = h/var(i);
     601      phi[i] = var(i)-hi/(2*D[1, i]);
     602      h = h-hi*var(i);
     603    }
     604    f = phi(f);
     605    f = jet(f, k);
     606    h = f-jet(f, 2)-corank_part(f);
     607  }
     608  poly g = cleardenom(f-jet(f, 2));
     609
     610  return(list(c, lambda, k, g));
    643611}
    644612example
     
    649617  poly f = (x2+3y-2z)^2+xyz-(x-y3+x2z3)^3;
    650618  realmorsesplit(f);
     619}
     620
     621///////////////////////////////////////////////////////////////////////////////
     622/*
     623   symmetric Gauss algorithm
     624
     625   If A is not a square matrix, then the largest upper or left submatrix
     626   is assumed to be symmetric.
     627*/
     628proc sym_reduce(matrix A)
     629{
     630  int r = nrows(A);
     631  int c = ncols(A);
     632  int n = r;
     633  if(n > c)
     634  {
     635    n = c;
     636  }
     637  poly q;
     638  int i, j;
     639  for(i = 1; i <= n; i++)
     640  {
     641    for(j = i+1; j <= n; j++)
     642    {
     643      if(A[i, j] != 0)
     644      {
     645        while(A[i, i] == 0)
     646        {
     647          A[1..r, i] = A[1..r, i]+A[1..r, j];
     648          A[i, 1..c] = A[i, 1..c]+A[j, 1..c];
     649        }
     650        q = A[i, j]/A[i, i];
     651        A[1..r, j] = A[1..r, j]-q*A[1..r, i];
     652        A[j, 1..c] = A[j, 1..c]-q*A[i, 1..c];
     653      }
     654    }
     655  }
     656  return(A);
    651657}
    652658
Note: See TracChangeset for help on using the changeset viewer.