Changeset b45eec in git for kernel/ideals.cc


Ignore:
Timestamp:
Apr 19, 2020, 9:57:14 PM (4 years ago)
Author:
Karim Abou Zeid <karim23697@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
ffcf715a570941627bf020648e93955f1596f2ef
Parents:
d49a473d44aa25c5ecc3126360ab3179ddb8af7e636fa5455e699fa8c0a820dd60e00a059f96f8ef
Message:
Merge branch 'stable' into lp_Z
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/ideals.cc

    rd49a47 rb45eec  
    206206  if ((idIs0(h1)) || (idIs0(h2)))  return idInit(1,rank);
    207207
     208  BITSET save_opt;
     209  SI_SAVE_OPT1(save_opt);
     210  si_opt_1 |= Sy_bit(OPT_REDTAIL_SYZ);
     211
    208212  ideal first,second,temp,temp1,result;
    209213  poly p,q;
     
    404408
    405409  idSkipZeroes(result);
     410  SI_RESTORE_OPT1(save_opt);
    406411  if (TEST_OPT_RETURN_SB)
    407412  {
     
    793798  idTest(s_h1);
    794799
     800  BITSET save_opt;
     801  SI_SAVE_OPT1(save_opt);
     802  si_opt_1|=Sy_bit(OPT_REDTAIL_SYZ);
     803
    795804  ideal s_h3=idPrepare(s_h1,h,k,w,alg); // main (syz) GB computation
     805
     806  SI_RESTORE_OPT1(save_opt);
    796807
    797808  if (s_h3==NULL)
     
    10991110}
    11001111
     1112static void idLift_setUnit(int e_mod, matrix *unit)
     1113{
     1114  if (unit!=NULL)
     1115  {
     1116    *unit=mpNew(e_mod,e_mod);
     1117    // make sure that U is a diagonal matrix of units
     1118    for(int i=e_mod;i>0;i--)
     1119    {
     1120      MATELEM(*unit,i,i)=pOne();
     1121    }
     1122  }
     1123}
    11011124/*2
    11021125*computes a representation of the generators of submod with respect to those
     
    11091132  int lsmod =id_RankFreeModule(submod,currRing), j, k;
    11101133  int comps_to_add=0;
     1134  int idelems_mod=IDELEMS(mod);
     1135  int idelems_submod=IDELEMS(submod);
    11111136  poly p;
    11121137
    11131138  if (idIs0(submod))
    11141139  {
    1115     if (unit!=NULL)
    1116     {
    1117       *unit=mpNew(1,1);
    1118       MATELEM(*unit,1,1)=pOne();
    1119     }
    11201140    if (rest!=NULL)
    11211141    {
    11221142      *rest=idInit(1,mod->rank);
    11231143    }
    1124     return idInit(1,mod->rank);
     1144    idLift_setUnit(idelems_submod,unit);
     1145    return idInit(1,idelems_mod);
    11251146  }
    11261147  if (idIs0(mod)) /* and not idIs0(submod) */
    11271148  {
    1128     WerrorS("2nd module does not lie in the first");
    1129     return NULL;
     1149    if (rest!=NULL)
     1150    {
     1151      *rest=idCopy(submod);
     1152      idLift_setUnit(idelems_submod,unit);
     1153      return idInit(1,idelems_mod);
     1154    }
     1155    else
     1156    {
     1157      WerrorS("2nd module does not lie in the first");
     1158      return NULL;
     1159    }
    11301160  }
    11311161  if (unit!=NULL)
    11321162  {
    1133     comps_to_add = IDELEMS(submod);
     1163    comps_to_add = idelems_submod;
    11341164    while ((comps_to_add>0) && (submod->m[comps_to_add-1]==NULL))
    11351165      comps_to_add--;
     
    12101240        if (!divide)
    12111241        {
    1212           if (isSB)
     1242          if (rest==NULL)
    12131243          {
    1214             WarnS("first module not a standardbasis\n"
     1244            if (isSB)
     1245            {
     1246              WarnS("first module not a standardbasis\n"
    12151247              "// ** or second not a proper submodule");
     1248            }
     1249            else
     1250              WerrorS("2nd module does not lie in the first");
    12161251          }
    1217           else
    1218             WerrorS("2nd module does not lie in the first");
    12191252          idDelete(&s_result);
    12201253          idDelete(&s_rest);
    1221           s_result=idInit(IDELEMS(submod),submod->rank);
    1222           break;
     1254          if(syz_ring!=orig_ring)
     1255          {
     1256            idDelete(&s_mod);
     1257            rChangeCurrRing(orig_ring);
     1258            rDelete(syz_ring);
     1259          }
     1260          if (unit!=NULL)
     1261          {
     1262            idLift_setUnit(idelems_submod,unit);
     1263          }
     1264          if (rest!=NULL) *rest=idCopy(submod);
     1265          s_result=idInit(idelems_submod,idelems_mod);
     1266          return s_result;
    12231267        }
    12241268        else
     
    12531297  }
    12541298  if (rest!=NULL)
     1299  {
     1300    s_rest->rank=mod->rank;
    12551301    *rest = s_rest;
     1302  }
    12561303  else
    12571304    idDelete(&s_rest);
     
    12591306  if (unit!=NULL)
    12601307  {
    1261     *unit=mpNew(comps_to_add,comps_to_add);
     1308    *unit=mpNew(idelems_submod,idelems_submod);
    12621309    int i;
    12631310    for(i=0;i<IDELEMS(s_result);i++)
     
    12921339    }
    12931340  }
     1341  s_result->rank=idelems_mod;
    12941342  return s_result;
    12951343}
     
    15101558  #endif
    15111559  ideal s_h3;
     1560  BITSET old_test1;
     1561  SI_SAVE_OPT1(old_test1);
     1562  if (TEST_OPT_RETURN_SB) si_opt_1 |= Sy_bit(OPT_REDTAIL_SYZ);
    15121563  if (addOnlyOne)
    15131564  {
    1514     BITSET old_test1;
    1515     SI_SAVE_OPT1(old_test1);
    15161565    if(!rField_is_Ring(currRing)) si_opt_1 |= Sy_bit(OPT_SB_1);
    15171566    s_h3 = kStd(s_h4,currRing->qideal,hom,&weights1,NULL,0/*kmax-1*/,IDELEMS(s_h4)-1);
    1518     SI_RESTORE_OPT1(old_test1);
    15191567  }
    15201568  else
     
    15221570    s_h3 = kStd(s_h4,currRing->qideal,hom,&weights1,NULL,kmax-1);
    15231571  }
     1572  SI_RESTORE_OPT1(old_test1);
    15241573  #if 0
    15251574  // only together with the above debug stuff
     
    18941943            p_Delete(&q,currRing);
    18951944          }
    1896         }
     1945        }
    18971946        /*delete the matrix tmp*/
    18981947        for (i=1; i<=ar; i++)
     
    23292378
    23302379  idTest(s_temp);
    2331   unsigned save_opt=si_opt_1;
     2380  unsigned save_opt;
     2381  SI_SAVE_OPT1(save_opt);
    23322382  si_opt_1 |= Sy_bit(OPT_REDTAIL_SYZ);
    23332383  ideal s_temp1 = kStd(s_temp,currRing->qideal,hom,&wtmp,NULL,length);
    2334   si_opt_1=save_opt;
     2384  SI_RESTORE_OPT1(save_opt);
    23352385
    23362386  //if (wtmp!=NULL)  Print("output weights:");wtmp->show(1);PrintLn();
     
    28952945      //    if (mm[i]!=0) Print("x_%d:%d ",i,mm[i]);
    28962946      //PrintLn();
    2897       memset(&strat->P,0,sizeof(strat->P));
     2947      strat->P.Init(currRing);
     2948      //memset(&strat->P,0,sizeof(strat->P));
    28982949      strat->P.tailRing = strat->tailRing;
    28992950      strat->P.p=p;
     
    29462997      //    if (mm[i]!=0) Print("x_%d:%d ",i,mm[i]);
    29472998      //PrintLn();
    2948       memset(&strat->P,0,sizeof(strat->P));
     2999      strat->P.Init(currRing);
     3000      //memset(&strat->P,0,sizeof(strat->P));
    29493001      strat->P.tailRing = strat->tailRing;
    29503002      strat->P.t_p=p;
Note: See TracChangeset for help on using the changeset viewer.