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...
 
- 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 309 of file syzextra.h.

Member Typedef Documentation

◆ CReducersHash

Definition at line 321 of file syzextra.h.

◆ TComponentKey

Definition at line 317 of file syzextra.h.

◆ TReducers

Definition at line 318 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 2148 of file syzextra.cc.

2148  :
2150  m_L(const_cast<ideal>(L)), // for debug anyway
2151  m_hash()
2152 {
2153  assume( flags.m_rBaseRing == m_rBaseRing );
2154  if( L != NULL )
2155  Initialize(L);
2156 }
CReducersHash m_hash
Definition: syzextra.h:357
void Initialize(const ideal L)
Definition: syzextra.cc:2124
#define NULL
Definition: omList.c:10
SchreyerSyzygyComputationFlags(idhdl rootRingHdl)
Definition: syzextra.cc:2032
const ring m_rBaseRing
global base ring
Definition: syzextra.h:242
ideal m_L
only for debug
Definition: syzextra.h:355
int status int void size_t count int const void size_t count const char int flags
Definition: si_signals.h:73
assume(R !=NULL)

◆ ~CReducerFinder()

CReducerFinder::~CReducerFinder ( )

Definition at line 2113 of file syzextra.cc.

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

◆ CReducerFinder() [2/2]

CReducerFinder::CReducerFinder ( const CReducerFinder )
private

Member Function Documentation

◆ FindReducer() [1/2]

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

Definition at line 2600 of file syzextra.cc.

