My Project  debian-1:4.1.1-p2+ds-4build1
Data Structures | Macros | Typedefs | Functions
syzextra.h File Reference
#include <vector>
#include <map>
#include <string.h>
#include <stack>
#include "singularxx_defs.h"
#include "kernel/ideals.h"

Go to the source code of this file.

Data Structures

class  SBucketFactory
 
struct  SchreyerSyzygyComputationFlags
 Computation attribute storage. More...
 
class  CLCM
 
class  CLeadingTerm
 
class  CReducerFinder
 
struct  CCacheCompare
 
class  SchreyerSyzygyComputation
 

Macros

#define NOPRODUCT   1
 
#define NODIVISION   1
 

Typedefs

typedef idrecidhdl
 
typedef kBucketkBucket_pt
 
typedef sBucketsBucket_pt
 
typedef poly TCacheKey
 
typedef poly TCacheValue
 
typedef std::map< TCacheKey, TCacheValue, CCacheCompareTP2PCache
 
typedef std::map< int, TP2PCacheTCache
 

Functions

poly leadmonom (const poly p, const ring r, const bool bSetZeroComp=true)
 return a new term: leading coeff * leading monomial of p with 0 leading component! More...
 
poly p_Tail (const poly p, const ring r)
 return the tail of a given polynomial or vector returns NULL if input is NULL, otherwise the result is a new polynomial/vector in the ring r More...
 
ideal id_Tail (const ideal id, const ring r)
 return the tail of a given ideal or module returns NULL if input is NULL, otherwise the result is a new ideal/module in the ring r NOTE: the resulting rank is autocorrected More...
 
void Sort_c_ds (const ideal id, const ring r)
 inplace sorting of the module (ideal) id wrt <_(c,ds) More...
 
bool my_p_LmCmp (poly, poly, const ring)
 
static void ComputeSyzygy (const ideal L, const ideal T, ideal &LL, ideal &TT, const SchreyerSyzygyComputationFlags A)
 
static ideal ComputeLeadingSyzygyTerms (const ideal &L, const SchreyerSyzygyComputationFlags A)
 
static ideal Compute2LeadingSyzygyTerms (const ideal &L, const SchreyerSyzygyComputationFlags A)
 
static poly FindReducer (poly product, poly syzterm, ideal L, ideal LS, const SchreyerSyzygyComputationFlags A)
 
static poly TraverseTail (poly multiplier, poly tail, ideal L, ideal T, ideal LS, const SchreyerSyzygyComputationFlags A)
 
static poly ReduceTerm (poly multiplier, poly term4reduction, poly syztermCheck, ideal L, ideal T, ideal LS, const SchreyerSyzygyComputationFlags A)
 
static poly SchreyerSyzygyNF (poly syz_lead, poly syz_2, ideal L, ideal T, ideal LS, const SchreyerSyzygyComputationFlags A)
 

Detailed Description

Computation of Syzygies

ABSTRACT: Computation of Syzygies due to Schreyer

Author
Oleksandr Motsak

Definition in file syzextra.h.

Macro Definition Documentation

◆ NODIVISION

#define NODIVISION   1

Definition at line 39 of file syzextra.h.

◆ NOPRODUCT

#define NOPRODUCT   1

Definition at line 33 of file syzextra.h.

Typedef Documentation

◆ idhdl

typedef idrec* idhdl

Definition at line 28 of file syzextra.h.

◆ kBucket_pt

typedef kBucket* kBucket_pt

Definition at line 30 of file syzextra.h.

◆ sBucket_pt

typedef sBucket* sBucket_pt

Definition at line 60 of file syzextra.h.

◆ TCache

typedef std::map<int, TP2PCache> TCache

Definition at line 334 of file syzextra.h.

◆ TCacheKey

typedef poly TCacheKey

Definition at line 316 of file syzextra.h.

◆ TCacheValue

typedef poly TCacheValue

Definition at line 317 of file syzextra.h.

◆ TP2PCache

Definition at line 333 of file syzextra.h.

Function Documentation

◆ Compute2LeadingSyzygyTerms()

static ideal Compute2LeadingSyzygyTerms ( const ideal &  L,
const SchreyerSyzygyComputationFlags  A 
)
inlinestatic

Definition at line 518 of file syzextra.h.

