Changeset 111a66 in git


Ignore:
Timestamp:
Sep 21, 2004, 8:28:29 PM (20 years ago)
Author:
Michael Brickenstein <bricken@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', '38077648e7239f98078663eb941c3c979511150a')
Children:
481ed7f68993bf02f4d42dd61ae707209d68f66d
Parents:
ccf647a6cd257d5e48da01b6035ada913fcf5202
Message:
*bricken: new qsort, binary searcg algorithm for checking wether a leading term is new


git-svn-id: file:///usr/local/Singular/svn/trunk@7485 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/tgb.cc

    rccf647 r111a66  
    107107  if(p1->f>p2->f) return 1;
    108108  if(p1->f<p2->f) return -1; 
    109   int c=pLmCmp(p1->f,p2->f);
    110   if (c !=0) return c;
    111   c=pLmCmp(p1->m,p2->m);
    112   return c;
     109
     110  return pLmCmp(p1->m,p2->m);
     111 
    113112}
    114113static int pLmCmp_func(const void* ap1, const void* ap2){
     
    27752774
    27762775  //better algorithm replace p by its monoms, qsort,delete duplicates and binary search for testing if monom is contained in array
    2777  
     2776  qsort(p, p_index,sizeof(poly),pLmCmp_func);
     2777  for(i=0;i<p_index;i++)
     2778    pDelete(&p[i]->next);
    27782779  for(i=m_index-1;i>=0;--i)
    27792780  {
    27802781    int j;
     2782    int pos=posInPolys (p,p_index, m[i],c);
    27812783    BOOLEAN minus=FALSE;
    2782     for(j=0;j<p_index;j++)
    2783       if (pLmEqual(p[j],m[i]))
    2784       {
    2785         minus=TRUE;
    2786         break;
    2787       }
     2784    if(((p_index>pos)&&(pLmEqual(m[i],p[pos]))) ||(pos>0) &&(pLmEqual(m[i],p[pos-1])))
     2785      minus=TRUE;
     2786   
    27882787    if(minus)
    27892788    {
     
    27972796    }
    27982797  }
     2798
     2799//   for(i=m_index-1;i>=0;--i)
     2800//   {
     2801//     int j;
     2802//     BOOLEAN minus=FALSE;
     2803//     for(j=0;j<p_index;j++)
     2804//       if (pLmEqual(p[j],m[i]))
     2805//       {
     2806//      minus=TRUE;
     2807//      break;
     2808//       }
     2809//     if(minus)
     2810//     {
     2811//       F_minus[F_minus_index++]=m[i];
     2812//       m[i]=NULL;
     2813//     }
     2814//     else
     2815//     {
     2816//       F_plus[F_plus_index++]=m[i];
     2817//       m[i]=NULL;
     2818//     }
     2819//   }
    27992820  //in this order F_minus will be automatically ascending sorted
    28002821  //to make this sure for foreign gauss
Note: See TracChangeset for help on using the changeset viewer.