Changeset 7abd61 in git


Ignore:
Timestamp:
Nov 13, 2017, 5:19:33 PM (6 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
be94d37e5ac5d3409d99769283ea1d0f0e365d51
Parents:
bf6fa79192a542ca1e14fd45a92837cdd6ef38d2
Message:
opt: conversion from factory, sbuckets
Location:
libpolys/polys
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • libpolys/polys/clapconv.cc

    rbf6fa7 r7abd61  
    6868  else
    6969  {
    70     poly term = p_Init(r);
    71     pNext( term ) = NULL;
    72     for ( int i = 1; i <= r->N; i++ )
    73       p_SetExp( term, i, exp[i], r);
    74     pGetCoeff( term )=r->cf->convFactoryNSingN(f, r->cf);
    75     p_Setm( term, r );
    76     if ( n_IsZero(pGetCoeff(term), r->cf) )
    77     {
    78       p_Delete(&term,r);
     70    number n=r->cf->convFactoryNSingN(f, r->cf);
     71    if ( n_IsZero(n, r->cf) )
     72    {
     73      n_Delete(&n,r->cf);
    7974    }
    8075    else
    8176    {
     77      poly term = p_Init(r);
     78      //pNext( term ) = NULL; // done by p_Init
     79      pGetCoeff(term)=n;
     80      p_SetExpV(term,exp,r);
    8281      sBucket_Merge_m(result,term);
    8382    }
    8483  }
    8584}
    86 
    8785
    8886CanonicalForm convSingPFactoryP( poly p, const ring r )
     
    178176    {
    179177      poly term = p_Init(r);
    180       pNext( term ) = NULL;
     178      //pNext( term ) = NULL; // done by p_Init
    181179      int i;
    182180      for ( i = rVar(r); i>0 ; i-- )
     
    257255{
    258256  poly a=NULL;
    259   poly t;
    260257  for( CFIterator i=f; i.hasTerms(); i++)
    261258  {
    262     t= p_Init (r->cf->extRing);
    263     p_GetCoeff(t, r->cf->extRing)= convFactoryNSingAN( i.coeff(), r );
    264     if (n_IsZero(p_GetCoeff(t,r->cf->extRing),r->cf->extRing->cf))
    265     {
    266       p_Delete(&t,r->cf->extRing);
     259    number n= convFactoryNSingAN( i.coeff(), r );
     260    if (n_IsZero(n,r->cf->extRing->cf))
     261    {
     262      n_Delete(&n,r->cf->extRing->cf);
    267263    }
    268264    else
    269265    {
     266      poly t= p_Init (r->cf->extRing);
     267      pGetCoeff(t)=n;
    270268      p_SetExp(t,1,i.exp(),r->cf->extRing);
     269      //p_Setm(t,r->cf->extRing);// not needed for rings with 1 variable
    271270      a=p_Add_q(a,t,r->cf->extRing);
    272271    }
     
    349348  {
    350349    poly term = p_Init(r);
    351     pNext( term ) = NULL;
     350    //pNext( term ) = NULL; // done by p_Init
    352351    for ( int i = rVar(r); i>0; i-- )
    353352      p_SetExp( term, i ,exp[i], r);
  • libpolys/polys/monomials/p_polys.h

    rbf6fa7 r7abd61  
    905905  int shorter;
    906906  poly res = r->p_Procs->p_Add_q(p, q, shorter, r);
    907   lp = (lp + lq) - shorter;
     907  lp += lq - shorter;
    908908  return res;
    909909}
     
    14821482      p_SetExp(p, j, ev[j], r);
    14831483
    1484   p_SetComp(p, ev[0],r);
     1484  if(ev[0]!=0) p_SetComp(p, ev[0],r);
    14851485  p_Setm(p, r);
    14861486}
  • libpolys/polys/sbuckets.cc

    rbf6fa7 r7abd61  
    189189  while (bucket->buckets[i].p != NULL)
    190190  {
    191     p = p_Add_q(p, bucket->buckets[i].p, length, bucket->buckets[i].length,
    192                 bucket->bucket_ring);
     191    int shorter;
     192    p = bucket->bucket_ring->p_Procs->p_Add_q(p, bucket->buckets[i].p,
     193                shorter, bucket->bucket_ring);
     194    length+=bucket->buckets[i].length-shorter;
    193195    bucket->buckets[i].p = NULL;
    194196    bucket->buckets[i].length = 0;
     
    218220  while (bucket->buckets[i].p != NULL)
    219221  {
    220     p = p_Add_q(p, bucket->buckets[i].p, length, bucket->buckets[i].length,
     222    int shorter;
     223    p = bucket->bucket_ring->p_Procs->p_Add_q(p, bucket->buckets[i].p, shorter,
    221224                bucket->bucket_ring);
     225    length+= bucket->buckets[i].length-shorter;
    222226    bucket->buckets[i].p = NULL;
    223227    bucket->buckets[i].length = 0;
Note: See TracChangeset for help on using the changeset viewer.