Loading...
Searching...
No Matches
CGlobalMultiplier Class Reference

`#include <ncSAMult.h>`

## Public Types

typedef CMultiplier< poly > | CBaseType
typedef poly | CExponent

## Public Member Functions

| CGlobalMultiplier (ring r)
virtual | ~CGlobalMultiplier ()
virtual poly | MultiplyEE (const CExponent expLeft, const CExponent expRight)
virtual poly | MultiplyME (const poly pMonom, const CExponent expRight)
virtual poly | MultiplyEM (const CExponent expLeft, const poly pMonom)
poly | MultiplyPE (const poly pPoly, const CExponent expRight)
poly | MultiplyEP (const CExponent expLeft, const poly pPoly)
poly | MultiplyPEDestroy (poly pPoly, const CExponent expRight)
poly | MultiplyEPDestroy (const CExponent expLeft, poly pPoly)
Public Member Functions inherited from CMultiplier< poly >
| CMultiplier (ring rBaseRing)
virtual | ~CMultiplier ()
ring | GetBasering () const
int | NVars () const
poly | LM (const poly pTerm, const ring r, int i=1) const
poly | MultiplyTE (const poly pTerm, const poly expRight)
poly | MultiplyET (const poly expLeft, const poly pTerm)

## Private Attributes

CPowerMultiplier * | m_powers
const CFormulaPowerMultiplier * | m_RingFormulaMultiplier

## Additional Inherited Members

Protected Attributes inherited from CMultiplier< poly >
const ring | m_basering
const int | m_NVars

## Detailed Description

Definition at line 263 of file ncSAMult.h.

## Member Typedef Documentation

## CBaseType

typedef CMultiplier<poly> CGlobalMultiplier::CBaseType

Definition at line 271 of file ncSAMult.h.

## CExponent

typedef poly CGlobalMultiplier::CExponent

Definition at line 278 of file ncSAMult.h.

## Constructor & Destructor Documentation

## CGlobalMultiplier()

CGlobalMultiplier::CGlobalMultiplier | ( | ring | r | ) |

Definition at line 293 of file ncSAMult.cc.

:
CMultiplier<poly>(r), m_RingFormulaMultiplier(GetFormulaPowerMultiplier(r))
{
#if OUTPUT
PrintS("CGlobalMultiplier::CGlobalMultiplier(ring)!");
PrintLn();
#endif
// m_cache = new CGlobalCacheHash(r);
m_powers = new CPowerMultiplier(r);
}
CGlobalMultiplier::m_powers
CPowerMultiplier * m_powers
Definition ncSAMult.h:267
CGlobalMultiplier::m_RingFormulaMultiplier
const CFormulaPowerMultiplier * m_RingFormulaMultiplier
Definition ncSAMult.h:268
CMultiplier< poly >::CMultiplier
CMultiplier(ring rBaseRing)
Definition ncSAMult.h:32
GetFormulaPowerMultiplier
static CFormulaPowerMultiplier * GetFormulaPowerMultiplier(const ring r)
Definition ncSAFormula.h:93
PrintS
void PrintS(const char *s)
Definition reporter.cc:288
PrintLn
void PrintLn()
Definition reporter.cc:314

## ~CGlobalMultiplier()

CGlobalMultiplier::~CGlobalMultiplier | ( |  | ) |

virtual

Definition at line 306 of file ncSAMult.cc.

{
#if OUTPUT
PrintS("CGlobalMultiplier::~CGlobalMultiplier()!");
PrintLn();
#endif
// delete m_cache;
delete m_powers;
// we cannot delete m_RingFormulaMultiplier as it belongs to the ring!
}

## Member Function Documentation

## MultiplyEE()

poly CGlobalMultiplier::MultiplyEE | ( | const CExponent | expLeft,
|  | const CExponent | expRight )

virtual

Implements CMultiplier< poly >.

Definition at line 323 of file ncSAMult.cc.

