Changeset c985c5 in git


Ignore:
Timestamp:
Sep 17, 2007, 10:33:17 AM (17 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', 'fc741b6502fd8a97288eaa3eba6e5220f3c3df87')
Children:
cff7ceca60f37e140376ee20d9be20dfdd968d7d
Parents:
37a003af153acc2b6945be5b60d23ec814d47ae9
Message:
*hannes: fix bug 48(exp bound for maps)


git-svn-id: file:///usr/local/Singular/svn/trunk@10307 2c84dea3-7e68-4137-9b89-c4e89433aadc
Files:
3 added
6 edited

Legend:

Unmodified
Added
Removed
  • Singular/ipshell.cc

    r37a003 rc985c5  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: ipshell.cc,v 1.168 2007-08-07 11:41:00 Singular Exp $ */
     4/* $Id: ipshell.cc,v 1.169 2007-09-17 08:33:16 Singular Exp $ */
    55/*
    66* ABSTRACT:
     
    716716      }
    717717      tmpW.data=IDDATA(w);
     718      #if 0
    718719      if (((tmpW.rtyp==IDEAL_CMD)||(tmpW.rtyp==MODUL_CMD)) && idIs0(IDIDEAL(w)))
    719720      {
     
    722723      }
    723724      else
     725      #endif
    724726      {
    725727        #ifdef FAST_MAP
  • Tst/Short/ok_s.lst

    r37a003 rc985c5  
    4343bug_46
    4444bug_47
     45bug_48
    4546bug_5
    4647bug_6
  • kernel/Makefile.in

    r37a003 rc985c5  
    380380
    381381tags:   
    382         ctags *.y *.l *.c *.h *.cc *.inc
     382        ctags *.c *.h *.cc *.inc
    383383
    384384echoLIBS:
  • kernel/fast_maps.cc

    r37a003 rc985c5  
    77 *  Author:  obachman (Olaf Bachmann)
    88 *  Created: 02/01
    9  *  Version: $Id: fast_maps.cc,v 1.5 2006-05-02 14:15:46 Singular Exp $
     9 *  Version: $Id: fast_maps.cc,v 1.6 2007-09-17 08:33:17 Singular Exp $
    1010 *******************************************************************/
    1111#include "mod2.h"
     
    3636  int n = si_min(pi_r->N, n_max_map_monomials);
    3737  int i, j;
    38   Exponent_t e_i, e_j;
     38  unsigned long e_i, e_j;
    3939  poly m_i, map_j = p_Init(map_r);
    4040
     
    4242  {
    4343    e_i = p_GetExp(pi_m, i, pi_r);
     44    if (e_i==0) e_i=1;
    4445    m_i = max_map_monomials[i-1];
    45     if (e_i > 0 && m_i != NULL && ! p_IsConstantComp(m_i, map_r))
     46    if (m_i != NULL && ! p_IsConstantComp(m_i, map_r))
    4647    {
    4748      for (j = 1; j<= map_r->N; j++)
    4849      {
    4950        e_j = p_GetExp(m_i, j, map_r);
    50         if (e_j > 0)
    51         {
    52           p_AddExp(map_j, j, e_j*e_i, map_r);
    53         }
     51        if (e_j == 0) e_j=1;
     52        p_AddExp(map_j, j, e_j*e_i, map_r);
    5453      }
    5554    }
     
    5958
    6059// returns maximal exponent if map_id is applied to pi_id
    61 static Exponent_t maGetMaxExp(ideal pi_id, ring pi_r, ideal map_id, ring map_r)
    62 {
    63   Exponent_t max=0;
     60static unsigned long maGetMaxExp(ideal pi_id, ring pi_r, ideal map_id, ring map_r)
     61{
     62  unsigned long max=0;
    6463  poly* max_map_monomials = (poly*) omAlloc(IDELEMS(map_id)*sizeof(poly));
    6564  poly max_pi_i, max_map_i;
     
    7675    max_map_i = maGetMaxExpP(max_map_monomials, IDELEMS(map_id), map_r,
    7776                              max_pi_i, pi_r);
    78     Exponent_t temp = p_GetMaxExp(max_map_i, map_r);
    79     if (temp > max){
    80       max=temp;
    81     }
     77    unsigned long temp = p_GetMaxExp(max_map_i, map_r);
     78    if (temp > max){ max=temp; }
    8279
    8380    p_LmFree(max_pi_i, pi_r);
     
    292289
    293290#if HAVE_DEST_R > 0
    294   Exponent_t maxExp = maGetMaxExp(map_id, map_r, image_id, image_r);
     291  unsigned long maxExp = maGetMaxExp(map_id, map_r, image_id, image_r);
    295292  if (maxExp <=  1) maxExp = 2;
    296   else if (maxExp > (Exponent_t) image_r->bitmask)
    297     maxExp = (Exponent_t) image_r->bitmask;
     293  else if (maxExp > (unsigned long) image_r->bitmask)
     294    maxExp = (unsigned long) image_r->bitmask;
    298295  dest_r = rModifyRing_Simple(image_r, TRUE, TRUE, maxExp,  simple);
    299296#else
     
    583580
    584581  for (i=1;i<=r->N;i++) {
    585     Exponent_t e1 = p_GetExp(m1, i, r);
    586     Exponent_t e2 = p_GetExp(m2, i, r);
    587     if (e1 > 0 && e2 > 0){
    588       Exponent_t em = (e1 > e2 ? e2 : e1);
     582    unsigned long e1 = p_GetExp(m1, i, r);
     583    unsigned long e2 = p_GetExp(m2, i, r);
     584    if (e1 > 0 && e2 > 0)
     585    {
     586      unsigned long em = (e1 > e2 ? e2 : e1);
    589587      dg += em;
    590588      p_SetExp(ggt, i, em, r);
     
    592590      p_SetExp(q2, i, e2 - em, r);
    593591    }
    594     else {
     592    else
     593    {
    595594      p_SetExp(q1, i, e1, r);
    596595      p_SetExp(q2, i, e2, r);
     
    602601    p_Setm(q1, r);
    603602    p_Setm(q2, r);
    604 
    605 
    606   }
    607   else {
     603  }
     604  else
     605  {
    608606    p_LmFree(ggt, r);
    609607    p_LmFree(q1, r);
     
    664662    iter=iter->next;
    665663  }
    666   if(ggT!=NULL){
    667 
     664  if(ggT!=NULL)
     665  {
    668666    int dq =pTotaldegree(fq_p,r);
    669     if (dq!=0){
     667    if (dq!=0)
     668    {
    670669      fq=maPoly_InsertMonomial(mp, fq_p, r, NULL);
    671670      fp=maPoly_InsertMonomial(mp, fp_p, r, NULL);
    672671      return maPoly_InsertMonomial(mp, ggT, r, NULL);
    673672    }
    674     else {
     673    else
     674    {
    675675      fq=NULL;
    676676      p_LmFree(fq_p, r);
     
    681681    }
    682682  }
    683   else {
     683  else
     684  {
    684685    return NULL;
    685686  }
    686 
    687 
    688687}
    689688
     
    701700  mapoly fp=NULL;
    702701  mapoly fq=NULL;
    703   while (iter->next!=NULL){
     702  while (iter->next!=NULL)
     703  {
    704704    choice=iter->next;
    705     if ((iter->f1==NULL)){
     705    if ((iter->f1==NULL))
     706    {
    706707      ggT=maFindBestggT(iter, choice, fp, fq,src_r);
    707       if (choice!=NULL){
     708      if (choice!=NULL)
     709      {
    708710        iter->f1=fp;
    709711        iter->f2=ggT;
    710         if (fq!=NULL){
     712        if (fq!=NULL)
     713        {
    711714          ggT->ref++;
    712715          choice->f1=fq;
     
    714717        }
    715718      }
    716 
    717719    }
    718720    iter=iter->next;
  • kernel/prCopy.cc

    r37a003 rc985c5  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: prCopy.cc,v 1.2 2005-04-25 18:15:25 Singular Exp $ */
     4/* $Id: prCopy.cc,v 1.3 2007-09-17 08:33:17 Singular Exp $ */
    55/*
    66* ABSTRACT - implementation of functions for Copy/Move/Delete for Polys
     
    1919prCopyEvector(poly dest, ring dest_r, poly src, ring src_r,int max)
    2020{
    21   number n = pGetCoeff(dest);
     21  //memset(dest->exp,0,dest_r->ExpL_Size*sizeof(long));
    2222  int i;
    2323  for (i=max; i>0; i--)
    2424  {
    2525    p_SetExp(dest, i, p_GetExp( src, i,src_r), dest_r);
    26     assume(n == pGetCoeff(dest));
    2726  }
    2827  if (rRing_has_Comp(dest_r) && rRing_has_Comp(src_r))
    2928    p_SetComp(dest, p_GetComp( src,src_r), dest_r);
    30   assume(n == pGetCoeff(dest));
    3129  p_Setm(dest, dest_r);
    32   assume(n == pGetCoeff(dest));
    3330}
    3431
  • kernel/ring.cc

    r37a003 rc985c5  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: ring.cc,v 1.67 2007-07-27 14:09:52 Singular Exp $ */
     4/* $Id: ring.cc,v 1.68 2007-09-17 08:33:17 Singular Exp $ */
    55
    66/*
     
    16041604          case ringorder_unspec:
    16051605            if (r->order[1] == ringorder_C
    1606             ||  r->order[0] == ringorder_unspec)
     1606            ||  r->order[0] == ringorder_unspec)
    16071607              return rOrderType_ExpComp;
    16081608            return rOrderType_Exp;
     
    29922992                   tmp_typ[typ_i], r->wvhdl[i]);
    29932993        typ_i++;
    2994         { // check for weights <=0
    2995           int jj;
    2996           BOOLEAN have_bad_weights=FALSE;
    2997           for(jj=r->block1[i]-r->block0[i];jj>=0; jj--)
    2998           {
    2999             if (r->wvhdl[i][jj]<=0) have_bad_weights=TRUE;
    3000           }
    3001           if (have_bad_weights)
    3002           {
    3003              rO_TDegree(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,
    3004                                      tmp_typ[typ_i]);
     2994        { // check for weights <=0
     2995          int jj;
     2996          BOOLEAN have_bad_weights=FALSE;
     2997          for(jj=r->block1[i]-r->block0[i];jj>=0; jj--)
     2998          {
     2999            if (r->wvhdl[i][jj]<=0) have_bad_weights=TRUE;
     3000          }
     3001          if (have_bad_weights)
     3002          {
     3003             rO_TDegree(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,
     3004                                     tmp_typ[typ_i]);
    30053005             typ_i++;
    3006           }
    3007         }
     3006          }
     3007        }
    30083008        if (r->block1[i]!=r->block0[i])
    30093009        {
     
    30173017                   tmp_typ[typ_i], r->wvhdl[i]);
    30183018        typ_i++;
    3019         { // check for weights <=0
    3020           int j;
    3021           BOOLEAN have_bad_weights=FALSE;
    3022           for(j=r->block1[i]-r->block0[i];j>=0; j--)
    3023           {
    3024             if (r->wvhdl[i][j]<=0) have_bad_weights=TRUE;
    3025           }
    3026           if (have_bad_weights)
    3027           {
    3028              rO_TDegree(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,
    3029                                      tmp_typ[typ_i]);
     3019        { // check for weights <=0
     3020          int j;
     3021          BOOLEAN have_bad_weights=FALSE;
     3022          for(j=r->block1[i]-r->block0[i];j>=0; j--)
     3023          {
     3024            if (r->wvhdl[i][j]<=0) have_bad_weights=TRUE;
     3025          }
     3026          if (have_bad_weights)
     3027          {
     3028             rO_TDegree(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,
     3029                                     tmp_typ[typ_i]);
    30303030             typ_i++;
    3031           }
    3032         }
     3031          }
     3032        }
    30333033        if (r->block1[i]!=r->block0[i])
    30343034        {
     
    31043104  }
    31053105  // the variables
    3106   for(i=1 ; i<r->N+1 ; i++)
     3106  for(i=1 ; i<=r->N ; i++)
    31073107  {
    31083108    if(v[i]==(-1))
     
    32973297    shifts[i] = BIT_SIZEOF_LONG;
    32983298
    3299   // find minimal bit in each long var
     3299  // find minimal bit shift in each long exp entry
    33003300  for (i=1;i<=r->N;i++)
    33013301  {
     
    33033303      shifts[r->VarOffset[i] & 0xffffff] = r->VarOffset[i] >> 24;
    33043304  }
    3305   // reset r->VarOffset
     3305  // reset r->VarOffset: set the minimal shift to 0
    33063306  for (i=1;i<=r->N;i++)
    33073307  {
Note: See TracChangeset for help on using the changeset viewer.