2603 {
2604  const ring& r = m_rBaseRing;
2605 
2606 #ifndef SING_NDEBUG
2607  if( OPT__DEBUG ) { Verify(); syz_checker.Verify(); }
2608 #endif
2609 
2610  p_Test(multiplier, r);
2611 
2612  CDivisorEnumerator2 itr(*this, multiplier, t);
2613  if( !itr.Reset() )
2614  return NULL;
2615 
2616  // don't care about the module component of multiplier (as it may be the syzygy term)
2617  // product = multiplier * t?
2618 
2619  assume( multiplier != NULL ); assume( t != NULL );
2620 
2621  const ideal& L = m_L; assume( L != NULL ); // for debug/testing only!
2622 
2623  long c = 0;
2624 
2625  if (syzterm != NULL)
2626  c = p_GetComp(syzterm, r) - 1;
2627 
2628  assume( c >= 0 && c < IDELEMS(L) );
2629 
2630  p_Test(multiplier, r);
2631 
2632  if (UNLIKELY( OPT__DEBUG && (syzterm != NULL) ))
2633  {
2634  const poly m = L->m[c]; assume( m != NULL ); assume( pNext(m) == NULL );
2635 
2636  // def @@c = leadcomp(syzterm); int @@r = int(@@c);
2637  // def @@product = leadmonomial(syzterm) * L[@@r];
2638  poly lm = p_Mult_mm( leadmonom(syzterm, r, true), m, r); // !NC :(
2639  poly pr = p_Mult_q( leadmonom(multiplier, r, true), leadmonom(t, r, false), r); // !NC :(
2640 
2641  assume( p_EqualPolys(lm, pr, r) );
2642 
2643  p_Delete(&lm, r);
2644  p_Delete(&pr, r);
2645  }
2646 
2647 #ifndef SING_NDEBUG
2648  if( OPT__DEBUG ) { Verify(); syz_checker.Verify(); }
2649 #endif
2650 
2651  const BOOLEAN to_check = (syz_checker.IsNonempty()); // OPT__TAILREDSYZ &&
2652 
2653 // const poly q = p_One(r);
2654  const poly q = p_New(r); pNext(q) = NULL;
2655 
2656  if( UNLIKELY(OPT__DEBUG) )
2657  p_SetCoeff0(q, 0, r); // for printing q
2658 
2659  assume( pNext(q) == NULL );
2660 
2661  p_Test(multiplier, r);
2662  while( itr.MoveNext() )
2663  {
2664  assume( itr.Current().CheckLT( L ) ); // ???
2665 
2666  const poly p = itr.Current().lt(); // ???
2667  const int k = itr.Current().label();
2668 
2669  p_ExpVectorSum(q, multiplier, t, r); // q == product == multiplier * t // TODO: do it once?
2670  p_ExpVectorDiff(q, q, p, r); // (LM(product) / LM(L[k]))
2671 
2672  p_SetComp(q, k + 1, r);
2673  p_Setm(q, r);
2674 
2675  p_Test(multiplier, r);
2676 
2677  // cannot allow something like: a*gen(i) - a*gen(i)
2678  if (syzterm != NULL && (k == c))
2679  if (p_ExpVectorEqual(syzterm, q, r))
2680  {
2681 #ifndef SING_NDEBUG
2682  if( OPT__DEBUG )
2683  {
2684  PrintS("_FindReducer::Test SYZTERM: q == syzterm !:((, syzterm is: ");
2685  dPrint(syzterm, r, r, 0);
2686  }
2687 #endif
2688  assume( itr.Current().CheckLT( L ) ); // ???
2689  continue;
2690  }
2691 
2692  // while the complement (the fraction) is not reducible by leading syzygies
2693  if( to_check && syz_checker.IsDivisible(q) )
2694  {
2695 #ifndef SING_NDEBUG
2696  if( OPT__DEBUG )
2697  {
2698  PrintS("_FindReducer::Test LS: q is divisible by LS[?] !:((: ");
2699  }
2700 #endif
2701  assume( itr.Current().CheckLT( L ) ); // ???
2702  continue;
2703  }
2704 
2705  number n = n_Mult( pGetCoeff(multiplier), pGetCoeff(t), r->cf);
2706 
2707 #if NODIVISION
2708  // we assume all leading coeffs to be 1!
2709  assume( n_IsOne(pGetCoeff(p), r->cf) );
2710 #else
2711  if( !n_IsOne( pGetCoeff(p), r ) )
2712  n = n_Div(n, pGetCoeff(p), r->cf);
2713 #endif
2714 
2715  p_SetCoeff0(q, n_InpNeg(n, r->cf), r);
2716 // n_Delete(&n, r);
2717 
2718 #ifndef SING_NDEBUG
2719  if( OPT__DEBUG ) { Verify(); syz_checker.Verify(); }
2720 #endif
2721  p_Test(multiplier, r);
2722  p_Test(q, r);
2723 
2724  assume( itr.Current().CheckLT( L ) ); // ???
2725  return q;
2726  }
2727 
2728 /*
2729  const long comp = p_GetComp(t, r); assume( comp >= 0 );
2730  const unsigned long not_sev = ~p_GetShortExpVector(multiplier, t, r); // !
2731 
2732 // for( int k = IDELEMS(L)-1; k>= 0; k-- )
2733 // {
2734 // const poly p = L->m[k];
2735 //
2736 // if ( p_GetComp(p, r) != comp )
2737 // continue;
2738 //
2739 // const unsigned long p_sev = p_GetShortExpVector(p, r); // to be stored in m_hash!!!
2740 
2741  // looking for an appropriate diviser p = L[k]...
2742  CReducersHash::const_iterator it = m_hash.find(comp); // same module component
2743 
2744  if( it == m_hash.end() )
2745  return NULL;
2746 
2747  // assume comp!
2748 
2749  assume( m_L != NULL );
2750 
2751  const TReducers& reducers = it->second;
2752 
2753  for(TReducers::const_iterator vit = reducers.begin(); vit != reducers.end(); vit++ )
2754  {
2755 
2756  const poly p = (*vit)->lt(); // ??
2757  const int k = (*vit)->label();
2758 
2759  assume( L->m[k] == p ); // CheckLT
2760 
2761 // const unsigned long p_sev = (*vit)->sev();
2762 // assume( p_sev == p_GetShortExpVector(p, r) );
2763 
2764 // if( !p_LmShortDivisibleByNoComp(p, p_sev, product, not_sev, r) )
2765 // continue;
2766 
2767  if( !(*vit)->DivisibilityCheck(multiplier, t, not_sev, r) )
2768  continue;
2769 
2770 
2771 // if (p_sev & not_sev) continue;
2772 // if( !_p_LmDivisibleByNoComp(p, multiplier, t, r) ) continue;
2773 
2774 
2775  p_ExpVectorSum(q, multiplier, t, r); // q == product == multiplier * t
2776  p_ExpVectorDiff(q, q, p, r); // (LM(product) / LM(L[k]))
2777 
2778  p_SetComp(q, k + 1, r);
2779  p_Setm(q, r);
2780 
2781  // cannot allow something like: a*gen(i) - a*gen(i)
2782  if (syzterm != NULL && (k == c))
2783  if (p_ExpVectorEqual(syzterm, q, r))
2784  {
2785  if( OPT__DEBUG )
2786  {
2787  PrintS("_FindReducer::Test SYZTERM: q == syzterm !:((, syzterm is: ");
2788  dPrint(syzterm, r, r, 0);
2789  }
2790 
2791  continue;
2792  }
2793 
2794  // while the complement (the fraction) is not reducible by leading syzygies
2795  if( to_check && syz_checker.IsDivisible(q) )
2796  {
2797  if( OPT__DEBUG )
2798  {
2799  PrintS("_FindReducer::Test LS: q is divisible by LS[?] !:((: ");
2800  }
2801 
2802  continue;
2803  }
2804 
2805  number n = n_Mult( p_GetCoeff(multiplier, r), p_GetCoeff(t, r), r);
2806  p_SetCoeff0(q, n_InpNeg( n_Div(n, p_GetCoeff(p, r), r), r), r);
2807  n_Delete(&n, r);
2808 
2809  return q;
2810  }
2811 */
2812 
2813  p_LmFree(q, r);
2814 
2815 #ifndef SING_NDEBUG
2816  if( OPT__DEBUG ) { Verify(); syz_checker.Verify(); }
2817 #endif
2818 
2819  p_Test(multiplier, r);
2820 
2821  return NULL;
2822 
2823 }
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:205
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
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:4367
#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:242
#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:355
#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:4381
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:85
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 2827 of file syzextra.cc.