{
const ring r = GetBasering();
#if OUTPUT
PrintS("CGlobalMultiplier::MultiplyEE(expLeft, expRight)!");
PrintLn();
PrintS("expL: "); p_Write(expLeft, GetBasering());
PrintS("expR: "); p_Write(expRight, GetBasering());
#endif
// CCacheHash<poly>::CCacheItem* pLookup;
//
// int b = m_cache->LookupEE(expLeft, expRight, pLookup);
// // TODO!!!
//
// // up to now:
// assume( b == -1 );
// TODO: use PowerMultiplier!!!!
poly product = NULL;
const int N = NVars();
int j = N;
int i = 1;
int ej = p_GetExp(expLeft, j, r);
int ei = p_GetExp(expRight, i, r);
while( (i < j) && !((ej != 0) && (ei != 0)) )
{
if( ei == 0 )
ei = p_GetExp(expRight, ++i, r);
if( ej == 0 )
ej = p_GetExp(expLeft, --j, r);
}
#if OUTPUT
PrintS("<CGlobalMultiplier::MultiplyEE>");
PrintLn();
Print("i: %d, j: %d", i, j);
PrintLn();
Print("ei: %d, ej: %d", ei, ej);
PrintLn();
#endif
// | expLeft | * | expRight |
// |<<<< ej 0..0| , |0..0 ei >>>>|
// |<<<< j <<<N| , |1>>> i >>>>|
if( i >= j ) // BUG here!!!???
{
// either i == j or i = j + 1 => commutative multiple!
// TODO: it can be done more efficiently! ()
product = p_Head(expRight, r);
// | expLeft | * | expRight |
// |<<<< ej 0....0| , |0..00 ei >>>>|
// |<<<< j i <<<N| , |1>>>j i >>>>|
if(i > j)
{
--i;
ei = 0;
}
if( i == j )
{
if( ej != 0 )
p_SetExp(product, i, ei + ej, r);
}
--i;
for(; i > 0; --i)
{
const int e = p_GetExp(expLeft, i, r);
if( e > 0 )
p_SetExp(product, i, e, r);
}
p_Setm(product, r);
} else
{ // i < j, ei != 0, ej != 0
Enum_ncSAType PairType = _ncSA_notImplemented;
if( m_RingFormulaMultiplier != NULL )
PairType = m_RingFormulaMultiplier->GetPair(i, j);
if( PairType == _ncSA_notImplemented )
product = m_powers->MultiplyEE( CPower(j, ej), CPower(i, ei) );
// return ggnc_uu_Mult_ww_vert(i, a, j, b, r);
else
// return m_RingFormulaMultiplier->Multiply(j, i, b, a);
product = CFormulaPowerMultiplier::Multiply( PairType, i, j, ei, ej, GetBasering());
#if OUTPUT
PrintS("<CGlobalMultiplier::MultiplyEE> ==> ");
PrintLn();
Print("i: %d, j: %d", i, j);
PrintLn();
Print("ei: %d, ej: %d", ei, ej);
PrintLn();
PrintS("<product>: "); p_Write(product, GetBasering());
#endif
// TODO: Choose some multiplication strategy!!!
while( (product != NULL) && !((i == NVars()) && (j == 1)) )
{
// make some choice here!:
if( i < NVars() )
{
ei = p_GetExp(expRight, ++i, r);
while( (ei == 0) && (i < NVars()) )
ei = p_GetExp(expRight, ++i, r);
if( ei != 0 )
product = m_powers->MultiplyPEDestroy(product, CPower(i, ei));
}
if( j > 1 )
{
ej = p_GetExp(expLeft, --j, r);
while( (ej == 0) && (1 < j) )
ej = p_GetExp(expLeft, --j, r);
if( ej != 0 )
product = m_powers->MultiplyEPDestroy(CPower(j, ej), product);
}
#if OUTPUT
PrintS("<CGlobalMultiplier::MultiplyEE> ==> ");
PrintLn();
Print("i: %d, j: %d", i, j);
PrintLn();
Print("ei: %d, ej: %d", ei, ej);
PrintLn();
PrintS("<product>: "); p_Write(product, GetBasering());
#endif
}
}
// // TODO!
//
// m_cache->StoreEE( expLeft, expRight, product);
// // up to now:
return product;
}
N
const CanonicalForm CFMap CFMap & N
Definition cfEzgcd.cc:56
i
int i
Definition cfEzgcd.cc:132
CFormulaPowerMultiplier::Multiply
static poly Multiply(Enum_ncSAType type, const int i, const int j, const int n, const int m, const ring r)
Definition ncSAFormula.cc:696
CMultiplier< poly >::NVars
int NVars() const
Definition ncSAMult.h:36
CMultiplier< poly >::GetBasering
ring GetBasering() const
Definition ncSAMult.h:35
Print
#define Print
Definition emacs.cc:80
j
int j
Definition facHensel.cc:110
Enum_ncSAType
Enum_ncSAType
Definition ncSAFormula.h:16
_ncSA_notImplemented
@ _ncSA_notImplemented
Definition ncSAFormula.h:17
NULL
#define NULL
Definition omList.c:12
p_Write
void p_Write(poly p, ring lmRing, ring tailRing)
Definition polys0.cc:342
p_SetExp
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent @Note: VarOffset encodes the position in p->exp
Definition p_polys.h:490
p_Setm
static void p_Setm(poly p, const ring r)
Definition p_polys.h:235
p_Head
static poly p_Head(const poly p, const ring r)
copy the (leading) term of p
Definition p_polys.h:862
p_GetExp
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent @Note: the integer VarOffset encodes:
Definition p_polys.h:471

