Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends
CReducerFinder Class Reference

#include <syzextra.h>

Public Types

typedef long TComponentKey
 
typedef std::vector< const CLeadingTerm * > TReducers
 

Public Member Functions

 CReducerFinder (const ideal L, const SchreyerSyzygyComputationFlags &flags)
 goes over all leading terms More...
 
void Initialize (const ideal L)
 
 ~CReducerFinder ()
 
poly FindReducer (const poly multiplier, const poly monom, const poly syzterm, const CReducerFinder &checker) const
 
poly FindReducer (const poly product, const poly syzterm, const CReducerFinder &checker) const
 
bool IsDivisible (const poly q) const
 
bool IsNonempty () const
 
int PreProcessTerm (const poly t, CReducerFinder &syzChecker) const
 is the term to be "preprocessed" as lower order term or lead to only reducible syzygies... More...
 
void DebugPrint () const
 
void Verify () const
 
- Public Member Functions inherited from SchreyerSyzygyComputationFlags
 SchreyerSyzygyComputationFlags (idhdl rootRingHdl)
 
 SchreyerSyzygyComputationFlags (const SchreyerSyzygyComputationFlags &attr)
 
void nextSyzygyLayer () const
 

Private Types

typedef std::map< TComponentKey, TReducersCReducersHash
 

Private Member Functions

 CReducerFinder (const CReducerFinder &)
 
void operator= (const CReducerFinder &)
 

Private Attributes

ideal m_L
 only for debug More...
 
CReducersHash m_hash
 

Friends

class CDivisorEnumerator2
 
class CDivisorEnumerator
 

Additional Inherited Members

- Data Fields inherited from SchreyerSyzygyComputationFlags
const int OPT__DEBUG
 output all the intermediate states More...
 
const int OPT__LEAD2SYZ
 ? More...
 
const int OPT__TAILREDSYZ
 Reduce syzygy tails wrt the leading syzygy terms. More...
 
const int OPT__HYBRIDNF
 Use the usual NF's S-poly reduction while dropping lower order terms 2 means - smart selection! More...
 
const int OPT__IGNORETAILS
 ignore tails and compute the pure Schreyer frame More...
 
int OPT__SYZNUMBER
 Syzygy level (within a resolution) More...
 
const int OPT__TREEOUTPUT
 output lifting tree More...
 
const int OPT__SYZCHECK
 CheckSyzygyProperty: TODO. More...
 
const bool OPT__PROT
 TEST_OPT_PROT. More...
 
const int OPT__NOCACHING
 no caching/stores/lookups More...
 
const ring m_rBaseRing
 global base ring More...
 

Detailed Description

Definition at line 308 of file syzextra.h.

Member Typedef Documentation

§ CReducersHash

Definition at line 320 of file syzextra.h.

§ TComponentKey

Definition at line 316 of file syzextra.h.

§ TReducers

Definition at line 317 of file syzextra.h.

Constructor & Destructor Documentation

§ CReducerFinder() [1/2]

CReducerFinder::CReducerFinder ( const ideal  L,
const SchreyerSyzygyComputationFlags flags 
)

goes over all leading terms

Definition at line 2150 of file syzextra.cc.

2150  :
2152  m_L(const_cast<ideal>(L)), // for debug anyway
2153  m_hash()
2154 {
2155  assume( flags.m_rBaseRing == m_rBaseRing );
2156  if( L != NULL )
2157  Initialize(L);
2158 }
CReducersHash m_hash
Definition: syzextra.h:356
void Initialize(const ideal L)
Definition: syzextra.cc:2126
#define NULL
Definition: omList.c:10
SchreyerSyzygyComputationFlags(idhdl rootRingHdl)
Definition: syzextra.cc:2034
const ring m_rBaseRing
global base ring
Definition: syzextra.h:241
ideal m_L
only for debug
Definition: syzextra.h:354
assume(R !=NULL)

§ ~CReducerFinder()

CReducerFinder::~CReducerFinder ( )

Definition at line 2115 of file syzextra.cc.

2116 {
2117  for( CReducersHash::const_iterator it = m_hash.begin(); it != m_hash.end(); it++ )
2118  {
2119  const TReducers& v = it->second;
2120  for(TReducers::const_iterator vit = v.begin(); vit != v.end(); vit++ )
2121  delete const_cast<CLeadingTerm*>(*vit);
2122  }
2123 }
std::vector< const CLeadingTerm * > TReducers
Definition: syzextra.h:317
CReducersHash m_hash
Definition: syzextra.h:356
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37

§ CReducerFinder() [2/2]

CReducerFinder::CReducerFinder ( const CReducerFinder )
private

