Loading...
Searching...
No Matches
CPowerMultiplier Class Reference

`#include <ncSAMult.h>`

## Public Types

typedef CPower | CExponent

## Public Member Functions

| CPowerMultiplier (ring r)
virtual | ~CPowerMultiplier ()
CSpecialPairMultiplier * | GetPair (int i, int j) const
CSpecialPairMultiplier *& | GetPair (int i, int j)
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< CPower >
| 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 CPower expRight)
poly | MultiplyET (const CPower expLeft, const poly pTerm)

## Private Attributes

CSpecialPairMultiplier ** | m_specialpairs

## Additional Inherited Members

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

## Detailed Description

Definition at line 163 of file ncSAMult.h.

## Member Typedef Documentation

## CExponent

typedef CPower CPowerMultiplier::CExponent

Definition at line 194 of file ncSAMult.h.

## Constructor & Destructor Documentation

## CPowerMultiplier()

CPowerMultiplier::CPowerMultiplier | ( | ring | r | ) |

Definition at line 832 of file ncSAMult.cc.

: CMultiplier<CPower>(r)
{
#if OUTPUT
PrintS("CPowerMultiplier::CPowerMultiplier(ring)!");
PrintLn();
#endif
m_specialpairs = (CSpecialPairMultiplier**)omAlloc0( ((NVars() * (NVars()-1)) / 2) * sizeof(CSpecialPairMultiplier*) );
for( int i = 1; i < NVars(); i++ )
for( int j = i + 1; j <= NVars(); j++ )
GetPair(i, j) = AnalyzePair(GetBasering(), i, j); // factory method!
}
i
int i
Definition cfEzgcd.cc:132
CMultiplier< CPower >::CMultiplier
CMultiplier(ring rBaseRing)
Definition ncSAMult.h:32
CMultiplier< CPower >::NVars
int NVars() const
Definition ncSAMult.h:36
CMultiplier< CPower >::GetBasering
ring GetBasering() const
Definition ncSAMult.h:35
CPowerMultiplier::GetPair
CSpecialPairMultiplier * GetPair(int i, int j) const
Definition ncSAMult.h:173
CPowerMultiplier::m_specialpairs
CSpecialPairMultiplier ** m_specialpairs
Definition ncSAMult.h:166
j
int j
Definition facHensel.cc:110
AnalyzePair
CSpecialPairMultiplier * AnalyzePair(const ring r, int i, int j)
Definition ncSAMult.cc:778
omAlloc0
#define omAlloc0(size)
Definition omAllocDecl.h:211
PrintS
void PrintS(const char *s)
Definition reporter.cc:288
PrintLn
void PrintLn()
Definition reporter.cc:314

## ~CPowerMultiplier()

CPowerMultiplier::~CPowerMultiplier | ( |  | ) |

virtual

Definition at line 847 of file ncSAMult.cc.

{
#if OUTPUT
PrintS("CPowerMultiplier::~CPowerMultiplier()!");
PrintLn();
#endif
omFreeSize((ADDRESS)m_specialpairs, ((NVars() * (NVars()-1)) / 2) * sizeof(CSpecialPairMultiplier*) );
}
ADDRESS
void * ADDRESS
Definition auxiliary.h:120
omFreeSize
#define omFreeSize(addr, size)
Definition omAllocDecl.h:260

## Member Function Documentation

## GetPair() [1/2]

CSpecialPairMultiplier *& CPowerMultiplier::GetPair | ( | int | i,
|  | int | j )

inline

Definition at line 183 of file ncSAMult.h.

{
assume( m_specialpairs != NULL );
assume( i > 0 );
assume( i < j );
assume( j <= NVars() );
return m_specialpairs[( (NVars() * ((i)-1) - ((i) * ((i)-1))/2 + (j)-1) - (i) )];
}
assume
#define assume(x)
Definition mod2.h:389
NULL
#define NULL
Definition omList.c:12

## GetPair() [2/2]

CSpecialPairMultiplier * CPowerMultiplier::GetPair | ( | int | i,
|  | int | j ) const

inline

Definition at line 173 of file ncSAMult.h.