2828 {
2829 
2830 #ifndef SING_NDEBUG
2831  if( OPT__DEBUG ) { Verify(); syz_checker.Verify(); }
2832 #endif
2833 
2834  CDivisorEnumerator itr(*this, product);
2835  if( !itr.Reset() )
2836  return NULL;
2837 
2838 
2839 
2840  const ring& r = m_rBaseRing;
2841 
2842  assume( product != NULL );
2843 
2844  const ideal& L = m_L; assume( L != NULL ); // for debug/testing only!
2845 
2846  long c = 0;
2847 
2848  if (syzterm != NULL)
2849  c = p_GetComp(syzterm, r) - 1;
2850 
2851  assume( c >= 0 && c < IDELEMS(L) );
2852 
2853  if (UNLIKELY( OPT__DEBUG && (syzterm != NULL) ))
2854  {
2855  const poly m = L->m[c];
2856 
2857  assume( m != NULL ); assume( pNext(m) == NULL );
2858 
2859  poly lm = p_Mult_mm(leadmonom(syzterm, r), m, r);
2860  assume( p_EqualPolys(lm, product, r) );
2861 
2862  // def @@c = leadcomp(syzterm); int @@r = int(@@c);
2863  // def @@product = leadmonomial(syzterm) * L[@@r];
2864 
2865  p_Delete(&lm, r);
2866  }
2867 
2868 #ifndef SING_NDEBUG
2869  if( OPT__DEBUG ) { Verify(); syz_checker.Verify(); }
2870 #endif
2871 
2872  const BOOLEAN to_check = (syz_checker.IsNonempty()); // OPT__TAILREDSYZ &&
2873 
2874  const poly q = p_New(r); pNext(q) = NULL;
2875 
2876  if( UNLIKELY(OPT__DEBUG) )
2877  p_SetCoeff0(q, 0, r); // ONLY for printing q
2878 
2879  while( itr.MoveNext() )
2880  {
2881  assume( itr.Current().CheckLT( L ) ); // ???
2882 
2883  const poly p = itr.Current().lt(); // ??
2884  const int k = itr.Current().label();
2885 
2886  p_ExpVectorDiff(q, product, p, r); // (LM(product) / LM(L[k]))
2887  p_SetComp(q, k + 1, r);
2888  p_Setm(q, r);
2889 
2890  // cannot allow something like: a*gen(i) - a*gen(i)
2891  if (syzterm != NULL && (k == c))
2892  if (p_ExpVectorEqual(syzterm, q, r))
2893  {
2894 #ifndef SING_NDEBUG
2895  if( OPT__DEBUG )
2896  {
2897  PrintS("_FindReducer::Test SYZTERM: q == syzterm !:((, syzterm is: ");
2898  dPrint(syzterm, r, r, 0);
2899  }
2900 #endif
2901  assume( itr.Current().CheckLT( L ) ); // ???
2902  continue;
2903  }
2904 
2905  // while the complement (the fraction) is not reducible by leading syzygies
2906  if( to_check && syz_checker.IsDivisible(q) ) // ?????
2907  {
2908 #ifndef SING_NDEBUG
2909  if( OPT__DEBUG )
2910  {
2911  PrintS("_FindReducer::Test LS: q is divisible by LS[?] !:((: ");
2912  }
2913 #endif
2914  assume( itr.Current().CheckLT( L ) ); // ???
2915  continue;
2916  }
2917 
2918 
2919 #if NODIVISION
2920  assume( n_IsOne(p_GetCoeff(p, r), r->cf) );
2921  p_SetCoeff0(q, n_InpNeg( n_Copy(pGetCoeff(product), r->cf), r->cf), r);
2922 #else
2923  p_SetCoeff0(q, n_InpNeg( n_Div( pGetCoeff(product), p_GetCoeff(p), r->cf), r->cf), r);
2924 #endif
2925 
2926  assume( itr.Current().CheckLT( L ) ); // ???
2927 
2928 #ifndef SING_NDEBUG
2929  if( OPT__DEBUG ) { Verify(); syz_checker.Verify(); }
2930 #endif
2931 
2932  return q;
2933  }
2934 
2935 
2936 
2937 /*
2938  const long comp = p_GetComp(product, r);
2939  const unsigned long not_sev = ~p_GetShortExpVector(product, r);
2940 
2941  assume( comp >= 0 );
2942 
2943 // for( int k = IDELEMS(L)-1; k>= 0; k-- )
2944 // {
2945 // const poly p = L->m[k];
2946 //
2947 // if ( p_GetComp(p, r) != comp )
2948 // continue;
2949 //
2950 // const unsigned long p_sev = p_GetShortExpVector(p, r); // to be stored in m_hash!!!
2951 
2952  // looking for an appropriate diviser p = L[k]...
2953  CReducersHash::const_iterator it = m_hash.find(comp); // same module component
2954 
2955  if( it == m_hash.end() )
2956  return NULL;
2957 
2958  assume( m_L != NULL );
2959 
2960  const TReducers& reducers = it->second;
2961 
2962  const BOOLEAN to_check = (syz_checker.IsNonempty()); // OPT__TAILREDSYZ &&
2963 
2964  const poly q = p_New(r); pNext(q) = NULL;
2965 
2966  if( OPT__DEBUG )
2967  p_SetCoeff0(q, 0, r); // for printing q
2968 
2969  for(TReducers::const_iterator vit = reducers.begin(); vit != reducers.end(); vit++ )
2970  {
2971  const poly p = (*vit)->lt(); // ???
2972 
2973  assume( p_GetComp(p, r) == comp );
2974 
2975  const int k = (*vit)->label();
2976 
2977  assume( L->m[k] == p ); // CheckLT
2978 
2979  const unsigned long p_sev = (*vit)->sev();
2980 
2981  assume( p_sev == p_GetShortExpVector(p, r) );
2982 
2983  if( !p_LmShortDivisibleByNoComp(p, p_sev, product, not_sev, r) )
2984  continue;
2985 
2986 // // ... which divides the product, looking for the _1st_ appropriate one!
2987 // if( !p_LmDivisibleByNoComp(p, product, r) ) // included inside p_LmShortDivisibleBy!
2988 // continue;
2989 
2990  p_ExpVectorDiff(q, product, p, r); // (LM(product) / LM(L[k]))
2991  p_SetComp(q, k + 1, r);
2992  p_Setm(q, r);
2993 
2994  // cannot allow something like: a*gen(i) - a*gen(i)
2995  if (syzterm != NULL && (k == c))
2996  if (p_ExpVectorEqual(syzterm, q, r))
2997  {
2998  if( OPT__DEBUG )
2999  {
3000  PrintS("_FindReducer::Test SYZTERM: q == syzterm !:((, syzterm is: ");
3001  dPrint(syzterm, r, r, 0);
3002  }
3003 
3004  continue;
3005  }
3006 
3007  // while the complement (the fraction) is not reducible by leading syzygies
3008  if( to_check && syz_checker.IsDivisible(q) )
3009  {
3010  if( OPT__DEBUG )
3011  {
3012  PrintS("_FindReducer::Test LS: q is divisible by LS[?] !:((: ");
3013  }
3014 
3015  continue;
3016  }
3017 
3018  p_SetCoeff0(q, n_InpNeg( n_Div( p_GetCoeff(product, r), p_GetCoeff(p, r), r), r), r);
3019  return q;
3020  }
3021 */
3022 
3023  p_LmFree(q, r);
3024 
3025 #ifndef SING_NDEBUG
3026  if( OPT__DEBUG ) { Verify(); syz_checker.Verify(); }
3027 #endif
3028 
3029  return NULL;
3030 }
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:205
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
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:4367
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:242
#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:355
#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:4381
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:85
assume(R !=NULL)