Member Function Documentation

§ DebugPrint()

void CReducerFinder::DebugPrint ( ) const

§ FindReducer() [1/2]

poly CReducerFinder::FindReducer ( const poly  multiplier,
const poly  monom,
const poly  syzterm,
const CReducerFinder checker 
) const

Definition at line 2602 of file syzextra.cc.

2605 {
2606  const ring& r = m_rBaseRing;
2607 
2608 #ifndef SING_NDEBUG
2609  if( OPT__DEBUG ) { Verify(); syz_checker.Verify(); }
2610 #endif
2611 
2612  p_Test(multiplier, r);
2613 
2614  CDivisorEnumerator2 itr(*this, multiplier, t);
2615  if( !itr.Reset() )
2616  return NULL;
2617 
2618  // don't care about the module component of multiplier (as it may be the syzygy term)
2619  // product = multiplier * t?
2620 
2621  assume( multiplier != NULL ); assume( t != NULL );
2622 
2623  const ideal& L = m_L; assume( L != NULL ); // for debug/testing only!
2624 
2625  long c = 0;
2626 
2627  if (syzterm != NULL)
2628  c = p_GetComp(syzterm, r) - 1;
2629 
2630  assume( c >= 0 && c < IDELEMS(L) );
2631 
2632  p_Test(multiplier, r);
2633 
2634  if (UNLIKELY( OPT__DEBUG && (syzterm != NULL) ))
2635  {
2636  const poly m = L->m[c]; assume( m != NULL ); assume( pNext(m) == NULL );
2637 
2638  // def @@c = leadcomp(syzterm); int @@r = int(@@c);
2639  // def @@product = leadmonomial(syzterm) * L[@@r];
2640  poly lm = p_Mult_mm( leadmonom(syzterm, r, true), m, r); // !NC :(
2641  poly pr = p_Mult_q( leadmonom(multiplier, r, true), leadmonom(t, r, false), r); // !NC :(
2642 
2643  assume( p_EqualPolys(lm, pr, r) );
2644 
2645  p_Delete(&lm, r);
2646  p_Delete(&pr, r);
2647  }
2648 
2649 #ifndef SING_NDEBUG
2650  if( OPT__DEBUG ) { Verify(); syz_checker.Verify(); }
2651 #endif
2652 
2653  const BOOLEAN to_check = (syz_checker.IsNonempty()); // OPT__TAILREDSYZ &&
2654 
2655 // const poly q = p_One(r);
2656  const poly q = p_New(r); pNext(q) = NULL;
2657 
2658  if( UNLIKELY(OPT__DEBUG) )
2659  p_SetCoeff0(q, 0, r); // for printing q
2660 
2661  assume( pNext(q) == NULL );
2662 
2663  p_Test(multiplier, r);
2664  while( itr.MoveNext() )
2665  {
2666  assume( itr.Current().CheckLT( L ) ); // ???
2667 
2668  const poly p = itr.Current().lt(); // ???
2669  const int k = itr.Current().label();
2670 
2671  p_ExpVectorSum(q, multiplier, t, r); // q == product == multiplier * t // TODO: do it once?
2672  p_ExpVectorDiff(q, q, p, r); // (LM(product) / LM(L[k]))
2673 
2674  p_SetComp(q, k + 1, r);
2675  p_Setm(q, r);
2676 
2677  p_Test(multiplier, r);
2678 
2679  // cannot allow something like: a*gen(i) - a*gen(i)
2680  if (syzterm != NULL && (k == c))
2681  if (p_ExpVectorEqual(syzterm, q, r))
2682  {
2683 #ifndef SING_NDEBUG
2684  if( OPT__DEBUG )
2685  {
2686  PrintS("_FindReducer::Test SYZTERM: q == syzterm !:((, syzterm is: ");
2687  dPrint(syzterm, r, r, 0);
2688  }
2689 #endif
2690  assume( itr.Current().CheckLT( L ) ); // ???
2691  continue;
2692  }
2693 
2694  // while the complement (the fraction) is not reducible by leading syzygies
2695  if( to_check && syz_checker.IsDivisible(q) )
2696  {
2697 #ifndef SING_NDEBUG
2698  if( OPT__DEBUG )
2699  {
2700  PrintS("_FindReducer::Test LS: q is divisible by LS[?] !:((: ");
2701  }
2702 #endif
2703  assume( itr.Current().CheckLT( L ) ); // ???
2704  continue;
2705  }
2706 
2707  number n = n_Mult( pGetCoeff(multiplier), pGetCoeff(t), r->cf);
2708 
2709 #if NODIVISION
2710  // we assume all leading coeffs to be 1!
2711  assume( n_IsOne(pGetCoeff(p), r->cf) );
2712 #else
2713  if( !n_IsOne( pGetCoeff(p), r ) )
2714  n = n_Div(n, pGetCoeff(p), r->cf);
2715 #endif
2716 
2717  p_SetCoeff0(q, n_InpNeg(n, r->cf), r);
2718 // n_Delete(&n, r);
2719 
2720 #ifndef SING_NDEBUG
2721  if( OPT__DEBUG ) { Verify(); syz_checker.Verify(); }
2722 #endif
2723  p_Test(multiplier, r);
2724  p_Test(q, r);
2725 
2726  assume( itr.Current().CheckLT( L ) ); // ???
2727  return q;
2728  }
2729 
2730 /*
2731  const long comp = p_GetComp(t, r); assume( comp >= 0 );
2732  const unsigned long not_sev = ~p_GetShortExpVector(multiplier, t, r); // !
2733 
2734 // for( int k = IDELEMS(L)-1; k>= 0; k-- )
2735 // {
2736 // const poly p = L->m[k];
2737 //
2738 // if ( p_GetComp(p, r) != comp )
2739 // continue;
2740 //
2741 // const unsigned long p_sev = p_GetShortExpVector(p, r); // to be stored in m_hash!!!
2742 
2743  // looking for an appropriate diviser p = L[k]...
2744  CReducersHash::const_iterator it = m_hash.find(comp); // same module component
2745 
2746  if( it == m_hash.end() )
2747  return NULL;
2748 
2749  // assume comp!
2750 
2751  assume( m_L != NULL );
2752 
2753  const TReducers& reducers = it->second;
2754 
2755  for(TReducers::const_iterator vit = reducers.begin(); vit != reducers.end(); vit++ )
2756  {
2757 
2758  const poly p = (*vit)->lt(); // ??
2759  const int k = (*vit)->label();
2760 
2761  assume( L->m[k] == p ); // CheckLT
2762 
2763 // const unsigned long p_sev = (*vit)->sev();
2764 // assume( p_sev == p_GetShortExpVector(p, r) );
2765 
2766 // if( !p_LmShortDivisibleByNoComp(p, p_sev, product, not_sev, r) )
2767 // continue;
2768 
2769  if( !(*vit)->DivisibilityCheck(multiplier, t, not_sev, r) )
2770  continue;
2771 
2772 
2773 // if (p_sev & not_sev) continue;
2774 // if( !_p_LmDivisibleByNoComp(p, multiplier, t, r) ) continue;
2775 
2776 
2777  p_ExpVectorSum(q, multiplier, t, r); // q == product == multiplier * t
2778  p_ExpVectorDiff(q, q, p, r); // (LM(product) / LM(L[k]))
2779 
2780  p_SetComp(q, k + 1, r);
2781  p_Setm(q, r);
2782 
2783  // cannot allow something like: a*gen(i) - a*gen(i)
2784  if (syzterm != NULL && (k == c))
2785  if (p_ExpVectorEqual(syzterm, q, r))
2786  {
2787  if( OPT__DEBUG )
2788  {
2789  PrintS("_FindReducer::Test SYZTERM: q == syzterm !:((, syzterm is: ");
2790  dPrint(syzterm, r, r, 0);
2791  }
2792 
2793  continue;
2794  }
2795 
2796  // while the complement (the fraction) is not reducible by leading syzygies
2797  if( to_check && syz_checker.IsDivisible(q) )
2798  {
2799  if( OPT__DEBUG )
2800  {
2801  PrintS("_FindReducer::Test LS: q is divisible by LS[?] !:((: ");
2802  }
2803 
2804  continue;
2805  }
2806 
2807  number n = n_Mult( p_GetCoeff(multiplier, r), p_GetCoeff(t, r), r);
2808  p_SetCoeff0(q, n_InpNeg( n_Div(n, p_GetCoeff(p, r), r), r), r);
2809  n_Delete(&n, r);
2810 
2811  return q;
2812  }
2813 */
2814 
2815  p_LmFree(q, r);
2816 
2817 #ifndef SING_NDEBUG
2818  if( OPT__DEBUG ) { Verify(); syz_checker.Verify(); }
2819 #endif
2820 
2821  p_Test(multiplier, r);
2822 
2823  return NULL;
2824 
2825 }
poly leadmonom(const poly p, const ring r, const bool bSetZeroComp)
return a new term: leading coeff * leading monomial of p with 0 leading component! ...
Definition: syzextra.cc:473
return P p
Definition: myNF.cc:203
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff &#39;n&#39; represents the one element.
Definition: coeffs.h:472
static poly p_Mult_mm(poly p, poly m, const ring r)
Definition: p_polys.h:968
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:242
#define p_GetComp(p, r)
Definition: monomials.h:72
int k
Definition: cfEzgcd.cc:93
#define UNLIKELY(expression)
Definition: tgb_internal.h:838
const int OPT__DEBUG
output all the intermediate states
Definition: syzextra.h:204
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
static void p_LmFree(poly p, ring)
Definition: p_polys.h:678
static FORCE_INLINE number n_Mult(number a, number b, const coeffs r)
return the product of &#39;a&#39; and &#39;b&#39;, i.e., a*b
Definition: coeffs.h:640
const ring r
Definition: syzextra.cc:208
void Verify() const
int m
Definition: cfEzgcd.cc:119
static FORCE_INLINE number n_InpNeg(number n, const coeffs r)
in-place negation of n MUST BE USED: n = n_InpNeg(n) (no copy is returned)
Definition: coeffs.h:561
void PrintS(const char *s)
Definition: reporter.cc:284
#define IDELEMS(i)
Definition: simpleideals.h:24
BOOLEAN p_EqualPolys(poly p1, poly p2, const ring r)
Definition: p_polys.cc:4320
#define p_Test(p, r)
Definition: p_polys.h:160
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
static void p_ExpVectorDiff(poly pr, poly p1, poly p2, const ring r)
Definition: p_polys.h:1397
#define NULL
Definition: omList.c:10
static FORCE_INLINE number n_Div(number a, number b, const coeffs r)
return the quotient of &#39;a&#39; and &#39;b&#39;, i.e., a/b; raises an error if &#39;b&#39; is not invertible in r exceptio...
Definition: coeffs.h:619
const ring m_rBaseRing
global base ring
Definition: syzextra.h:241
#define pNext(p)
Definition: monomials.h:43
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:228
ideal m_L
only for debug
Definition: syzextra.h:354
#define p_SetCoeff0(p, n, r)
Definition: monomials.h:68
static void p_ExpVectorSum(poly pr, poly p1, poly p2, const ring r)
Definition: p_polys.h:1348
static BOOLEAN p_ExpVectorEqual(poly p1, poly p2, const ring r1, const ring r2)
Definition: p_polys.cc:4334
polyrec * poly
Definition: hilb.h:10
static poly p_New(const ring, omBin bin)
Definition: p_polys.h:659
void dPrint(const ideal id, const ring lmRing=currRing, const ring tailRing=currRing, const int nTerms=0)
prints an ideal, optionally with details
int BOOLEAN
Definition: auxiliary.h:86
static poly p_Mult_q(poly p, poly q, const ring r)
Definition: p_polys.h:1020
assume(R !=NULL)

