Changeset fc5095 in git for kernel/p_polys.cc


Ignore:
Timestamp:
May 4, 2005, 4:13:17 PM (19 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', 'fc741b6502fd8a97288eaa3eba6e5220f3c3df87')
Children:
e94c760bc99c31edb114fb23f26bd5b946df947f
Parents:
d96679d03c58aeb42f44e71cab5910f752889f41
Message:
*hannes: frwalk/walk stuff


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

Legend:

Unmodified
Added
Removed
  • kernel/p_polys.cc

    rd96679d rfc5095  
    77 *  Author:  obachman (Olaf Bachmann)
    88 *  Created: 8/00
    9  *  Version: $Id: p_polys.cc,v 1.2 2005-04-20 17:25:51 Singular Exp $
     9 *  Version: $Id: p_polys.cc,v 1.3 2005-05-04 14:08:55 Singular Exp $
    1010 *******************************************************************/
    1111
    1212#include "mod2.h"
     13#include "structs.h"
    1314#include "structs.h"
    1415#include "p_polys.h"
    1516#include "ring.h"
     17#include "int64vec.h"
     18#ifndef NDEBUG
    1619#include "febase.h"
     20#endif
    1721
    1822/***************************************************************
     
    2529static long* _ShiftedComponents = NULL;
    2630static int _ExternalComponents = 0;
     31
     32BOOLEAN pSetm_error=0;
    2733
    2834void p_Setm_General(poly p, ring r)
     
    5662          e=o->data.wp.end;
    5763          int *w=o->data.wp.weights;
     64#if 1
    5865          for(int i=a;i<=e;i++) ord+=p_GetExp(p,i,r)*w[i-a];
     66#else
     67          long ai;
     68          int ei,wi;
     69          for(int i=a;i<=e;i++)
     70          {
     71             ei=p_GetExp(p,i,r);
     72             wi=w[i-a];
     73             ai=ei*wi;
     74             if (ai/ei!=wi) pSetm_error=TRUE;
     75             ord+=ai;
     76             if (ord<ai) pSetm_error=TRUE;
     77          }
     78#endif 
    5979          p->exp[o->data.wp.place]=ord;
     80          break;
     81        }
     82      case ro_wp64:
     83        {
     84          int64 ord=0;
     85          int a,e;
     86          a=o->data.wp64.start;
     87          e=o->data.wp64.end;
     88          int64 *w=o->data.wp64.weights64;
     89          int64 ei,wi,ai;
     90          for(int i=a;i<=e;i++) {
     91            //Print("exp %d w %d \n",p_GetExp(p,i,r),(int)w[i-a]);
     92            //ord+=((int64)p_GetExp(p,i,r))*w[i-a];
     93            ei=(int64)p_GetExp(p,i,r);
     94            wi=w[i-a];
     95            ai=ei*wi;
     96            if(ei!=0 && ai/ei!=wi){
     97              pSetm_error=TRUE;
     98              Print("ai %lld, wi %lld\n",ai,wi);
     99            }
     100            ord+=ai;
     101            if (ord<ai){
     102               pSetm_error=TRUE;
     103               Print("ai %lld, ord %lld\n",ai,ord);
     104            }
     105          }
     106          int64 mask=(int64)0x7fffffff;
     107          long a_0=(long)(ord&mask); //2^31
     108          long a_1=(long)(ord >>31 ); /*(ord/(mask+1));*/
     109
     110          //Print("mask: %x,  ord: %d,  a_0: %d,  a_1: %d\n"
     111          //,(int)mask,(int)ord,(int)a_0,(int)a_1);
     112                    //Print("mask: %d",mask);
     113
     114          p->exp[o->data.wp64.place]=a_1;
     115          p->exp[o->data.wp64.place+1]=a_0;
     116//            if(p_Setm_error) Print("***************************\n
     117//                                    ***************************\n
     118//                                    **WARNING: overflow error**\n
     119//                                    ***************************\n
     120//                                    ***************************\n");
    60121          break;
    61122        }
     
    73134          int c=p_GetComp(p,r);
    74135          long sc = c;
    75           int* Components = (_ExternalComponents ? _Components :
     136          int* Components = (_ExternalComponents ? _Components : 
    76137                             o->data.syzcomp.Components);
    77           long* ShiftedComponents = (_ExternalComponents ? _ShiftedComponents:
     138          long* ShiftedComponents = (_ExternalComponents ? _ShiftedComponents: 
    78139                                     o->data.syzcomp.ShiftedComponents);
    79140          if (ShiftedComponents != NULL)
     
    142203p_SetmProc p_GetSetmProc(ring r)
    143204{
    144   // covers lp, rp, ls,
     205  // covers lp, rp, ls, 
    145206  if (r->typ == NULL) return p_Setm_Dummy;
    146207
    147208  if (r->OrdSize == 1)
    148209  {
    149     if (r->typ[0].ord_typ == ro_dp &&
     210    if (r->typ[0].ord_typ == ro_dp && 
    150211        r->typ[0].data.dp.start == 1 &&
    151212        r->typ[0].data.dp.end == r->N &&
    152213        r->typ[0].data.dp.place == r->pOrdIndex)
    153214      return p_Setm_TotalDegree;
    154     if (r->typ[0].ord_typ == ro_wp &&
     215    if (r->typ[0].ord_typ == ro_wp && 
    155216        r->typ[0].data.wp.start == 1 &&
    156217        r->typ[0].data.wp.end == r->N &&
     
    169230* the ordering is compatible with degree, use a->order
    170231*/
    171 inline long _pDeg(poly a, const ring r)
     232inline long _pDeg(poly a, ring r)
    172233{
    173234  p_LmCheckPolyRing(a, r);
     
    176237}
    177238
    178 long pDeg(poly a, const ring r)
     239long pDeg(poly a, ring r)
    179240{
    180241  return _pDeg(a, r);
     
    197258}
    198259
    199 // pWTotalDegree for weighted orderings
     260// pWTotalDegree for weighted orderings 
    200261// whose first block covers all variables
    201262inline long _pWFirstTotalDegree(poly p, ring r)
     
    203264  int i;
    204265  long sum = 0;
    205 
     266 
    206267  for (i=1; i<= r->firstBlockEnds; i++)
    207268  {
     
    254315        }
    255316        break;
     317      case ringorder_a64:
     318        {
     319          int64* w=(int64*)r->wvhdl[i];
     320          for (k=0;k<=(r->block1[i] - r->block0[i]);k++)
     321          {
     322            //there should be added a line which checks if w[k]>2^31
     323            j+= p_GetExp(p,k+1, r)*(long)w[k];
     324          }
     325          //break;
     326          return j;
     327        }
    256328      case ringorder_c:
    257329      case ringorder_C:
     
    265337          j+= p_GetExp(p,k, r)*r->wvhdl[i][ k- r->block0[i]];
    266338        }
     339        //break;
    267340        return j;
     341
    268342#ifndef NDEBUG
    269343      default:
     
    353427  if (! rIsSyzIndexRing(r))
    354428  {
    355     while (pNext(p) != NULL)
     429    while (pNext(p) != NULL) 
    356430    {
    357431      pIter(p);
     
    681755 ***************************************************************/
    682756
    683 static inline unsigned long
    684 p_GetMaxExpL2(unsigned long l1, unsigned long l2, ring r,
     757static inline unsigned long 
     758p_GetMaxExpL2(unsigned long l1, unsigned long l2, ring r, 
    685759              unsigned long number_of_exp)
    686760{
     
    723797  unsigned long l_p, l_max;
    724798  unsigned long divmask = r->divmask;
    725 
     799 
    726800  do
    727801  {
     
    730804    l_max = max->exp[offset];
    731805    // do the divisibility trick to find out whether l has an exponent
    732     if (l_p > l_max ||
     806    if (l_p > l_max || 
    733807        (((l_max & divmask) ^ (l_p & divmask)) != ((l_max-l_p) & divmask)))
    734808      max->exp[offset] = p_GetMaxExpL2(l_max, l_p, r);
     
    740814      l_max = max->exp[offset];
    741815      // do the divisibility trick to find out whether l has an exponent
    742       if (l_p > l_max ||
     816      if (l_p > l_max || 
    743817          (((l_max & divmask) ^ (l_p & divmask)) != ((l_max-l_p) & divmask)))
    744818        max->exp[offset] = p_GetMaxExpL2(l_max, l_p, r);
     
    754828  unsigned long l_p, divmask = r->divmask;
    755829  int i;
    756 
     830 
    757831  while (p != NULL)
    758832  {
     
    765839      l_p = p->exp[r->VarL_Offset[i]];
    766840      // do the divisibility trick to find out whether l has an exponent
    767       if (l_p > l_max ||
     841      if (l_p > l_max || 
    768842          (((l_max & divmask) ^ (l_p & divmask)) != ((l_max-l_p) & divmask)))
    769843        l_max = p_GetMaxExpL2(l_max, l_p, r);
     
    774848}
    775849
     850
     851
     852   
    776853/***************************************************************
    777854 *
     
    847924}
    848925
    849 /***************************************************************
    850  *
    851  * p_ShallowDelete
    852  *
    853  ***************************************************************/
    854 #undef LINKAGE
    855 #define LINKAGE
    856 #undef p_Delete
    857 #define p_Delete p_ShallowDelete
    858 #undef n_Delete
    859 #define n_Delete(n, r) ((void)0)
    860 
    861 #include "p_Delete__T.cc"
    862 
Note: See TracChangeset for help on using the changeset viewer.