◆ Initialize()

void CReducerFinder::Initialize ( const ideal  L)

Definition at line 2124 of file syzextra.cc.

2125 {
2126  assume( m_L == NULL || m_L == L );
2127  if( m_L == NULL )
2128  m_L = L;
2129 
2130  assume( m_L == L );
2131 
2132  if( L != NULL )
2133  {
2134  const ring& R = m_rBaseRing;
2135  assume( R != NULL );
2136 
2137  for( int k = IDELEMS(L) - 1; k >= 0; k-- )
2138  {
2139  const poly a = L->m[k]; // assume( a != NULL );
2140 
2141  // NOTE: label is k \in 0 ... |L|-1!!!
2142  if( a != NULL )
2143  m_hash[p_GetComp(a, R)].push_back( new CLeadingTerm(k, a, R) );
2144  }
2145  }
2146 }
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:357
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:242
ideal m_L
only for debug
Definition: syzextra.h:355
polyrec * poly
Definition: hilb.h:10
assume(R !=NULL)

◆ IsDivisible()

bool CReducerFinder::IsDivisible ( const poly  q) const

Definition at line 2370 of file syzextra.cc.

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

◆ IsNonempty()

bool CReducerFinder::IsNonempty ( ) const
inline

Definition at line 344 of file syzextra.h.