## MultiplyEM()

poly CGlobalMultiplier::MultiplyEM | ( | const CExponent | expLeft,
|  | const poly | pMonom )

virtual

Implements CMultiplier< poly >.

Definition at line 505 of file ncSAMult.cc.

{
#if OUTPUT
PrintS("CGlobalMultiplier::MultiplyEM(expL, monom)!");
PrintLn();
PrintS("expL: "); p_Write(expLeft, GetBasering());
PrintS("Monom: "); p_Write(pMonom, GetBasering());
#endif
return MultiplyEE(expLeft, pMonom);
}
CGlobalMultiplier::MultiplyEE
virtual poly MultiplyEE(const CExponent expLeft, const CExponent expRight)
Definition ncSAMult.cc:323

## MultiplyEP()

poly CGlobalMultiplier::MultiplyEP | ( | const CExponent | expLeft,
|  | const poly | pPoly )

inline

Definition at line 349 of file ncSAMult.h.

{
assume( pPoly != NULL ); assume( expLeft != NULL );
const int iComponentMonom = p_GetComp(expLeft, GetBasering());
bool bUsePolynomial = TEST_OPT_NOT_BUCKETS || (pLength(pPoly) < MIN_LENGTH_BUCKET);
CPolynomialSummator sum(GetBasering(), bUsePolynomial);
if( iComponentMonom!=0 )
{
for( poly q = pPoly; q !=NULL; q = pNext(q) )
{
#ifdef PDEBUG
{
const int iComponent = p_GetComp(q, GetBasering());
assume(iComponent == 0);
if( iComponent!=0 )
{
Werror("MultiplyEP: both sides have non-zero components: %d and %d!\n", iComponent, iComponentMonom);
// what should we do further?!?
return NULL;
}
}
#endif
sum += MultiplyET(expLeft, q);
}
poly t = sum; p_SetCompP(t, iComponentMonom, GetBasering());
return t;
} // iComponentMonom != 0!
else
{ // iComponentMonom == 0!
for( poly q = pPoly; q !=NULL; q = pNext(q) )
{
const int iComponent = p_GetComp(q, GetBasering());
poly t = MultiplyET(expLeft, q); // NO Component!!!
p_SetCompP(t, iComponent, GetBasering());
sum += t;
}
return sum;
} // iComponentMonom == 0!
}
CMultiplier< poly >::MultiplyET
poly MultiplyET(const poly expLeft, const poly pTerm)
Definition ncSAMult.h:61
assume
#define assume(x)
Definition mod2.h:389
p_GetComp
#define p_GetComp(p, r)
Definition monomials.h:64
pNext
#define pNext(p)
Definition monomials.h:36
TEST_OPT_NOT_BUCKETS
#define TEST_OPT_NOT_BUCKETS
Definition options.h:107
MIN_LENGTH_BUCKET
#define MIN_LENGTH_BUCKET
Definition p_Mult_q.h:21
pLength
static int pLength(poly a)
Definition p_polys.h:190
p_SetCompP
static void p_SetCompP(poly p, int i, ring r)
Definition p_polys.h:256
Werror
void Werror(const char *fmt,...)
Definition reporter.cc:189