{
assume( m_specialpairs != NULL );
assume( i > 0 );
assume( i < j );
assume( j <= NVars() );
return m_specialpairs[( (NVars() * ((i)-1) - ((i) * ((i)-1))/2 + (j)-1) - (i) )];
}

## MultiplyEE()

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

virtual

Implements CMultiplier< CPower >.

Definition at line 991 of file ncSAMult.cc.

{
#if OUTPUT
PrintS("CPowerMultiplier::MultiplyEE)!");
PrintLn();
#endif
const int i = expRight.Var, j = expLeft.Var;
const int ei = expRight.Power, ej = expLeft.Power;
#if OUTPUT
Print("Input: var(%d)^{%d} * var(%d)^{%d}", j, ej, i, ei);
PrintLn();
#endif
assume(1 <= i);
assume(j <= NVars());
assume(1 <= j);
assume(i <= NVars());
assume(ei > 0);
assume(ej > 0);
if( i >= j )
{
const ring r = GetBasering();
poly product = p_One(r);
p_SetExp(product, j, ej, r);
p_SetExp(product, i, ei, r);
p_Setm(product, r);
return product;
} else
{
assume(i < j);
// No Cache Lookup!? :(
CSpecialPairMultiplier* pSpecialMultiplier = GetPair(i, j);
// Special case?
if( pSpecialMultiplier != NULL )
{
assume( pSpecialMultiplier->GetI() == i );
assume( pSpecialMultiplier->GetJ() == j );
assume( pSpecialMultiplier->GetBasering() == GetBasering() );
return pSpecialMultiplier->MultiplyEE(ej, ei);
} else
{
// Perform general NC Multiplication:
// TODO
WerrorS("Sorry the general case is not implemented this way yet!!!");
assume(0);
// poly product = NULL;
}
}
return NULL;
}
CSpecialPairMultiplier::GetI
int GetI() const
Definition ncSAMult.h:108
CSpecialPairMultiplier::GetJ
int GetJ() const
Definition ncSAMult.h:109
CSpecialPairMultiplier::MultiplyEE
virtual poly MultiplyEE(const CExponent expLeft, const CExponent expRight)=0
Print
#define Print
Definition emacs.cc:80
WerrorS
void WerrorS(const char *s)
Definition feFopen.cc:24
p_One
poly p_One(const ring r)
Definition p_polys.cc:1314
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

## MultiplyEM()

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

virtual

Implements CMultiplier< CPower >.

Definition at line 924 of file ncSAMult.cc.

{
const ring r = GetBasering();
// TODO: as above! (difference due to Left/Right semmantics!)
const int j = expLeft.Var;
const int n = expLeft.Power;
#if OUTPUT
Print("CPowerMultiplier::MultiplyEM(var(%d)^{%d} * monom)!", j, n);
PrintLn();
PrintS("Monom: "); p_Write(pMonom, r);
#endif
assume( (j > 0) && (j <= NVars()));
if( n == 0 )
return p_Head(pMonom, r); // Copy?!?
int v = 1; // NVars();
int e = p_GetExp(pMonom, v, r);
while((v < j) && (e == 0))
e = p_GetExp(pMonom, ++v, r);
if( v == j )
{
poly p = p_Head(pMonom, r);
p_SetExp(p, j, e + n, r);
p_Setm(p, r);
return p;
}
assume( v < j );
assume( e > 0 );
// And now the General Case: v > j!
poly p = MultiplyEE( expLeft, CPower(v, e) ); // Easy way!
++v;
while(v <= NVars())
{
e = p_GetExp(pMonom, v, r);
if( e > 0 )
p = MultiplyPEDestroy(p, CPower(v, e));
++v;
}
#if OUTPUT
PrintS("CPowerMultiplier::MultiplyEM() ===> ");
p_Write(p, r);
#endif
return p;
}
p
int p
Definition cfModGcd.cc:4086
CPowerMultiplier::MultiplyEE
virtual poly MultiplyEE(const CExponent expLeft, const CExponent expRight)
Definition ncSAMult.cc:991
CPowerMultiplier::MultiplyPEDestroy
poly MultiplyPEDestroy(poly pPoly, const CExponent expRight)
Definition ncSAMult.h:235
v
const Variable & v
< [in] a sqrfree bivariate poly
Definition facBivar.h:39
p_Write
void p_Write(poly p, ring lmRing, ring tailRing)
Definition polys0.cc:342
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