§ FindReducer() [2/2]

poly CReducerFinder::FindReducer ( const poly  product,
const poly  syzterm,
const CReducerFinder checker 
) const

Definition at line 2829 of file syzextra.cc.

2830 {
2831 
2832 #ifndef SING_NDEBUG
2833  if( OPT__DEBUG ) { Verify(); syz_checker.Verify(); }
2834 #endif
2835 
2836  CDivisorEnumerator itr(*this, product);
2837  if( !itr.Reset() )
2838  return NULL;
2839 
2840 
2841 
2842  const ring& r = m_rBaseRing;
2843 
2844  assume( product != NULL );
2845 
2846  const ideal& L = m_L; assume( L != NULL ); // for debug/testing only!
2847 
2848  long c = 0;
2849 
2850  if (syzterm != NULL)
2851  c = p_GetComp(syzterm, r) - 1;
2852 
2853  assume( c >= 0 && c < IDELEMS(L) );
2854 
2855  if (UNLIKELY( OPT__DEBUG && (syzterm != NULL) ))
2856  {
2857  const poly m = L->m[c];
2858 
2859  assume( m != NULL ); assume( pNext(m) == NULL );
2860 
2861  poly lm = p_Mult_mm(leadmonom(syzterm, r), m, r);
2862  assume( p_EqualPolys(lm, product, r) );
2863 
2864  // def @@c = leadcomp(syzterm); int @@r = int(@@c);
2865  // def @@product = leadmonomial(syzterm) * L[@@r];
2866 
2867  p_Delete(&lm, r);
2868  }
2869 
2870 #ifndef SING_NDEBUG
2871  if( OPT__DEBUG ) { Verify(); syz_checker.Verify(); }
2872 #endif
2873 
2874  const BOOLEAN to_check = (syz_checker.IsNonempty()); // OPT__TAILREDSYZ &&
2875 
2876  const poly q = p_New(r); pNext(q) = NULL;
2877 
2878  if( UNLIKELY(OPT__DEBUG) )
2879  p_SetCoeff0(q, 0, r); // ONLY for printing q
2880 
2881  while( itr.MoveNext() )
2882  {
2883  assume( itr.Current().CheckLT( L ) ); // ???
2884 
2885  const poly p = itr.Current().lt(); // ??
2886  const int k = itr.Current().label();
2887 
2888  p_ExpVectorDiff(q, product, p, r); // (LM(product) / LM(L[k]))
2889  p_SetComp(q, k + 1, r);
2890  p_Setm(q, r);
2891 
2892  // cannot allow something like: a*gen(i) - a*gen(i)
2893  if (syzterm != NULL && (k == c))
2894  if (p_ExpVectorEqual(syzterm, q, r))
2895  {
2896 #ifndef SING_NDEBUG
2897  if( OPT__DEBUG )
2898  {
2899  PrintS("_FindReducer::Test SYZTERM: q == syzterm !:((, syzterm is: ");
2900  dPrint(syzterm, r, r, 0);
2901  }
2902 #endif
2903  assume( itr.Current().CheckLT( L ) ); // ???
2904  continue;
2905  }
2906 
2907  // while the complement (the fraction) is not reducible by leading syzygies
2908  if( to_check && syz_checker.IsDivisible(q) ) // ?????
2909  {
2910 #ifndef SING_NDEBUG
2911  if( OPT__DEBUG )
2912  {
2913  PrintS("_FindReducer::Test LS: q is divisible by LS[?] !:((: ");
2914  }
2915 #endif
2916  assume( itr.Current().CheckLT( L ) ); // ???
2917  continue;
2918  }
2919 
2920 
2921 #if NODIVISION
2922  assume( n_IsOne(p_GetCoeff(p, r), r->cf) );
2923  p_SetCoeff0(q, n_InpNeg( n_Copy(pGetCoeff(product), r->cf), r->cf), r);
2924 #else
2925  p_SetCoeff0(q, n_InpNeg( n_Div( pGetCoeff(product), p_GetCoeff(p), r->cf), r->cf), r);
2926 #endif
2927 
2928  assume( itr.Current().CheckLT( L ) ); // ???
2929 
2930 #ifndef SING_NDEBUG
2931  if( OPT__DEBUG ) { Verify(); syz_checker.Verify(); }
2932 #endif
2933 
2934  return q;
2935  }
2936 
2937 
2938 
2939 /*
2940  const long comp = p_GetComp(product, r);
2941  const unsigned long not_sev = ~p_GetShortExpVector(product, r);
2942 
2943  assume( comp >= 0 );
2944 
2945 // for( int k = IDELEMS(L)-1; k>= 0; k-- )
2946 // {
2947 // const poly p = L->m[k];
2948 //
2949 // if ( p_GetComp(p, r) != comp )
2950 // continue;
2951 //
2952 // const unsigned long p_sev = p_GetShortExpVector(p, r); // to be stored in m_hash!!!
2953 
2954  // looking for an appropriate diviser p = L[k]...
2955  CReducersHash::const_iterator it = m_hash.find(comp); // same module component
2956 
2957  if( it == m_hash.end() )
2958  return NULL;
2959 
2960  assume( m_L != NULL );
2961 
2962  const TReducers& reducers = it->second;
2963 
2964  const BOOLEAN to_check = (syz_checker.IsNonempty()); // OPT__TAILREDSYZ &&
2965 
2966  const poly q = p_New(r); pNext(q) = NULL;
2967 
2968  if( OPT__DEBUG )
2969  p_SetCoeff0(q, 0, r); // for printing q
2970 
2971  for(TReducers::const_iterator vit = reducers.begin(); vit != reducers.end(); vit++ )
2972  {
2973  const poly p = (*vit)->lt(); // ???
2974 
2975  assume( p_GetComp(p, r) == comp );
2976 
2977  const int k = (*vit)->label();
2978 
2979  assume( L->m[k] == p ); // CheckLT
2980 
2981  const unsigned long p_sev = (*vit)->sev();
2982 
2983  assume( p_sev == p_GetShortExpVector(p, r) );
2984 
2985  if( !p_LmShortDivisibleByNoComp(p, p_sev, product, not_sev, r) )
2986  continue;
2987 
2988 // // ... which divides the product, looking for the _1st_ appropriate one!
2989 // if( !p_LmDivisibleByNoComp(p, product, r) ) // included inside p_LmShortDivisibleBy!
2990 // continue;
2991 
2992  p_ExpVectorDiff(q, product, p, r); // (LM(product) / LM(L[k]))
2993  p_SetComp(q, k + 1, r);
2994  p_Setm(q, r);
2995 
2996  // cannot allow something like: a*gen(i) - a*gen(i)
2997  if (syzterm != NULL && (k == c))
2998  if (p_ExpVectorEqual(syzterm, q, r))
2999  {
3000  if( OPT__DEBUG )
3001  {
3002  PrintS("_FindReducer::Test SYZTERM: q == syzterm !:((, syzterm is: ");
3003  dPrint(syzterm, r, r, 0);
3004  }
3005 
3006  continue;
3007  }
3008 
3009  // while the complement (the fraction) is not reducible by leading syzygies
3010  if( to_check && syz_checker.IsDivisible(q) )
3011  {
3012  if( OPT__DEBUG )
3013  {
3014  PrintS("_FindReducer::Test LS: q is divisible by LS[?] !:((: ");
3015  }
3016 
3017  continue;
3018  }
3019 
3020  p_SetCoeff0(q, n_InpNeg( n_Div( p_GetCoeff(product, r), p_GetCoeff(p, r), r), r), r);
3021  return q;
3022  }
3023 */
3024 
3025  p_LmFree(q, r);
3026 
3027 #ifndef SING_NDEBUG
3028  if( OPT__DEBUG ) { Verify(); syz_checker.Verify(); }
3029 #endif
3030 
3031  return NULL;
3032 }
poly leadmonom(const poly p, const ring r, const bool bSetZeroComp)
return a new term: leading coeff * leading monomial of p with 0 leading component! ...
Definition: syzextra.cc:473
return P p
Definition: myNF.cc:203
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff &#39;n&#39; represents the one element.
Definition: coeffs.h:472
static poly p_Mult_mm(poly p, poly m, const ring r)
Definition: p_polys.h:968
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:242
#define p_GetComp(p, r)
Definition: monomials.h:72
int k
Definition: cfEzgcd.cc:93
#define UNLIKELY(expression)
Definition: tgb_internal.h:838
const int OPT__DEBUG
output all the intermediate states
Definition: syzextra.h:204
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
static void p_LmFree(poly p, ring)
Definition: p_polys.h:678
const ring r
Definition: syzextra.cc:208
void Verify() const
int m
Definition: cfEzgcd.cc:119
static FORCE_INLINE number n_InpNeg(number n, const coeffs r)
in-place negation of n MUST BE USED: n = n_InpNeg(n) (no copy is returned)
Definition: coeffs.h:561
void PrintS(const char *s)
Definition: reporter.cc:284
#define IDELEMS(i)
Definition: simpleideals.h:24
BOOLEAN p_EqualPolys(poly p1, poly p2, const ring r)
Definition: p_polys.cc:4320
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
static void p_ExpVectorDiff(poly pr, poly p1, poly p2, const ring r)
Definition: p_polys.h:1397
#define NULL
Definition: omList.c:10
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of &#39;n&#39;
Definition: coeffs.h:455
static FORCE_INLINE number n_Div(number a, number b, const coeffs r)
return the quotient of &#39;a&#39; and &#39;b&#39;, i.e., a/b; raises an error if &#39;b&#39; is not invertible in r exceptio...
Definition: coeffs.h:619
const ring m_rBaseRing
global base ring
Definition: syzextra.h:241
#define pNext(p)
Definition: monomials.h:43
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:228
ideal m_L
only for debug
Definition: syzextra.h:354
#define p_GetCoeff(p, r)
Definition: monomials.h:57
#define p_SetCoeff0(p, n, r)
Definition: monomials.h:68
static BOOLEAN p_ExpVectorEqual(poly p1, poly p2, const ring r1, const ring r2)
Definition: p_polys.cc:4334
polyrec * poly
Definition: hilb.h:10
static poly p_New(const ring, omBin bin)
Definition: p_polys.h:659
void dPrint(const ideal id, const ring lmRing=currRing, const ring tailRing=currRing, const int nTerms=0)
prints an ideal, optionally with details
int BOOLEAN
Definition: auxiliary.h:86
assume(R !=NULL)

