Changeset 8a58fa in git for libpolys


Ignore:
Timestamp:
Jun 10, 2022, 2:33:49 PM (23 months ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
e5347a518adabdab778b23f992a5d83d9cfde542
Parents:
d5f87688187dd104c5351832901927cfcc3a725a
Message:
add id_DelDiv_Sorted (for hilbert_series)
Location:
libpolys/polys
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • libpolys/polys/simpleideals.cc

    rd5f8768 r8a58fa  
    355355  int i, j;
    356356  int k = IDELEMS(id)-1;
    357   for (i=k-1; i>=0; i--)
    358   {
    359     if (id->m[i] != NULL)
    360     {
    361       for (j=k; j>i; j--)
    362       {
    363         if (id->m[j]!=NULL)
     357#ifdef HAVE_RINGS
     358  if (rField_is_Ring(r))
     359  {
     360    for (i=k-1; i>=0; i--)
     361    {
     362      if (id->m[i] != NULL)
     363      {
     364        for (j=k; j>i; j--)
    364365        {
    365 #ifdef HAVE_RINGS
    366           if (rField_is_Ring(r))
     366          if (id->m[j]!=NULL)
    367367          {
    368368            if (p_DivisibleByRingCase(id->m[i], id->m[j],r))
     
    376376            }
    377377          }
    378           else
     378        }
     379      }
     380    }
     381  }
     382  else
    379383#endif
     384  {
     385    /* the case of a coefficient field: */
     386    for (i=k-1; i>=0; i--)
     387    {
     388      if (id->m[i] != NULL)
     389      {
     390        for (j=k; j>i; j--)
     391        {
     392          if (id->m[j]!=NULL)
    380393          {
    381             /* the case of a coefficient field: */
    382394            if (p_DivisibleBy(id->m[i], id->m[j],r))
    383395            {
     
    389401              break;
    390402            }
     403          }
     404        }
     405      }
     406    }
     407  }
     408}
     409
     410/// delete id[j], if LT(j) == coeff*mon*LT(i) (j>i)
     411void id_DelDiv_Sorted(ideal id, const ring r)
     412{
     413  id_Test(id, r);
     414
     415  int i, j;
     416  int k = IDELEMS(id)-1;
     417  for (i=0; i<k; i++)
     418  {
     419    if (id->m[i] != NULL)
     420    {
     421      for (j=i+1; j<=k; j++)
     422      {
     423        if (id->m[j]!=NULL)
     424        {
     425          if (p_DivisibleBy(id->m[i], id->m[j],r))
     426          {
     427            p_Delete(&id->m[j],r);
     428            if (j==k) k--;
     429            while(id->m[k]==NULL) k--;
     430          }
     431          else if (p_DivisibleBy(id->m[j], id->m[i],r))
     432          {
     433            p_Delete(&id->m[i],r);
     434            break;
    391435          }
    392436        }
  • libpolys/polys/simpleideals.h

    rd5f8768 r8a58fa  
    110110void id_DelLmEquals(ideal id, const ring r);
    111111void id_DelDiv(ideal id, const ring r);
     112void id_DelDiv_Sorted(ideal id, const ring r);
    112113BOOLEAN id_IsConstant(ideal id, const ring r);
    113114
Note: See TracChangeset for help on using the changeset viewer.