519 {
521  syz.ComputeLeadingSyzygyTerms(true);
522  ideal LL, TT;
523  syz.ReadOffResult(LL, TT);
524  return LL; // assume TT is NULL!
525 }

◆ ComputeLeadingSyzygyTerms()

static ideal ComputeLeadingSyzygyTerms ( const ideal &  L,
const SchreyerSyzygyComputationFlags  A 
)
inlinestatic

Definition at line 509 of file syzextra.h.

510 {
512  syz.ComputeLeadingSyzygyTerms(false);
513  ideal LL, TT;
514  syz.ReadOffResult(LL, TT);
515  return LL; // assume TT is NULL!
516 }

◆ ComputeSyzygy()

static void ComputeSyzygy ( const ideal  L,
const ideal  T,
ideal &  LL,
ideal &  TT,
const SchreyerSyzygyComputationFlags  A 
)
inlinestatic

Definition at line 502 of file syzextra.h.

503 {
504  SchreyerSyzygyComputation syz(L, T, A);
505  syz.ComputeSyzygy();
506  syz.ReadOffResult(LL, TT);
507 }

◆ FindReducer()

static poly FindReducer ( poly  product,
poly  syzterm,
ideal  L,
ideal  LS,
const SchreyerSyzygyComputationFlags  A 
)
inlinestatic

Definition at line 527 of file syzextra.h.

529 {
530  SchreyerSyzygyComputation syz(L, NULL, LS, A);
531  return syz._FindReducer(product, syzterm);
532 }

◆ id_Tail()

ideal id_Tail ( const ideal  id,
const ring  r 
)

return the tail of a given ideal or module returns NULL if input is NULL, otherwise the result is a new ideal/module in the ring r NOTE: the resulting rank is autocorrected

Definition at line 325 of file syzextra.cc.

326 {
327  if( UNLIKELY(id == NULL) )
328  return NULL;
329 
330  const ideal newid = idInit(IDELEMS(id),id->rank);
331 
332  for (int i=IDELEMS(id) - 1; i >= 0; i--)
333  newid->m[i] = p_Tail( id->m[i], r );
334 
335  newid->rank = id_RankFreeModule(newid, currRing);
336 
337  return newid;
338 }

◆ leadmonom()

poly leadmonom ( const poly  p,
const ring  r,
const bool  bSetZeroComp = true 
)

return a new term: leading coeff * leading monomial of p with 0 leading component!

Definition at line 288 of file syzextra.cc.

289 {
290  if( UNLIKELY(p == NULL ) )
291  return NULL;
292 
293  assume( p != NULL );
294  p_LmTest(p, r);
295 
296  poly m = p_LmInit(p, r);
297  p_SetCoeff0(m, n_Copy(pGetCoeff(p), r->cf), r);
298 
299  if( bSetZeroComp )
300  p_SetComp(m, 0, r);
301 
302  p_Setm(m, r);
303 
304  assume( m != NULL );
305  assume( pNext(m) == NULL );
306  p_LmTest(m, r);
307 
308  if( bSetZeroComp )
309  assume( p_GetComp(m, r) == 0 );
310 
311  return m;
312 }

◆ my_p_LmCmp()

bool my_p_LmCmp ( poly  ,
poly  ,
const  ring 
)

Definition at line 1140 of file syzextra.cc.

1140 { return p_LmCmp(a, b, r) == -1; } // TODO: change to simple lex. memory compare!

◆ p_Tail()

poly p_Tail ( const poly  p,
const ring  r 
)

return the tail of a given polynomial or vector returns NULL if input is NULL, otherwise the result is a new polynomial/vector in the ring r

Definition at line 316 of file syzextra.cc.

317 {
318  if( UNLIKELY(p == NULL) )
319  return NULL;
320  else
321  return p_Copy( pNext(p), r );
322 }

◆ ReduceTerm()

static poly ReduceTerm ( poly  multiplier,
poly  term4reduction,
poly  syztermCheck,
ideal  L,
ideal  T,
ideal  LS,
const SchreyerSyzygyComputationFlags  A 
)
inlinestatic

Definition at line 541 of file syzextra.h.

543 {
544  SchreyerSyzygyComputation syz(L, T, LS, A);
545  return syz.ReduceTerm(multiplier, term4reduction, syztermCheck);
546 }

