Changeset 80ca3c in git for kernel/nc.h


Ignore:
Timestamp:
Feb 22, 2012, 9:32:50 PM (12 years ago)
Author:
Oleksandr Motsak <motsak@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
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
File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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
Note: See TracChangeset for help on using the changeset viewer.