Changeset fe115e in git


Ignore:
Timestamp:
Jul 27, 2018, 4:53:52 PM (5 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
Children:
82000a0806cbcd483e007cfcb21cafe00c300866
Parents:
67b0ec85dfdf4ff933fe777f3cd375cf40e22563
Message:
extend coef(I,m) to ideal I
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • Singular/iparith.cc

    r67b0ec rfe115e  
    17951795  if ((p==NULL)||(pNext(p)!=NULL)) return TRUE;
    17961796  res->data=(char *)mp_CoeffProc((poly)u->Data(),p /*(poly)v->Data()*/,currRing);
     1797  return FALSE;
     1798}
     1799static BOOLEAN jjCOEF_Id(leftv res, leftv u, leftv v)
     1800{
     1801  poly p=(poly)v->Data();
     1802  if ((p==NULL)||(pNext(p)!=NULL)) return TRUE;
     1803  res->data=(char *)mp_CoeffProcId((ideal)u->Data(),p /*(poly)v->Data()*/,currRing);
    17971804  return FALSE;
    17981805}
  • Singular/table.h

    r67b0ec rfe115e  
    600600#endif
    601601,{D(jjCOEF),      COEF_CMD,       MATRIX_CMD,     POLY_CMD,   POLY_CMD, ALLOW_NC |ALLOW_RING}
     602,{D(jjCOEF_Id),   COEF_CMD,       MATRIX_CMD,     IDEAL_CMD,  POLY_CMD, ALLOW_NC |ALLOW_RING}
    602603,{D(jjCOEFFS_Id), COEFFS_CMD,     MATRIX_CMD,     IDEAL_CMD,  POLY_CMD, ALLOW_NC |ALLOW_RING}
    603604,{D(jjCOEFFS_Id), COEFFS_CMD,     MATRIX_CMD,     MODUL_CMD,  POLY_CMD, ALLOW_NC |ALLOW_RING}
  • libpolys/polys/matpol.cc

    r67b0ec rfe115e  
    3232static poly mp_Exdiv ( poly m, poly d, poly vars, const ring);
    3333static poly mp_Select (poly fro, poly what, const ring);
     34static poly mp_SelectId (ideal I, poly what, const ring R);
    3435
    3536/// create a r x c zero-matrix
     
    411412    co = mpNew(2, 1);
    412413    MATELEM(co,1,1) = p_One(R);
    413     MATELEM(co,2,1) = NULL;
     414    //MATELEM(co,2,1) = NULL;
    414415    return co;
    415416  }
     
    426427      pNext(h)=NULL;
    427428      MATELEM(co,1,i) = h;
    428       MATELEM(co,2,i) = NULL;
     429      //MATELEM(co,2,i) = NULL;
    429430      if (p_IsConstant(h, R)) pos_of_1 = i;
    430431    }
     
    438439      pNext(h)=NULL;
    439440      MATELEM(co,1,i) = h;
    440       MATELEM(co,2,i) = NULL;
     441      //MATELEM(co,2,i) = NULL;
    441442      if (p_IsConstant(h, R)) pos_of_1 = i;
    442443    }
     
    476477}
    477478
     479matrix mp_CoeffProcId (ideal I, poly vars, const ring R)
     480{
     481  assume(vars!=NULL);
     482  poly sel, h;
     483  int l, i;
     484  int pos_of_1 = -1;
     485  matrix co;
     486
     487  if (idIs0(I))
     488  {
     489    co = mpNew(IDELEMS(I)+1,1);
     490    MATELEM(co,1,1) = p_One(R);
     491    return co;
     492  }
     493  sel = mp_SelectId(I, vars, R);
     494  l = pLength(sel);
     495  co = mpNew(IDELEMS(I)+1, l);
     496
     497  if (rHasLocalOrMixedOrdering(R))
     498  {
     499    for (i=l; i>=1; i--)
     500    {
     501      h = sel;
     502      pIter(sel);
     503      pNext(h)=NULL;
     504      MATELEM(co,1,i) = h;
     505      //MATELEM(co,2,i) = NULL;
     506      if (p_IsConstant(h, R)) pos_of_1 = i;
     507    }
     508  }
     509  else
     510  {
     511    for (i=1; i<=l; i++)
     512    {
     513      h = sel;
     514      pIter(sel);
     515      pNext(h)=NULL;
     516      MATELEM(co,1,i) = h;
     517      //MATELEM(co,2,i) = NULL;
     518      if (p_IsConstant(h, R)) pos_of_1 = i;
     519    }
     520  }
     521  for(int j=0;j<IDELEMS(I);j++)
     522  {
     523    poly f=I->m[j];
     524    while (f!=NULL)
     525    {
     526      i = 1;
     527      loop
     528      {
     529        if (i!=pos_of_1)
     530        {
     531          h = mp_Exdiv(f, MATELEM(co,1,i),vars, R);
     532          if (h!=NULL)
     533          {
     534            MATELEM(co,j+2,i) = p_Add_q(MATELEM(co,j+2,i), h, R);
     535            break;
     536          }
     537        }
     538        if (i == l)
     539        {
     540          // check monom 1 last:
     541          if (pos_of_1 != -1)
     542          {
     543            h = mp_Exdiv(f, MATELEM(co,1,pos_of_1),vars, R);
     544            if (h!=NULL)
     545            {
     546              MATELEM(co,j+2,pos_of_1) = p_Add_q(MATELEM(co,j+2,pos_of_1), h, R);
     547            }
     548          }
     549          break;
     550        }
     551        i ++;
     552      }
     553      pIter(f);
     554    }
     555  }
     556  return co;
     557}
     558
    478559/*2
    479560*exact divisor: let d  == x^i*y^j, m is thought to have only one term;
     
    682763    res = p_Insert(h, res, R);
    683764    fro = fro->next;
     765  }
     766  return res;
     767}
     768
     769static poly mp_SelectId (ideal I, poly what, const ring R)
     770{
     771  int i;
     772  poly h, res;
     773  res = NULL;
     774  for(int j=0;j<IDELEMS(I);j++)
     775  {
     776    poly fro=I->m[j];
     777    while (fro!=NULL)
     778    {
     779      h = p_One(R);
     780      for (i=1; i<=rVar(R); i++)
     781        p_SetExp(h,i, p_GetExp(fro,i, R) * p_GetExp(what, i, R), R);
     782      p_SetComp(h, p_GetComp(fro, R), R);
     783      p_Setm(h, R);
     784      res = p_Insert(h, res, R);
     785      fro = fro->next;
     786    }
    684787  }
    685788  return res;
  • libpolys/polys/matpol.h

    r67b0ec rfe115e  
    7171
    7272matrix mp_CoeffProc (poly f, poly vars, const ring r);
     73matrix mp_CoeffProcId (ideal I, poly vars, const ring R);
    7374/// corresponds to Macauley's coef:
    7475/// the exponent vector of vars has to contain the variables, eg 'xy';
Note: See TracChangeset for help on using the changeset viewer.