Changeset 1dc0f49 in git


Ignore:
Timestamp:
May 31, 2018, 4:30:44 PM (6 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', 'b4f17ed1d25f93d46dbe29e4b499baecc2fd51bb')
Children:
7312369f3415a88e192b1196dbe81096e7eb9072
Parents:
1e468c8d0783ef37e36459cb18d23a428c67173c
Message:
add: p_Vec2Poly to get i-th component of a vector
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • Singular/iparith.cc

    r1e468c r1dc0f49  
    14691469static BOOLEAN jjINDEX_V(leftv res, leftv u, leftv v)
    14701470{
    1471   poly p=(poly)u->CopyD(VECTOR_CMD);
    1472   poly r=p; // pointer to the beginning of component i
    1473   poly o=NULL;
     1471  poly p=(poly)u->Data();
    14741472  int i=(int)(long)v->Data();
    1475   while (p!=NULL)
    1476   {
    1477     if (pGetComp(p)!=i)
    1478     {
    1479       if (r==p) r=pNext(p);
    1480       if (o!=NULL)
    1481       {
    1482         if (pNext(o)!=NULL) pLmDelete(&pNext(o));
    1483         p=pNext(o);
    1484       }
    1485       else
    1486         pLmDelete(&p);
    1487     }
    1488     else
    1489     {
    1490       pSetComp(p, 0);
    1491       p_SetmComp(p, currRing);
    1492       o=p;
    1493       p=pNext(o);
    1494     }
    1495   }
    1496   res->data=(char *)r;
     1473  res->data=(char *)p_Vec2Poly(p,i,currRing);
    14971474  return FALSE;
    14981475}
  • libpolys/polys/monomials/p_polys.cc

    r1e468c r1dc0f49  
    35473547}
    35483548
     3549poly p_Vec2Poly(poly v, int k, const ring r)
     3550{
     3551  poly h;
     3552  poly res=NULL;
     3553
     3554  while (v!=NULL)
     3555  {
     3556    if (__p_GetComp(v,r)==k)
     3557    {
     3558      h=p_Head(v,r);
     3559      p_SetComp(h,0,r);
     3560      pNext(h)=res;res=h;
     3561    }
     3562    pIter(v);
     3563  }
     3564  if (res!=NULL) res=pReverse(res);
     3565  return res;
     3566}
     3567
    35493568/// julia: vector to already allocated array (len=p_MaxComp(v,r))
    35503569void  p_Vec2Array(poly v, poly *p, int len, const ring r)
  • libpolys/polys/monomials/p_polys.h

    r1e468c r1dc0f49  
    9797
    9898void  p_Vec2Polys(poly v, poly**p, int *len, const ring r);
     99poly  p_Vec2Poly(poly v, int k, const ring r);
    99100
    100101/// julia: vector to already allocated array (len=p_MaxComp(v,r))
Note: See TracChangeset for help on using the changeset viewer.