§ Initialize()

void CReducerFinder::Initialize ( const ideal  L)

Definition at line 2126 of file syzextra.cc.

2127 {
2128  assume( m_L == NULL || m_L == L );
2129  if( m_L == NULL )
2130  m_L = L;
2131 
2132  assume( m_L == L );
2133 
2134  if( L != NULL )
2135  {
2136  const ring& R = m_rBaseRing;
2137  assume( R != NULL );
2138 
2139  for( int k = IDELEMS(L) - 1; k >= 0; k-- )
2140  {
2141  const poly a = L->m[k]; // assume( a != NULL );
2142 
2143  // NOTE: label is k \in 0 ... |L|-1!!!
2144  if( a != NULL )
2145  m_hash[p_GetComp(a, R)].push_back( new CLeadingTerm(k, a, R) );
2146  }
2147  }
2148 }
const poly a
Definition: syzextra.cc:212
#define p_GetComp(p, r)
Definition: monomials.h:72
int k
Definition: cfEzgcd.cc:93
CReducersHash m_hash
Definition: syzextra.h:356
const ring R
Definition: DebugPrint.cc:36
#define IDELEMS(i)
Definition: simpleideals.h:24
#define NULL
Definition: omList.c:10
const ring m_rBaseRing
global base ring
Definition: syzextra.h:241
ideal m_L
only for debug
Definition: syzextra.h:354
polyrec * poly
Definition: hilb.h:10
assume(R !=NULL)