344 { return !m_hash.empty(); }
CReducersHash m_hash
Definition: syzextra.h:357

◆ 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 587 of file syzextra.cc.

588 {
589  assume( t != NULL );
590 
592  assume( !IsDivisible(t) ); // each input term should NOT be in <L>
593 
594  const ring r = m_rBaseRing;
595 
596 
597  if( LIKELY(OPT__TAILREDSYZ) )
598  if( p_LmIsConstant(t, r) ) // most basic case of baing coprime with L, whatever that is...
599  return 1; // TODO: prove this...?
600 
601  // return false; // appears to be fine
602 
603  const long comp = p_GetComp(t, r);
604 
605  CReducersHash::const_iterator itr = m_hash.find(comp);
606 
607  if ( itr == m_hash.end() )
608  return 2; // no such leading component!!!
609 
610  assume( itr->first == comp );
611 
612  const bool bIdealCase = (comp == 0);
613  const bool bSyzCheck = syzChecker.IsNonempty(); // need to check even in ideal case????? proof? "&& !bIdealCase"
614 
615  if( LIKELY(OPT__TAILREDSYZ && (bIdealCase || bSyzCheck)) )
616  {
617  const TReducers& v = itr->second;
618  const int N = rVar(r);
619  // TODO: extract exps of t beforehand?!
620  bool coprime = true;
621  for(TReducers::const_iterator vit = v.begin(); (vit != v.end()) && coprime; ++vit )
622  {
623  assume( (*vit)->CheckLT( m_L ) );
624 
625  const poly p = (*vit)->lt();
626 
627  assume( p_GetComp(p, r) == comp );
628 
629  // TODO: check if coprime with Leads... if OPT__TAILREDSYZ !
630  for( int var = N; var > 0; --var )
631  if( (p_GetExp(p, var, r) != 0) && (p_GetExp(t, var, r) != 0) )
632  {
633 #ifndef SING_NDEBUG
634  if( OPT__DEBUG | 0)
635  {
636  PrintS("CReducerFinder::PreProcessTerm, 't' is NOT co-prime with the following leading term: \n");
637  dPrint(p, r, r, 0);
638  }
639 #endif
640  coprime = false; // t not coprime with p!
641  break;
642  }
643 
644  if( bSyzCheck && coprime )
645  {
646  poly ss = p_LmInit(t, r);
647  p_SetCoeff0(ss, n_Init(1, r->cf), r); // for delete & printout only!...
648  p_SetComp(ss, (*vit)->label() + 1, r); // coeff?
649  p_Setm(ss, r);
650 
651  coprime = ( syzChecker.IsDivisible(ss) );
652 
653 #ifndef SING_NDEBUG
654  if( OPT__DEBUG && !coprime)
655  {
656  PrintS("CReducerFinder::PreProcessTerm, 't' is co-prime with p but may lead to NOT divisible syz.term: \n");
657  dPrint(ss, r, r, 0);
658  }
659 #endif
660 
661  p_LmDelete(&ss, r); // deletes coeff as well???
662  }
663 
664  assume( p == (*vit)->lt() );
665  assume( (*vit)->CheckLT( m_L ) );
666  }
667 
668 #ifndef SING_NDEBUG
669  if( OPT__DEBUG && coprime )
670  PrintS("CReducerFinder::PreProcessTerm, the following 't' is 'co-prime' with all of leading terms! \n");
671 #endif
672 
673  return coprime? 3: 0; // t was coprime with all of leading terms!!!
674 
675  }
676  // return true; // delete the term
677 
678  return 0;
679 }
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:318
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:583
#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:205
const int OPT__TAILREDSYZ
Reduce syzygy tails wrt the leading syzygy terms.
Definition: syzextra.h:211
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:357
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:242
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:355
bool IsDivisible(const poly q) const
Definition: syzextra.cc:2370
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:344

Friends And Related Function Documentation

◆ CDivisorEnumerator

friend class CDivisorEnumerator
friend

Definition at line 314 of file syzextra.h.

◆ CDivisorEnumerator2

friend class CDivisorEnumerator2
friend

Definition at line 312 of file syzextra.h.

Field Documentation

◆ m_hash

CReducersHash CReducerFinder::m_hash
private

Definition at line 357 of file syzextra.h.

◆ m_L

ideal CReducerFinder::m_L
private

only for debug

Definition at line 355 of file syzextra.h.


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