◆ SchreyerSyzygyNF()

static poly SchreyerSyzygyNF ( poly  syz_lead,
poly  syz_2,
ideal  L,
ideal  T,
ideal  LS,
const SchreyerSyzygyComputationFlags  A 
)
inlinestatic

Definition at line 549 of file syzextra.h.

551 {
552  SchreyerSyzygyComputation syz(L, T, LS, A);
553  return syz.SchreyerSyzygyNF(syz_lead, syz_2);
554 }

◆ Sort_c_ds()

void Sort_c_ds ( const ideal  id,
const ring  r 
)

inplace sorting of the module (ideal) id wrt <_(c,ds)

Definition at line 342 of file syzextra.cc.

343 {
344  const int sizeNew = IDELEMS(id);
345 
346 #if ( (defined(HAVE_QSORT_R)) && (defined __APPLE__ || defined __MACH__ || defined __DARWIN__ || defined __FreeBSD__ || defined __BSD__ || defined OpenBSD3_1 || defined OpenBSD3_9) )
347 #define qsort_my(m, s, ss, r, cmp) qsort_r(m, s, ss, r, cmp)
348 #elif ( (defined(HAVE_QSORT_R)) && (defined _GNU_SOURCE || defined __GNU__ || defined __linux__))
349 #define qsort_my(m, s, ss, r, cmp) qsort_r(m, s, ss, cmp, r)
350 #else
351 #define qsort_my(m, s, ss, r, cmp) qsort(m, s, ss, cmp)
352 #endif
353 
354  if( sizeNew >= 2 )
355  qsort_my(id->m, sizeNew, sizeof(poly), r, FROM_NAMESPACE(SORT_c_ds, cmp_c_ds));
356 
357 #undef qsort_my
358 
359  id->rank = id_RankFreeModule(id, r);
360 }

◆ TraverseTail()

static poly TraverseTail ( poly  multiplier,
poly  tail,
ideal  L,
ideal  T,
ideal  LS,
const SchreyerSyzygyComputationFlags  A 
)
inlinestatic

Definition at line 534 of file syzextra.h.

536 {
537  SchreyerSyzygyComputation syz(L, T, LS, A);
538  return syz.TraverseTail(multiplier, tail);
539 }
p_GetComp
#define p_GetComp(p, r)
Definition: monomials.h:68
p_SetCoeff0
#define p_SetCoeff0(p, n, r)
Definition: monomials.h:64
p_LmInit
static poly p_LmInit(poly p, const ring r)
Definition: p_polys.h:1264
b
CanonicalForm b
Definition: cfModGcd.cc:4044
cmp_c_ds
static int cmp_c_ds(const void *p1, const void *p2)
Definition: syzextra.cc:168
p_Copy
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:797
currRing
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
i
int i
Definition: cfEzgcd.cc:125
FROM_NAMESPACE
#define FROM_NAMESPACE(a, s)
Definition: singularxx_defs.h:40
id_RankFreeModule
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
Definition: simpleideals.cc:781
T
static jList * T
Definition: janet.cc:31
p_Tail
poly p_Tail(const poly p, const ring r)
return the tail of a given polynomial or vector returns NULL if input is NULL, otherwise the result i...
Definition: syzextra.cc:316
p_LmCmp
static int p_LmCmp(poly p, poly q, const ring r)
Definition: p_polys.h:1488
p_LmTest
#define p_LmTest(p, r)
Definition: p_polys.h:156
qsort_my
#define qsort_my(m, s, ss, r, cmp)
idInit
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:36
UNLIKELY
#define UNLIKELY
Definition: auxiliary.h:421
n_Copy
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of 'n'
Definition: coeffs.h:451
SchreyerSyzygyComputation
Definition: syzextra.h:347
m
int m
Definition: cfEzgcd.cc:121
assume
#define assume(x)
Definition: mod2.h:384
NULL
#define NULL
Definition: omList.c:9
p_SetComp
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:238
p_Setm
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:224
p
int p
Definition: cfModGcd.cc:4019
IDELEMS
#define IDELEMS(i)
Definition: simpleideals.h:24
pGetCoeff
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:48
A
#define A
Definition: sirandom.c:23
pNext
#define pNext(p)
Definition: monomials.h:40