## MultiplyEPDestroy()

poly CGlobalMultiplier::MultiplyEPDestroy | ( | const CExponent | expLeft,
|  | poly | pPoly )

inline

Definition at line 447 of file ncSAMult.h.

{
assume( pPoly != NULL ); assume( expLeft != NULL );
const int iComponentMonom = p_GetComp(expLeft, GetBasering());
bool bUsePolynomial = TEST_OPT_NOT_BUCKETS || (pLength(pPoly) < MIN_LENGTH_BUCKET);
CPolynomialSummator sum(GetBasering(), bUsePolynomial);
if( iComponentMonom!=0 )
{
for(poly q = pPoly ; q!=NULL; q = p_LmDeleteAndNext(q, GetBasering()) )
{
#ifdef PDEBUG
{
const int iComponent = p_GetComp(q, GetBasering());
assume(iComponent == 0);
if( iComponent!=0 )
{
Werror("MultiplyEPDestroy: both sides have non-zero components: %d and %d!\n", iComponent, iComponentMonom);
// what should we do further?!?
return NULL;
}
}
#endif
sum += MultiplyET(expLeft, q);
}
poly t = sum; p_SetCompP(t, iComponentMonom, GetBasering());
return t;
} // iComponentMonom != 0!
else
{ // iComponentMonom == 0!
for(poly q = pPoly ; q!=NULL; q = p_LmDeleteAndNext(q, GetBasering()) )
{
const int iComponent = p_GetComp(q, GetBasering());
poly t = MultiplyET(expLeft, q); // NO Component!!!
p_SetCompP(t, iComponent, GetBasering());
sum += t;
}
return sum;
} // iComponentMonom == 0!
}
p_LmDeleteAndNext
static poly p_LmDeleteAndNext(poly p, const ring r)
Definition p_polys.h:757

## MultiplyME()

poly CGlobalMultiplier::MultiplyME | ( | const poly | pMonom,
|  | const CExponent | expRight )

virtual

Implements CMultiplier< poly >.

Definition at line 492 of file ncSAMult.cc.

{
#if OUTPUT
PrintS("CGlobalMultiplier::MultiplyME(monom, expR)!");
PrintLn();
PrintS("Monom: "); p_Write(pMonom, GetBasering());
PrintS("expR: "); p_Write(expRight, GetBasering());
#endif
return MultiplyEE(pMonom, expRight);
}

## MultiplyPE()

poly CGlobalMultiplier::MultiplyPE | ( | const poly | pPoly,
|  | const CExponent | expRight )

inline

Definition at line 296 of file ncSAMult.h.