§ IsDivisible()

bool CReducerFinder::IsDivisible ( const poly  q) const

Definition at line 2372 of file syzextra.cc.

2373 {
2374 #ifndef SING_NDEBUG
2375  if( OPT__DEBUG ) Verify();
2376 #endif
2377 
2378  assume( product != NULL );
2379 
2380  // NOTE: q may have no coeff!!!
2381 
2382  CDivisorEnumerator itr(*this, product);
2383  if( !itr.Reset() )
2384  return false;
2385 
2386  return itr.MoveNext();
2387 
2388 /*
2389  const ring& r = m_rBaseRing;
2390 
2391  const long comp = p_GetComp(product, r);
2392  const unsigned long not_sev = ~p_GetShortExpVector(product, r);
2393 
2394  assume( comp >= 0 );
2395 
2396  CReducersHash::const_iterator it = m_hash.find(comp); // same module component
2397 
2398  assume( m_L != NULL );
2399 
2400  if( it == m_hash.end() )
2401  return false;
2402  // assume comp!
2403 
2404  const TReducers& reducers = it->second;
2405 
2406  for(TReducers::const_iterator vit = reducers.begin(); vit != reducers.end(); vit++ )
2407  {
2408  assume( (*vit)->CheckLT( m_L ) );
2409 
2410  if( (*vit)->DivisibilityCheck(product, not_sev, r) )
2411  {
2412  if( OPT__DEBUG )
2413  {
2414  Print("_FindReducer::Test LS: q is divisible by LS[%d] !:((, diviser is: ", 1 + (*vit)->label());
2415  dPrint((*vit)->lt(), r, r, 0);
2416  }
2417 
2418  return true;
2419  }
2420  }
2421 
2422  return false;
2423 */
2424 }
const int OPT__DEBUG
output all the intermediate states
Definition: syzextra.h:204
void Verify() const
#define NULL
Definition: omList.c:10
assume(R !=NULL)

