Changeset 64f0ca in git


Ignore:
Timestamp:
Feb 22, 2012, 9:48:23 PM (11 years ago)
Author:
Oleksandr Motsak <motsak@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
Children:
232bbd53fe67fd62379e6eb97d8195caeb29d405
Parents:
80ca3c62104a8ede71139b7dae3090f767870f7c
git-author:
Oleksandr Motsak <motsak@mathematik.uni-kl.de>2012-02-22 21:48:23+01:00
git-committer:
Oleksandr Motsak <motsak@mathematik.uni-kl.de>2012-02-23 20:35:08+01:00
Message:
proper hack for SCA

fix: SCA test + initialization
fix: GB over a SCA
add: "ring-dependent" wrapper of kNF (for SCA test)
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • kernel/Makefile.am

    r80ca3c r64f0ca  
    3030SOURCES = polys.cc febase.cc feread.cc \
    3131    hdegree.cc hilb.cc hutil.cc \
    32     gr_kstd2.cc \
    3332    ideals.cc \
    3433    khstd.cc kstdfac.cc \
    3534    kstd1.cc kstd2.cc kutil.cc \
     35    nc.cc sca.cc gr_kstd2.cc \
    3636    misc.cc \
    3737    fast_maps.cc \
     
    4646    tgb.cc tgbgauss.cc ringgb.cc f5data.cc f5lists.cc f5gb.cc f5c.cc \
    4747    ratgring.cc shiftgb.cc gfan.cc \
    48     linearAlgebra.cc nc.cc preimage.cc \
     48    linearAlgebra.cc preimage.cc \
    4949    mod2.h
    5050
  • kernel/kstd1.cc

    r80ca3c r64f0ca  
    21412141
    21422142  return res;
     2143}
     2144
     2145poly kNF (ideal F, ideal Q, poly p,int syzComp, int lazyReduce, const ring _currRing)
     2146{
     2147  const ring save = currRing; if( currRing != _currRing ) rChangeCurrRing(_currRing);
     2148  poly ret = kNF(F, Q, p, syzComp, lazyReduce);
     2149  if( currRing != save )     rChangeCurrRing(save);
     2150  return ret;
    21432151}
    21442152
  • kernel/kstd1.h

    r80ca3c r64f0ca  
    2626poly kNF (ideal F, ideal Q, poly p,int syzComp=0, int lazyReduce=0);
    2727ideal kNF(ideal F, ideal Q, ideal p,int syzComp=0, int lazyReduce=0);
     28
     29/// NOTE: this is just a wrapper which sets currRing for the actual kNF call
     30poly kNF (ideal F, ideal Q, poly p,int syzComp, int lazyReduce, const ring _currRing);
    2831
    2932ideal kStd(ideal F, ideal Q, tHomog h, intvec ** mw,intvec *hilb=NULL,
  • kernel/nc.h

    r80ca3c r64f0ca  
    4444  if( gb == NULL)
    4545  {
     46    if( rIsSCA(r) )
     47    {
     48      if (rHasLocalOrMixedOrdering(r))
     49        gb = sca_mora;
     50      else
     51        gb = sca_bba; // sca_gr_bba???
     52    } else
     53    {
    4654      if (rHasLocalOrMixedOrdering(r))
    4755        gb = gnc_gr_mora;
    4856      else
    4957        gb = gnc_gr_bba;
     58    }
    5059   
    5160    r->GetNC()->p_Procs.GB = cast_A_to_vptr(gb);
  • kernel/sca.cc

    r80ca3c r64f0ca  
     1#define PLURAL_INTERNAL_DECLARATIONS
     2
    13#include "mod2.h"
    24#include <misc/auxiliary.h>
     
    57
    68#include <polys/simpleideals.h>
    7 #include <kernel/polys.h>
    8 
    99#include <polys/prCopy.h>
    1010
     11#include <polys/nc/sca.h>
     12#include <polys/nc/gb_hack.h>
     13
     14#include "polys.h"
    1115#include "ideals.h"
    1216#include "kstd1.h"
     17#include "kutil.h"
    1318
    1419#include "nc.h"
    1520
    16 /*
     21/// nc_gr_initBba is needed for sca_gr_bba and gr_bba.
     22void nc_gr_initBba(ideal F, kStrategy strat); // from gr_kstd2.cc!
     23
    1724void addLObject(LObject& h, kStrategy& strat)
    1825{
     
    2532  int pos=posInS(strat, strat->sl, h.p, h.ecart);
    2633
    27   if ( (pos <= strat->sl) && (pComparePolys(h.p, strat->S[pos])) )
     34  if ( (pos <= strat->sl) && (p_ComparePolys(h.p, strat->S[pos], currRing)) )
    2835  {
    2936    if (TEST_OPT_PROT)
     
    8895}
    8996
    90 */
    9197
    9298ideal sca_gr_bba(const ideal F, const ideal Q, const intvec *, const intvec *, kStrategy strat, const ring _currRing)
    9399{
    94 /*
     100  const ring save = currRing;
     101  if( currRing != _currRing ) rChangeCurrRing(_currRing);
     102  assume( currRing == _currRing );
     103
     104 
    95105#if MYTEST
    96106   PrintS("<sca_gr_bba>\n");
     
    186196    if (TEST_OPT_DEGBOUND
    187197    && ((strat->honey
    188     && (strat->L[strat->Ll].ecart+pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
    189        || ((!strat->honey) && (pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))))
     198    && (strat->L[strat->Ll].ecart+ currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
     199       || ((!strat->honey) && (currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))))
    190200    {
    191201      // stops computation if
     
    321331  exitBuchMora(strat);
    322332
    323   if (TEST_OPT_WEIGHTM)
    324   {
    325     pFDeg=pFDegOld;
    326     pLDeg=pLDegOld;
    327     if (ecartWeights)
    328     {
    329       omFreeSize((ADDRESS)ecartWeights,(pVariables+1)*sizeof(int));
    330       ecartWeights=NULL;
    331     }
    332   }
     333//  if (TEST_OPT_WEIGHTM)
     334//  {
     335//    pRestoreDegProcs(currRing,pFDegOld, pLDegOld);
     336//     if (ecartWeights)
     337//     {
     338//       omFreeSize((ADDRESS)ecartWeights,(rVar(currRing)+1)*sizeof(int));
     339//       ecartWeights=NULL;
     340//     }
     341//  }
    333342
    334343  if (TEST_OPT_PROT) messageStat(hilbcount,strat);
     
    353362#endif
    354363
     364  if( currRing != save )     rChangeCurrRing(save);
     365 
    355366  return (strat->Shdl);
    356 */
    357367}
    358368
     
    364374
    365375// Under development!!!
    366 ideal sca_bba (const ideal F, const ideal Q, const intvec *w, const intvec * /*hilb*/, kStrategy strat)
     376ideal sca_bba (const ideal F, const ideal Q, const intvec *w, const intvec * /*hilb*/, kStrategy strat, const ring _currRing)
    367377{
    368 /*
     378  const ring save = currRing;
     379  if( currRing != _currRing ) rChangeCurrRing(_currRing);
     380  assume( currRing == _currRing );
     381
    369382#if MYTEST
    370383  PrintS("\n\n<sca_bba>\n\n");
     
    547560
    548561    if (TEST_OPT_DEGBOUND
    549         && ((strat->honey && (strat->L[strat->Ll].ecart+pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
    550             || ((!strat->honey) && (pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))))
     562        && ((strat->honey && (strat->L[strat->Ll].ecart+currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
     563            || ((!strat->honey) && (currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))))
    551564    {
    552565
     
    560573      while ((strat->Ll >= 0)
    561574        && ( (strat->homog==isHomog) || strat->L[strat->Ll].is_special || ((strat->L[strat->Ll].p1!=NULL) && (strat->L[strat->Ll].p2!=NULL)) )
    562         && ((strat->honey && (strat->L[strat->Ll].ecart+pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
    563             || ((!strat->honey) && (pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg)))
     575        && ((strat->honey && (strat->L[strat->Ll].ecart+currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
     576            || ((!strat->honey) && (currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg)))
    564577            )
    565578      {
     
    813826  id_Delete(&tempF, currRing);
    814827
    815   if (TEST_OPT_WEIGHTM)
    816   {
    817     pRestoreDegProcs(pFDegOld, pLDegOld);
    818     if (ecartWeights)
    819     {
    820       omFreeSize((ADDRESS)ecartWeights,(pVariables+1)*sizeof(short));
    821       ecartWeights=NULL;
    822     }
    823   }
     828//  if (TEST_OPT_WEIGHTM)
     829//  {
     830//    pRestoreDegProcs(currRing, pFDegOld, pLDegOld);
     831//     if (ecartWeights)
     832//     {
     833//       omFreeSize((ADDRESS)ecartWeights,(rVar(currRing)+1)*sizeof(short));
     834//       ecartWeights=NULL;
     835//     }
     836//  }
    824837
    825838  if (TEST_OPT_PROT) messageStat(hilbcount,strat);
     
    844857#endif
    845858
     859  if( currRing != save )     rChangeCurrRing(save);
     860 
    846861  return (strat->Shdl);
    847 */
    848862}
    849863
     
    851865// sca mora...
    852866
    853 /*
    854867// returns TRUE if mora should use buckets, false otherwise
    855868static BOOLEAN kMoraUseBucket(kStrategy strat)
     
    877890  return FALSE;
    878891}
    879 */
    880892
    881893#ifdef HAVE_ASSUME
     
    887899ideal sca_mora(const ideal F, const ideal Q, const intvec *w, const intvec *, kStrategy strat, const ring _currRing)
    888900{
    889 /*
     901  const ring save = currRing;
     902  if( currRing != _currRing ) rChangeCurrRing(_currRing);
     903  assume( currRing == _currRing );
     904
    890905  assume(rIsSCA(currRing));
    891906
     
    11971212  {
    11981213    if (strat->kHEdge!=NULL)
    1199       Kstd1_mu=pFDeg(strat->kHEdge,currRing);
     1214      Kstd1_mu=currRing->pFDeg(strat->kHEdge,currRing);
    12001215    else
    12011216      Kstd1_mu=-1;
     
    12051220  strat->lastAxis = 0; //???
    12061221  pDelete(&strat->kNoether);
    1207   omFreeSize((ADDRESS)strat->NotUsedAxis,(pVariables+1)*sizeof(BOOLEAN));
     1222  omFreeSize((ADDRESS)strat->NotUsedAxis,(rVar(currRing)+1)*sizeof(BOOLEAN));
    12081223  if (TEST_OPT_PROT) messageStat(hilbcount,strat);
    1209   if (TEST_OPT_WEIGHTM)
    1210   {
    1211     pRestoreDegProcs(pFDegOld, pLDegOld);
    1212     if (ecartWeights)
    1213     {
    1214       omFreeSize((ADDRESS)ecartWeights,(pVariables+1)*sizeof(short));
    1215       ecartWeights=NULL;
    1216     }
    1217   }
     1224//  if (TEST_OPT_WEIGHTM)
     1225//  {
     1226//    pRestoreDegProcs(currRing, pFDegOld, pLDegOld);
     1227//     if (ecartWeights)
     1228//     {
     1229//       omFreeSize((ADDRESS)ecartWeights,(rVar(currRing)+1)*sizeof(short));
     1230//       ecartWeights=NULL;
     1231//     }
     1232//  }
    12181233  if (tempQ!=NULL) updateResult(strat->Shdl,tempQ,strat);
    12191234  idTest(strat->Shdl);
     
    12211236  id_Delete( &tempF, currRing);
    12221237
     1238  if( currRing != save )     rChangeCurrRing(save);
     1239 
    12231240  return (strat->Shdl);
    1224 */
    12251241}
    12261242
    1227 
    1228 
    1229 
    1230 
  • libpolys/polys/nc/sca.cc

    r80ca3c r64f0ca  
    3030#include <polys/nc/sca.h>
    3131#include <polys/nc/nc.h>
     32#include <polys/nc/gb_hack.h>
    3233// #include <polys/gring.h>
    3334
     
    10461047        {
    10471048#if ((defined(PDEBUG) && OUTPUT) || MYTEST)
    1048            Print("Wrong Coeff at: [%d, %d]\n", i, j);
     1049          Print("Wrong Coeff at: [%d, %d]\n", i, j);
    10491050#endif
    10501051          return false;
     
    10551056        {
    10561057#if ((defined(PDEBUG) && OUTPUT) || MYTEST)
    1057            Print("Wrong Coeff at: [%d, %d]\n", i, j);
     1058          Print("Wrong Coeff at: [%d, %d]\n", i, j);
    10581059#endif
    10591060          return false;
     
    11091110  for ( int i = iAltVarStart; (i <= iAltVarEnd) && bSCA; i++ )
    11101111    if( (i < b) || (i > e) ) // otherwise it's ok since rG is an SCA!
    1111   {
    1112     poly square = p_One( rG);
    1113     p_SetExp(square, i, 2, rG); // square = var(i)^2.
    1114     p_Setm(square, rG);
    1115 
    1116     // square = NF( var(i)^2 | Q )
    1117     // NOTE: rSaveRing == currRing now!
    1118     // NOTE: there is no better way to check this in general!
    1119     //
    1120 //////    TODO!!!!!
    1121 //////    extern poly kNF(ideal I, ideal Q, poly f, int a, int b, const ring r);
    1122 //////    square = kNF(idQuotient, NULL, square, 0, 1, rG); // must ran in currRing == rG!
    1123 
    1124     if( square != NULL ) // var(i)^2 is not in Q?
    1125     {
    1126       p_Delete(&square, rG);
    1127       bSCA = false;
    1128       break;
    1129     }
    1130   }
    1131 
    1132 //  assureCurrentRing(rSaveRing);
    1133 
    1134   if(!bSCA)
    1135   {
    1136     WarnS("sca_SetupQuotient: Sorry can not use NF: unfixed implementational issue :(");
    1137     return false;
    1138   }
    1139    
    1140 
    1141 
     1112    {
     1113      poly square = p_One( rG);
     1114      p_SetExp(square, i, 2, rG); // square = var(i)^2.
     1115      p_Setm(square, rG);
     1116
     1117      // square = NF( var(i)^2 | Q )
     1118      // NOTE: there is no better way to check this in general!
     1119      square = kNF(idQuotient, NULL, square, 0, 1, rG); // must ran in currRing == rG!
     1120
     1121      if( square != NULL ) // var(i)^2 is not in Q?
     1122      {
     1123        p_Delete(&square, rG);
     1124        bSCA = false;
     1125        break;
     1126      }
     1127    }
     1128 
    11421129#if ((defined(PDEBUG) && OUTPUT) || MYTEST)
    11431130  Print("ScaVars!: [%d, %d]\n", iAltVarStart, iAltVarEnd);
     
    12871274//         r->GetNC()->BucketPolyRed_Z()= gnc_kBucketPolyRed_Z;
    12881275#endif
     1276
     1277  // local ordering => Mora, otherwise - Buchberger!       
     1278  if (rHasLocalOrMixedOrdering(rGR))
     1279    rGR->GetNC()->p_Procs.GB          = cast_A_to_vptr(sca_mora);
     1280  else
     1281    rGR->GetNC()->p_Procs.GB          = cast_A_to_vptr(sca_bba); // sca_gr_bba?
    12891282}
    12901283
  • libpolys/polys/nc/sca.h

    r80ca3c r64f0ca  
    5555// return x_i * pPoly; preserve pPoly.
    5656poly sca_pp_Mult_xi_pp(unsigned int i, const poly pPoly, const ring rRing);
    57 
    58 // set pProcs for r and the variable p_Procs
    59 // should be used by nc_p_ProcsSet in "gring.h"
    60 void sca_p_ProcsSet(ring rGR, p_Procs_s* p_Procs);
    6157
    6258//////////////////////////////////////////////////////////////////////////////////////
     
    156152#ifdef PLURAL_INTERNAL_DECLARATIONS
    157153
     154// set pProcs for r and the variable p_Procs
     155// should be used by nc_p_ProcsSet in "gring.h"
     156void sca_p_ProcsSet(ring rGR, p_Procs_s* p_Procs);
     157
    158158// should be used only inside nc_SetupQuotient!
    159159// Check whether this our case:
     
    179179// #define scaFirstAltVar(R) 0
    180180// #define scaLastAltVar(R) 0
    181 #endif
     181#endif // HAVE_PLURAL
     182
    182183#endif // #ifndef SCA_H
Note: See TracChangeset for help on using the changeset viewer.