{
assume( pPoly != NULL ); assume( expRight != NULL );
const int iComponentMonom = p_GetComp(expRight, GetBasering());
bool bUsePolynomial = TEST_OPT_NOT_BUCKETS || (pLength(pPoly) < MIN_LENGTH_BUCKET);
CPolynomialSummator sum(GetBasering(), bUsePolynomial);
if( iComponentMonom!=0 )
{
for( poly q = pPoly; q !=NULL; q = pNext(q) )
{
#ifdef PDEBUG
{
const int iComponent = p_GetComp(q, GetBasering());
assume(iComponent == 0);
if( iComponent!=0 )
{
Werror("MultiplyPE: both sides have non-zero components: %d and %d!\n", iComponent, iComponentMonom);
// what should we do further?!?
return NULL;
}
}
#endif
sum += MultiplyTE(q, expRight); // NO Component!!!
}
poly t = sum; p_SetCompP(t, iComponentMonom, GetBasering());
return t;
} // iComponentMonom != 0!
else
{ // iComponentMonom == 0!
for( poly q = pPoly; q !=NULL; q = pNext(q) )
{
const int iComponent = p_GetComp(q, GetBasering());
#ifdef PDEBUG
if( iComponent!=0 )
{
Warn("MultiplyPE: Multiplication in the left module from the right by component %d!\n", iComponent);
// what should we do further?!?
}
#endif
poly t = MultiplyTE(q, expRight); // NO Component!!!
p_SetCompP(t, iComponent, GetBasering());
sum += t;
}
return sum;
} // iComponentMonom == 0!
}
CMultiplier< poly >::MultiplyTE
poly MultiplyTE(const poly pTerm, const poly expRight)
Definition ncSAMult.h:47
Warn
#define Warn
Definition emacs.cc:77

## MultiplyPEDestroy()

poly CGlobalMultiplier::MultiplyPEDestroy | ( | poly | pPoly,
|  | const CExponent | expRight )

inline

Definition at line 393 of file ncSAMult.h.

{
assume( pPoly != NULL ); assume( expRight != NULL );
const int iComponentMonom = p_GetComp(expRight, GetBasering());
bool bUsePolynomial = TEST_OPT_NOT_BUCKETS || (pLength(pPoly) < MIN_LENGTH_BUCKET);
CPolynomialSummator sum(GetBasering(), bUsePolynomial);
if( iComponentMonom!=0 )
{
for(poly q = pPoly ; q!=NULL; q = p_LmDeleteAndNext(q, GetBasering()) )
{
#ifdef PDEBUG
{
const int iComponent = p_GetComp(q, GetBasering());
assume(iComponent == 0);
if( iComponent!=0 )
{
Werror("MultiplyPEDestroy: both sides have non-zero components: %d and %d!\n", iComponent, iComponentMonom);
// what should we do further?!?
return NULL;
}
}
#endif
sum += MultiplyTE(q, expRight); // NO Component!!!
}
poly t = sum; p_SetCompP(t, iComponentMonom, GetBasering());
return t;
} // iComponentMonom != 0!
else
{ // iComponentMonom == 0!
for(poly q = pPoly ; q!=NULL; q = p_LmDeleteAndNext(q, GetBasering()) )
{
const int iComponent = p_GetComp(q, GetBasering());
#ifdef PDEBUG
if( iComponent!=0 )
{
Warn("MultiplyPEDestroy: Multiplication in the left module from the right by component %d!\n", iComponent);
// what should we do further?!?
}
#endif
poly t = MultiplyTE(q, expRight); // NO Component!!!
p_SetCompP(t, iComponent, GetBasering());
sum += t;
}
return sum;
} // iComponentMonom == 0!
}

## Field Documentation

## m_powers

CPowerMultiplier* CGlobalMultiplier::m_powers

private

Definition at line 267 of file ncSAMult.h.

## m_RingFormulaMultiplier

const CFormulaPowerMultiplier* CGlobalMultiplier::m_RingFormulaMultiplier

private

Definition at line 268 of file ncSAMult.h.

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

- libpolys/polys/nc/ncSAMult.h
- libpolys/polys/nc/ncSAMult.cc