Changeset d8e71a in git


Ignore:
Timestamp:
Aug 25, 2022, 11:43:42 AM (20 months ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
aaa2126025a96fdc04e3b30a2afd09f23a3bd228
Parents:
2d1047928fc91699976942d5b18b0096edd8439e
Message:
add CoeffTerm(<vector>,<ideal>)
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • Singular/extra.cc

    r2d10479 rd8e71a  
    39713971      const short t5[]={2,VECTOR_CMD,POLY_CMD};
    39723972      const short t6[]={2,MODUL_CMD,POLY_CMD};
     3973      const short t7[]={2,VECTOR_CMD,IDEAL_CMD};
    39733974      if (iiCheckTypes(h,t1,0)
    39743975      || iiCheckTypes(h,t2,0))
     
    40034004        res->data=id_CoeffTermV(p,q,currRing);
    40044005        res->rtyp=MODUL_CMD;
     4006        return FALSE;
     4007      }
     4008      else if (iiCheckTypes(h,t7,0)) /* vector,ideal*/
     4009      {
     4010        poly p=(poly)h->Data();
     4011        ideal q=(ideal)h->next->Data();
     4012        res->data=p_CoeffTermId(p,q,p_MaxComp(p,currRing),currRing);
     4013        res->rtyp=VECTOR_CMD;
    40054014        return FALSE;
    40064015      }
  • libpolys/polys/pCoeff.cc

    r2d10479 rd8e71a  
    8282  return res;
    8383}
     84
     85/// find coeffs of a vector of a list of given monomials, n>=max_comp(v)
     86poly p_CoeffTermId(poly v, ideal m, int n, const ring r)
     87{
     88  if ((n<=0)||(v==NULL)) return NULL;
     89  poly q;
     90  poly u=NULL;
     91  int dummy;
     92  const int ncols_m=IDELEMS(m);
     93  v=p_Copy(v,r);
     94  for(int i=1;i<=n;i++)
     95  {
     96    p_TakeOutComp(&v,i,&q,&dummy,r);
     97    for(int j=0;j<ncols_m;j++)
     98    {
     99      number n=p_CoeffTerm(q,m->m[j],r);
     100      poly uu=p_NSet(n,r);
     101      if (uu!=NULL)
     102      {
     103        p_SetComp(uu,(i-1)*ncols_m+j+1,r);
     104        u=p_Add_q(u,uu,r);
     105      }
     106    }
     107    if (v==NULL) break;
     108  }
     109  return u;
     110}
     111
  • libpolys/polys/pCoeff.h

    r2d10479 rd8e71a  
    3030/// find coeffs of (polynomial) m in all vectors from I
    3131ideal id_CoeffTermV(ideal M, poly m, const ring r);
     32
     33/// find coeffs of a vector of a list of given monomials, n>=max_comp(v)
     34poly p_CoeffTermId(poly v, ideal m, int n, const ring r);
    3235#endif
Note: See TracChangeset for help on using the changeset viewer.