Changeset 80ca3c in git


Ignore:
Timestamp:
Feb 22, 2012, 9:32:50 PM (11 years ago)
Author:
Oleksandr Motsak <motsak@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
Children:
64f0ca8d7049bea31d0e107cf5c613e0b6ffa5d3
Parents:
1adae39f1ae788b310c426226af46794834f1fac
git-author:
Oleksandr Motsak <motsak@mathematik.uni-kl.de>2012-02-22 21:32:50+01:00
git-committer:
Oleksandr Motsak <motsak@mathematik.uni-kl.de>2012-02-23 20:35:08+01:00
Message:
NC-subsystem preparations

fix: gnc_GB properly
add: gb_hack.h to help handling the circular dependency (GB&NC)
chg: moved stuff around and misc changes
Files:
1 added
8 edited

Legend:

Unmodified
Added
Removed
  • kernel/gr_kstd2.cc

    r1adae39 r80ca3c  
    2121#include <polys/monomials/ring.h>
    2222
     23#include <polys/nc/gb_hack.h>
    2324#include <polys/nc/nc.h>
    2425#include <polys/nc/sca.h>
     
    3233//#include "cntrlc.h"
    3334#include <kernel/ratgring.h>
    34 
    3535#include <kernel/kutil.h>
     36
     37#include <kernel/nc.h>
    3638
    3739#if 0
     
    10431045#define MYTEST 0
    10441046
    1045 ideal gnc_gr_bba(const ideal F, const ideal Q, const intvec *, const intvec *, kStrategy strat)
     1047ideal gnc_gr_bba(const ideal F, const ideal Q, const intvec *, const intvec *, kStrategy strat, const ring _currRing)
    10461048{
     1049  const ring save = currRing; if( currRing != _currRing ) rChangeCurrRing(_currRing);
     1050
    10471051#if MYTEST
    10481052   PrintS("<gnc_gr_bba>\n");
     
    12981302#endif
    12991303
     1304  if( currRing != save )     rChangeCurrRing(save);
     1305 
    13001306  return (strat->Shdl);
    13011307}
    13021308
    1303 ideal gnc_gr_mora(const ideal, const ideal, const intvec *, const intvec *, kStrategy)
     1309ideal gnc_gr_mora(const ideal F, const ideal Q, const intvec *, const intvec *, kStrategy strat, const ring _currRing)
    13041310{
    1305   PrintS("Sorry, non-commutative mora is not yet implemented!");
    1306   PrintLn();
    1307 
     1311#ifndef NDEBUG
    13081312  // Not yet!
    1309   return NULL;
     1313  WarnS("Sorry, non-commutative mora is not yet implemented!");
     1314#endif
     1315
     1316  return gnc_gr_bba(F, Q, NULL, NULL, strat, _currRing);
    13101317}
    13111318
  • kernel/nc.cc

    r1adae39 r80ca3c  
     1#define PLURAL_INTERNAL_DECLARATIONS
     2   
    13#include "mod2.h"
    24#include <misc/auxiliary.h>
     
    57
    68#include <polys/simpleideals.h>
     9#include <polys/prCopy.h>
     10#include <polys/nc/gb_hack.h>
     11
    712#include <kernel/polys.h>
    813
    9 #include <polys/prCopy.h>
    10 
    11 #include "ideals.h"
    12 #include "kstd1.h"
    13 
    14 #include "nc.h"
     14#include <kernel/ideals.h>
     15#include <kernel/kstd1.h>
     16
     17#include <kernel/nc.h>
    1518
    1619ideal twostd(ideal I) // works in currRing only!
     
    411414  }
    412415}
    413 
  • kernel/nc.h

    r1adae39 r80ca3c  
    11#ifndef KERNEL_NC_H
    22#define KERNEL_NC_H
     3
    34#ifdef HAVE_PLURAL
     5
     6#ifdef PLURAL_INTERNAL_DECLARATIONS
     7
     8# include <polys/nc/gb_hack.h>
     9
     10#else // #ifdef PLURAL_INTERNAL_DECLARATIONS
     11
     12# define PLURAL_INTERNAL_DECLARATIONS
     13# include <polys/nc/gb_hack.h>
     14# undef PLURAL_INTERNAL_DECLARATIONS
     15
     16#endif // #ifdef PLURAL_INTERNAL_DECLARATIONS
     17
     18
     19#include <misc/auxiliary.h>
    420
    521#include <polys/nc/nc.h>
     
    723
    824#include <kernel/polys.h>
     25
     26
     27
     28static inline ideal nc_GB(const ideal F, const ideal Q, const intvec *w, const intvec *hilb, kStrategy strat, const ring r)
     29{
     30  assume(rIsPluralRing(r));
     31  assume(r->GetNC()->p_Procs.GB!=NULL);
     32
     33  GB_Proc_Ptr gb = cast_A_to_B<void*, GB_Proc_Ptr>(r->GetNC()->p_Procs.GB);
     34
     35  // NOTE: the following code block is a hack in order to make a linker to
     36  // believe in these functions but in reallity it should not be used.
     37  // Although it can also serve as an illustration for the
     38  // NC-initialization procedure for GB hidden away (hackedly) in
     39  // libpolys.
     40  // The only other solution would be to separate GB and the whole NC
     41  // subsystems from both libpolys AND kernel... which would require
     42  // too much effort and thus cannot be done right now.
     43  // Therefore this is a TODO for a future (large-scale) cleanup.
     44  if( gb == NULL)
     45  {
     46      if (rHasLocalOrMixedOrdering(r))
     47        gb = gnc_gr_mora;
     48      else
     49        gb = gnc_gr_bba;
     50   
     51    r->GetNC()->p_Procs.GB = cast_A_to_vptr(gb);
     52  }
     53
     54  return gb(F, Q, w, hilb, strat, r);
     55}
    956
    1057/// Compute two-sided GB:
     
    1461ideal Approx_Step(ideal L);
    1562
    16 class skStrategy;
    17 typedef skStrategy * kStrategy;
     63#endif // HAVE_PLURAL
    1864
    19 // ideal gnc_gr_mora(const ideal, const ideal, const intvec *, const intvec *, kStrategy/*, const ring r*/); // Not yet!
    20 ideal gnc_gr_bba (const ideal F, const ideal Q, const intvec *, const intvec *, kStrategy strat/*, const ring r*/);
    21 
    22 
    23 static inline ideal nc_GB(const ideal F, const ideal Q, const intvec *w, const intvec *hilb, kStrategy strat, const ring r)
    24 {
    25   assume(rIsPluralRing(r));
    26    
    27   const ring save = currRing;
    28    
    29   if( save != r )
    30      rChangeCurrRing(r);
    31    
    32 ///////////  rGR->GetNC()->p_Procs.GB          = gnc_gr_bba; // bba even for local case!
    33 // old ///    r->GetNC()->GB()            = gnc_gr_bba;
    34    
    35 //   rGR->GetNC()->p_Procs.GlobalGB    = gnc_gr_bba;
    36 //   rGR->GetNC()->p_Procs.LocalGB     = gnc_gr_mora;
    37    
    38 //  assume(r->GetNC()->p_Procs.GB!=NULL);
    39 //  return r->GetNC()->p_Procs.GB(F, Q, w, hilb, strat, r);
    40   ideal res = gnc_gr_bba(F, Q, w, hilb, strat/*, r*/);
    41    
    42    
    43 /*
    44 // Modified Plural's Buchberger's algorithmus.
    45 ideal sca_gr_bba(const ideal F, const ideal Q, const intvec *, const intvec *, kStrategy strat, const ring _currRing);
    46 
    47 // Modified modern Sinuglar Buchberger's algorithm.
    48 ideal sca_bba(const ideal F, const ideal Q, const intvec *w, const intvec *, kStrategy strat, const ring _currRing);
    49 
    50 // Modified modern Sinuglar Mora's algorithm.
    51 ideal sca_mora(const ideal F, const ideal Q, const intvec *w, const intvec *, kStrategy strat, const ring _currRing);
    52 */
    53 
    54    
    55 /*
    56   if (rHasLocalOrMixedOrdering(rGR))
    57   {
    58 #ifdef PDEBUG
    59 //           Print("Local case => GB == mora!\n");
    60 #endif
    61     rGR->GetNC()->p_Procs.GB          = NULL; // sca_mora; // local ordering => Mora, otherwise - Buchberger!
    62   }
    63   else
    64   {
    65 #ifdef PDEBUG
    66 //           Print("Global case => GB == bba!\n");
    67 #endif
    68     rGR->GetNC()->p_Procs.GB          = NULL; // sca_bba; // sca_gr_bba; // sca_bba? // sca_bba;
    69   }
    70 //   rGR->GetNC()->p_Procs.GlobalGB    = sca_gr_bba;
    71 //   rGR->GetNC()->p_Procs.LocalGB     = sca_mora;
    72 
    73    
    74 /////        r->GetNC()->GB()            = sca_gr_bba;
    75 */
    76   if( save != r )
    77      rChangeCurrRing(save);
    78    
    79   return (res);
    80 }
    81 /*
    82 
    83 // typedef ideal (*GB_Proc_Ptr)(const ideal F, const ideal Q, const intvec *w, const intvec *hilb, kStrategy strat, const ring r);
    84   GB_Proc_Ptr                           GB;
    85 //                                         GlobalGB, // BBA
    86 //                                         LocalGB;  // MORA
    87 */
    88 
    89 
    90 #ifdef PLURAL_INTERNAL_DECLARATIONS
    91 
    92 /// we need nc_gr_initBba for sca_gr_bba and gr_bba.
    93 void nc_gr_initBba(ideal F,kStrategy strat);
    94 #endif // PLURAL_INTERNAL_DECLARATIONS
    95 
    96 
    97 
    98 #endif // HAVE_PLURAL
    9965#endif // KERNEL_NC_H
  • libpolys/polys/Makefile.am

    r1adae39 r80ca3c  
    4343
    4444LIBPOLYSHEADERS = monomials/ring.h monomials/monomials.h \
    45         nc/nc.h nc/sca.h nc/summator.h nc/ncSAFormula.h nc/ncSACache.h nc/ncSAMult.h \
     45        nc/nc.h nc/sca.h nc/summator.h nc/ncSAFormula.h nc/ncSACache.h nc/ncSAMult.h nc/gb_hack.h \
    4646        operations/pShallowCopyDelete.h \
    4747        templates/p_Procs.h templates/p_MemAdd.h templates/p_MemCmp.h \
  • libpolys/polys/nc/nc.h

    r1adae39 r80ca3c  
    22#define POLYS_NC_H
    33
     4#include <polys/monomials/ring.h>
     5#include <polys/kbuckets.h>
    46
    57#ifdef HAVE_PLURAL
    6 
    7 
    88
    99// TODO: the following is a part of ring.h... would be nice to have a
    1010// clear public NC interface defined here!
    11 
    12 #include <polys/monomials/ring.h>
    13 #include <polys/kbuckets.h>
    1411
    1512
     
    7572  SPoly_Proc_Ptr                        SPoly;
    7673  SPolyReduce_Proc_Ptr                  ReduceSPoly;
     74
     75  void*                                 GB; ///< From "gb_hack.h"
     76//                                         GlobalGB, // BBA
     77//                                         LocalGB;  // MORA
    7778};
    7879
     
    312313}
    313314
    314 
    315315/* subst: */
    316316poly nc_pSubst(poly p, int n, poly e, const ring r);
    317 
    318 // set pProcs table for rGR and global variable p_Procs
    319 // this should be used by p_ProcsSet in p_Procs_Set.h
    320 void nc_p_ProcsSet(ring rGR, p_Procs_s* p_Procs);
    321 
    322317
    323318// the part, related to the interface
     
    332327
    333328
    334 BOOLEAN nc_rComplete(const ring src, ring dest, bool bSetupQuotient = true); // in ring.cc
    335 
    336329// this function should be used inside QRing definition!
    337330// we go from rG into factor ring rGR with factor ideal rGR->qideal.
    338331bool nc_SetupQuotient(ring rGR, const ring rG = NULL, bool bCopy = false); // rG == NULL means that there is no base G-algebra
    339332
     333BOOLEAN nc_rComplete(const ring src, ring dest, bool bSetupQuotient = true); // in ring.cc
    340334
    341335bool nc_rCopy(ring res, const ring r, bool bSetupQuotient);
     
    372366
    373367#ifdef PLURAL_INTERNAL_DECLARATIONS
     368
     369// set pProcs table for rGR and global variable p_Procs
     370// this should be used by p_ProcsSet in p_Procs_Set.h
     371void nc_p_ProcsSet(ring rGR, p_Procs_s* p_Procs);
     372
    374373
    375374#include <polys/matpol.h>
     
    398397}
    399398
    400 #endif /* PLURAL_INTERNAL_DECLARATIONS */
     399#endif // PLURAL_INTERNAL_DECLARATIONS
    401400
    402401#endif /* HAVE_PLURAL */
  • libpolys/polys/nc/old.gring.cc

    r1adae39 r80ca3c  
    2626#include "nc/nc.h"
    2727#include "nc/sca.h"
    28 
     28#include "nc/gb_hack.h"
     29
     30#include "monomials/ring.h"
     31   
    2932#include <coeffs/numbers.h>
    3033#include "coeffrings.h"
     
    121124poly gnc_mm_Mult_pp(const poly m, const poly p, const ring r);
    122125
    123 
    124 // set pProcs for r and global variable p_Procs as for general non-commutative algebras.
    125 void gnc_p_ProcsSet(ring rGR, p_Procs_s* p_Procs);
    126126
    127127/* syzygies : */
     
    27482748
    27492749
     2750
    27502751BOOLEAN gnc_InitMultiplication(ring r, bool bSetupQuotient = false); // just for a moment
    2751 
    2752 
    27532752
    27542753/// returns TRUE if there were errors
     
    30643063  // Setup new NC structure!!!
    30653064  if (r->GetNC() != NULL)
     3065  {
     3066#ifndef NDEBUG
     3067    WarnS("Changing the NC-structure of an existing NC-ring!!!");
     3068#endif   
    30663069    nc_rKill(r);
     3070  }
    30673071
    30683072  r->GetNC() = nc_new;
     
    31713175  }
    31723176  r->GetNC()->COM=COM;
     3177 
    31733178
    31743179  nc_p_ProcsSet(r, r->p_Procs);
    31753180
    31763181  if(bSetupQuotient) // Test me!!!
    3177   {
    3178     nc_SetupQuotient(r);
    3179   }
    3180 
    3181 
    3182   // ???
    3183   if( bNoPluralMultiplication )
    3184     ncInitSpecialPairMultiplication(r);
    3185 
    3186 
    3187   if(!rIsSCA(r) && !bNoFormula)
    3188     ncInitSpecialPowersMultiplication(r);
    3189 
    3190 
     3182    nc_SetupQuotient(r, NULL, false); // no copy!
     3183
     3184 
    31913185//  if (save != currRing)
    31923186//    rChangeCurrRing(save);
     
    31953189}
    31963190
     3191
     3192// set pProcs for r and global variable p_Procs as for general non-commutative algebras.
     3193static inline
    31973194void gnc_p_ProcsSet(ring rGR, p_Procs_s* p_Procs)
    31983195{
     
    32253222#endif
    32263223
    3227 
     3224  // warning: ISO C++ forbids casting between pointer-to-function and pointer-to-object?
     3225  if (rHasLocalOrMixedOrdering(rGR))
     3226    rGR->GetNC()->p_Procs.GB = cast_A_to_vptr(gnc_gr_mora);
     3227  else
     3228    rGR->GetNC()->p_Procs.GB = cast_A_to_vptr(gnc_gr_bba);
     3229
     3230///////////  rGR->GetNC()->p_Procs.GB          = gnc_gr_bba; // bba even for local case!
     3231// old ///    r->GetNC()->GB()            = gnc_gr_bba;
     3232//   rGR->GetNC()->p_Procs.GlobalGB    = gnc_gr_bba;
     3233//   rGR->GetNC()->p_Procs.LocalGB     = gnc_gr_mora;
     3234//  const ring save = currRing; if( save != r ) rChangeCurrRing(r);
     3235//  ideal res = gnc_gr_bba(F, Q, w, hilb, strat/*, r*/);
     3236//  if( save != r )     rChangeCurrRing(save);     return (res);
    32283237
    32293238
     
    32613270    sca_p_ProcsSet(rGR, p_Procs);
    32623271  }
    3263 }
    3264 
     3272
     3273  if( bNoPluralMultiplication )
     3274    ncInitSpecialPairMultiplication(rGR);
     3275
     3276  if(!rIsSCA(rGR) && !bNoFormula)
     3277    ncInitSpecialPowersMultiplication(rGR);
     3278
     3279}
    32653280
    32663281
  • libpolys/polys/nc/old.gring.h

    r1adae39 r80ca3c  
    121121}
    122122
    123 inline ideal nc_GB(const ideal F, const ideal Q, const intvec *w, const intvec *hilb, kStrategy strat)
    124 {
    125   assume(rIsPluralRing(currRing));
    126 
    127   assume(currRing->GetNC()->p_Procs.GB!=NULL);
    128   return currRing->GetNC()->p_Procs.GB(F, Q, w, hilb, strat);
    129 
    130 /*
    131   if (rHasLocalOrMixedOrder(currRing))
    132   {
    133     assume(currRing->GetNC()->p_Procs.LocalGB!=NULL);
    134     return currRing->GetNC()->p_Procs.LocalGB(F, Q, w, hilb, strat);
    135   } else
    136   {
    137     assume(currRing->GetNC()->p_Procs.GlobalGB!=NULL);
    138     return currRing->GetNC()->p_Procs.GlobalGB(F, Q, w, hilb, strat);
    139   }
    140 */
    141 }
    142 
    143 
    144 
    145 
    146123#endif //
  • libpolys/polys/templates/p_Procs_Set.h

    r1adae39 r80ca3c  
    1616#include <coeffs/modulop.h>
    1717
    18 #ifdef HAVE_PLURAL
    19 // for nc_p_ProcsSet:
    20 // #include <polys/nc/....h>
    21 #endif
    22 
    2318#include <reporter/reporter.h>
    2419
     
    140135}                                                           \
    141136while (0);
     137
     138void nc_p_ProcsSet(ring rGR, p_Procs_s* p_Procs);
    142139
    143140// Choose a set of p_Procs
     
    192189  if (rIsPluralRing(r))
    193190  {
    194      dReportError("Setting pProcs in p_ProcsSet (rDebugPrint!?)!!!");
    195      nc_p_ProcsSet(r, _p_procs); // Setup non-commutative p_Procs table!
     191    dReportError("Setting pProcs in p_ProcsSet (rDebugPrint!?)!!!");
     192    nc_p_ProcsSet(r, _p_procs); // Setup non-commutative p_Procs table!
    196193  }
    197194#endif
Note: See TracChangeset for help on using the changeset viewer.