§ IsNonempty()

bool CReducerFinder::IsNonempty ( ) const
inline

Definition at line 343 of file syzextra.h.

343 { return !m_hash.empty(); }
CReducersHash m_hash
Definition: syzextra.h:356

§ operator=()

void CReducerFinder::operator= ( const CReducerFinder )
private

§ PreProcessTerm()

int CReducerFinder::PreProcessTerm ( const poly  t,
CReducerFinder syzChecker 
) const

is the term to be "preprocessed" as lower order term or lead to only reducible syzygies...

Definition at line 589 of file syzextra.cc.

590 {
591  assume( t != NULL );
592 
594  assume( !IsDivisible(t) ); // each input term should NOT be in <L>
595 
596  const ring r = m_rBaseRing;
597 
598 
599  if( LIKELY(OPT__TAILREDSYZ) )
600  if( p_LmIsConstant(t, r) ) // most basic case of baing coprime with L, whatever that is...
601  return 1; // TODO: prove this...?
602 
603  // return false; // appears to be fine
604 
605  const long comp = p_GetComp(t, r);
606 
607  CReducersHash::const_iterator itr = m_hash.find(comp);
608 
609  if ( itr == m_hash.end() )
610  return 2; // no such leading component!!!
611 
612  assume( itr->first == comp );
613 
614  const bool bIdealCase = (comp == 0);
615  const bool bSyzCheck = syzChecker.IsNonempty(); // need to check even in ideal case????? proof? "&& !bIdealCase"
616 
617  if( LIKELY(OPT__TAILREDSYZ && (bIdealCase || bSyzCheck)) )
618  {
619  const TReducers& v = itr->second;
620  const int N = rVar(r);
621  // TODO: extract exps of t beforehand?!
622  bool coprime = true;
623  for(TReducers::const_iterator vit = v.begin(); (vit != v.end()) && coprime; ++vit )
624  {
625  assume( (*vit)->CheckLT( m_L ) );
626 
627  const poly p = (*vit)->lt();
628 
629  assume( p_GetComp(p, r) == comp );
630 
631  // TODO: check if coprime with Leads... if OPT__TAILREDSYZ !
632  for( int var = N; var > 0; --var )
633  if( (p_GetExp(p, var, r) != 0) && (p_GetExp(t, var, r) != 0) )
634  {
635 #ifndef SING_NDEBUG
636  if( OPT__DEBUG | 0)
637  {
638  PrintS("CReducerFinder::PreProcessTerm, 't' is NOT co-prime with the following leading term: \n");
639  dPrint(p, r, r, 0);
640  }
641 #endif
642  coprime = false; // t not coprime with p!
643  break;
644  }
645 
646  if( bSyzCheck && coprime )
647  {
648  poly ss = p_LmInit(t, r);
649  p_SetCoeff0(ss, n_Init(1, r->cf), r); // for delete & printout only!...
650  p_SetComp(ss, (*vit)->label() + 1, r); // coeff?
651  p_Setm(ss, r);
652 
653  coprime = ( syzChecker.IsDivisible(ss) );
654 
655 #ifndef SING_NDEBUG
656  if( OPT__DEBUG && !coprime)
657  {
658  PrintS("CReducerFinder::PreProcessTerm, 't' is co-prime with p but may lead to NOT divisible syz.term: \n");
659  dPrint(ss, r, r, 0);
660  }
661 #endif
662 
663  p_LmDelete(&ss, r); // deletes coeff as well???
664  }
665 
666  assume( p == (*vit)->lt() );
667  assume( (*vit)->CheckLT( m_L ) );
668  }
669 
670 #ifndef SING_NDEBUG
671  if( OPT__DEBUG && coprime )
672  PrintS("CReducerFinder::PreProcessTerm, the following 't' is 'co-prime' with all of leading terms! \n");
673 #endif
674 
675  return coprime? 3: 0; // t was coprime with all of leading terms!!!
676 
677  }
678  // return true; // delete the term
679 
680  return 0;
681 }
return P p
Definition: myNF.cc:203
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:242
#define p_GetComp(p, r)
Definition: monomials.h:72
std::vector< const CLeadingTerm * > TReducers
Definition: syzextra.h:317
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
Definition: coeffs.h:542
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:580
#define UNLIKELY(expression)
Definition: tgb_internal.h:838
#define LIKELY(expression)
Definition: tgb_internal.h:837
const int OPT__DEBUG
output all the intermediate states
Definition: syzextra.h:204
const int OPT__TAILREDSYZ
Reduce syzygy tails wrt the leading syzygy terms.
Definition: syzextra.h:210
int comp(const CanonicalForm &A, const CanonicalForm &B)
compare polynomials
static BOOLEAN p_LmIsConstant(const poly p, const ring r)
Definition: p_polys.h:949
CReducersHash m_hash
Definition: syzextra.h:356
const ring r
Definition: syzextra.cc:208
const CanonicalForm CFMap CFMap & N
Definition: cfEzgcd.cc:49
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:464
void PrintS(const char *s)
Definition: reporter.cc:284
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
#define NULL
Definition: omList.c:10
const ring m_rBaseRing
global base ring
Definition: syzextra.h:241
static poly p_LmInit(poly p, const ring r)
Definition: p_polys.h:1258
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:228
ideal m_L
only for debug
Definition: syzextra.h:354
bool IsDivisible(const poly q) const
Definition: syzextra.cc:2372
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:706
#define p_SetCoeff0(p, n, r)
Definition: monomials.h:68
polyrec * poly
Definition: hilb.h:10
void dPrint(const ideal id, const ring lmRing=currRing, const ring tailRing=currRing, const int nTerms=0)
prints an ideal, optionally with details
assume(R !=NULL)
bool IsNonempty() const
Definition: syzextra.h:343

§ Verify()

void CReducerFinder::Verify ( ) const

Friends And Related Function Documentation

§ CDivisorEnumerator

friend class CDivisorEnumerator
friend

Definition at line 313 of file syzextra.h.

§ CDivisorEnumerator2

friend class CDivisorEnumerator2
friend

Definition at line 311 of file syzextra.h.

Field Documentation

§ m_hash

CReducersHash CReducerFinder::m_hash
private

Definition at line 356 of file syzextra.h.

§ m_L

ideal CReducerFinder::m_L
private

only for debug

Definition at line 354 of file syzextra.h.


The documentation for this class was generated from the following files: