Changeset 3a8a0d9 in git for libpolys/polys


Ignore:
Timestamp:
Mar 5, 2012, 8:43:21 PM (12 years ago)
Author:
Oleksandr Motsak <motsak@…>
Branches:
(u'spielwiese', '5b153614cbc72bfa198d75b1e9e33dab2645d9fe')
Children:
5dc5557cfa7b8e12dc6662eaa5592e5d1137f0c1
Parents:
9b1590d4c8e281abd068646c9d699284f9ea053a
git-author:
Oleksandr Motsak <motsak@mathematik.uni-kl.de>2012-03-05 20:43:21+01:00
git-committer:
Oleksandr Motsak <motsak@mathematik.uni-kl.de>2012-03-05 20:46:40+01:00
Message:
fixes to _am ordering

add: additional int* weights_m pointer in struct sro_am
fix: rO_WMDegree should not mess around with start/end
fix: rCompose: _am ordering was not treated (fixed also by Hans)
Location:
libpolys/polys/monomials
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • libpolys/polys/monomials/p_polys.cc

    r9b1590 r3a8a0d9  
    122122        case ro_am:
    123123        {
    124           ord=POLY_NEGWEIGHT_OFFSET;
    125           int a,e;
    126           a=o->data.am.start;
    127           e=o->data.am.end;
    128           int *w=o->data.am.weights;
     124          ord = POLY_NEGWEIGHT_OFFSET;
     125          const short a=o->data.am.start;
     126          const short e=o->data.am.end;
     127          const int * w=o->data.am.weights;
    129128#if 1
    130           for(int i=a;i<=e;i++) ord+=p_GetExp(p,i,r)*w[i-a];
    131           int c=p_GetComp(p,r);
     129          for(short i=a; i<=e; i++, w++)
     130            ord += ((*w) * p_GetExp(p,i,r));
    132131#else
    133132          long ai;
    134133          int ei,wi;
    135           for(int i=a;i<=e;i++)
     134          for(short i=a;i<=e;i++)
    136135          {
    137136             ei=p_GetExp(p,i,r);
     
    139138             ai=ei*wi;
    140139             if (ai/ei!=wi) pSetm_error=TRUE;
    141              ord+=ai;
     140             ord += ai;
    142141             if (ord<ai) pSetm_error=TRUE;
    143142          }
    144143#endif
    145           if ((c>0)&&(c<=o->data.am.len_gen))
     144          const int c = p_GetComp(p,r);
     145
     146          const short len_gen= o->data.am.len_gen;
     147         
     148          if ((c > 0) && (c <= len_gen))
    146149          {
    147             ord+=w[c-(e-a)+2];
     150            const int * const wm = o->data.am.weights_m;
     151            assume( wm[0] == len_gen );
     152            ord += wm[c];
    148153          }
    149           p->exp[o->data.am.place]=ord;
     154         
     155          p->exp[o->data.am.place] = ord;
    150156          break;
    151157        }
  • libpolys/polys/monomials/ring.cc

    r9b1590 r3a8a0d9  
    357357        if (r->order[l]!=ringorder_M) break;
    358358      }
    359       if (r->order[l]==ringorder_am) /*j==0*/
     359      if (r->order[l]==ringorder_am)
    360360      {
    361361        int m=r->wvhdl[l][i];
     
    22072207    long *o, sro_ord &ord_struct, int *weights)
    22082208{
     2209  assume(weights != NULL);
     2210 
    22092211  // weighted degree (aligned) of variables v_start..v_end, ordsgn 1
    2210   while((start<end) && (weights[0]==0)) { start++; weights++; }
    2211   while((start<end) && (weights[end-start]==0)) { end--; }
     2212//  while((start<end) && (weights[0]==0)) { start++; weights++; }
     2213//  while((start<end) && (weights[end-start]==0)) { end--; }
    22122214  rO_Align(place,bitplace);
    22132215  ord_struct.ord_typ=ro_am;
     
    22152217  ord_struct.data.am.end=end;
    22162218  ord_struct.data.am.place=place;
     2219  ord_struct.data.am.weights=weights;
     2220  ord_struct.data.am.weights_m = weights + (end-start+1);
    22172221  ord_struct.data.am.len_gen=weights[end-start+1];
    2218   ord_struct.data.am.weights=weights;
     2222  assume( ord_struct.data.am.weights_m[0] == ord_struct.data.am.len_gen );
    22192223  o[place]=1;
    22202224  place++;
  • libpolys/polys/monomials/ring.h

    r9b1590 r3a8a0d9  
    9393  short end;
    9494  short len_gen; // i>len_gen: weight(gen(i)):=0
    95   int *weights; // pointers into wvhdl field of length (end-start+1) + len_gen
    96                 // contents w_1,... w_n, len, mod_w_1, .. mod_w_len, 0
     95  int *weights; // pointers into wvhdl field of length (end-start+1) + len_gen + 1
     96                // contents w_{start},... w_{end}, len, mod_w_1, .. mod_w_len, 0
     97  int *weights_m; // pointers into wvhdl field of length len_gen + 1
     98                // len_gen, mod_w_1, .. mod_w_len, 0
     99 
    97100};
    98101typedef struct sro_am sro_am;
Note: See TracChangeset for help on using the changeset viewer.