## MultiplyEP()

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

inline

Definition at line 223 of file ncSAMult.h.

{
bool bUsePolynomial = TEST_OPT_NOT_BUCKETS || (pLength(pPoly) < MIN_LENGTH_BUCKET);
CPolynomialSummator sum(GetBasering(), bUsePolynomial);
for( poly q = pPoly; q !=NULL; q = pNext(q) )
sum += MultiplyET(expLeft, q);
return sum;
}
CMultiplier< CPower >::MultiplyET
poly MultiplyET(const CPower expLeft, const poly pTerm)
Definition ncSAMult.h:61
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

## MultiplyEPDestroy()

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

inline

Definition at line 247 of file ncSAMult.h.

{
bool bUsePolynomial = TEST_OPT_NOT_BUCKETS || (pLength(pPoly) < MIN_LENGTH_BUCKET);
CPolynomialSummator sum(GetBasering(), bUsePolynomial);
for( ; pPoly!=NULL; pPoly = p_LmDeleteAndNext(pPoly, GetBasering()) )
sum += MultiplyET(expLeft, pPoly);
return sum;
}
p_LmDeleteAndNext
static poly p_LmDeleteAndNext(poly p, const ring r)
Definition p_polys.h:757

## MultiplyME()

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

virtual

Implements CMultiplier< CPower >.

Definition at line 860 of file ncSAMult.cc.

{
const int j = expRight.Var;
const int n = expRight.Power;
const ring r = GetBasering();
#if OUTPUT
Print("CPowerMultiplier::MultiplyME(monom * var(%d)^{%d})!", j, n);
PrintLn();
PrintS("Monom: "); p_Write(pMonom, r);
#endif
assume( (j > 0) && (j <= NVars()));
if( n == 0 )
return p_Head(pMonom, r); // Copy?!?
int v = NVars();
int e = p_GetExp(pMonom, v, r);
while((v > j) && (e == 0))
e = p_GetExp(pMonom, --v, r);
// TODO: review this!
if( v == j )
{
poly p = p_Head(pMonom, r);
p_SetExp(p, v, e + n, r);
p_Setm(p, r);
return p;
}
assume( v > j );
assume( e > 0 );
// And now the General Case: v > j!
poly p = MultiplyEE( CPower(v, e), expRight ); // Easy way!
--v;
while(v > 0)
{
e = p_GetExp(pMonom, v, GetBasering());
if( e > 0 )
p = MultiplyEPDestroy(CPower(v, e), p);
--v;
}
#if OUTPUT
PrintS("CPowerMultiplier::MultiplyME() ===> ");
p_Write(p, GetBasering());
#endif
return p;
}
CPowerMultiplier::MultiplyEPDestroy
poly MultiplyEPDestroy(const CExponent expLeft, poly pPoly)
Definition ncSAMult.h:247

## MultiplyPE()

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

inline

Definition at line 211 of file ncSAMult.h.

{
bool bUsePolynomial = TEST_OPT_NOT_BUCKETS || (pLength(pPoly) < MIN_LENGTH_BUCKET);
CPolynomialSummator sum(GetBasering(), bUsePolynomial);
for( poly q = pPoly; q !=NULL; q = pNext(q) )
sum += MultiplyTE(q, expRight);
return sum;
}
CMultiplier< CPower >::MultiplyTE
poly MultiplyTE(const poly pTerm, const CPower expRight)
Definition ncSAMult.h:47

## MultiplyPEDestroy()

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

inline

Definition at line 235 of file ncSAMult.h.

{
bool bUsePolynomial = TEST_OPT_NOT_BUCKETS || (pLength(pPoly) < MIN_LENGTH_BUCKET);
CPolynomialSummator sum(GetBasering(), bUsePolynomial);
for( ; pPoly!=NULL; pPoly = p_LmDeleteAndNext(pPoly, GetBasering()) )
sum += MultiplyTE(pPoly, expRight);
return sum;
}

## Field Documentation

## m_specialpairs

CSpecialPairMultiplier** CPowerMultiplier::m_specialpairs

private

Definition at line 166 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