Loading...
Searching...
No Matches
DegreePattern Class Reference

DegreePattern provides a functionality to create, intersect and refine degree patterns. More...

`#include "factory/DegreePattern.h"`

## Data Structures

struct | Pattern

## Public Member Functions

int | getLength () const
| getter
int | operator[] (const int index) const
| operator []
int & | operator[] (const int index)
| operator []
| DegreePattern ()
| default constructor
| DegreePattern (const DegreePattern &degPat)
| copy constructor
| DegreePattern (const CFList &l)
| construct a degree pattern from a list of (univariate) polys
DegreePattern & | operator= (const DegreePattern &degPat)
| assignment
| ~DegreePattern ()
| destructor
int | find (const int x) const
| find an element x
void | intersect (const DegreePattern &degPat)
| intersect two degree patterns
void | refine ()
| Refine a degree pattern. Assumes that (*this)[0]:= d is the degree of the poly to be factored. Now for every other entry a there should be some entry b such that a+b= d. Elements which do not satisfy this relation are removed.

## Private Member Functions

void | release ()
| clear m_data
void | init (int n)
| initialise a DegreePattern
int * | getPattern () const
| getter

## Private Attributes

struct DegreePattern::Pattern * | m_data

## Detailed Description

DegreePattern provides a functionality to create, intersect and refine degree patterns.

Definition at line 31 of file DegreePattern.h.

## Constructor & Destructor Documentation

## DegreePattern() [1/3]

DegreePattern::DegreePattern | ( |  | ) |

inline

default constructor

Definition at line 117 of file DegreePattern.h.

: m_data( new Pattern() ){}
DegreePattern::m_data
struct DegreePattern::Pattern * m_data
DegreePattern::Pattern
Definition DegreePattern.h:35

## DegreePattern() [2/3]

DegreePattern::DegreePattern | ( | const DegreePattern & | degPat | ) |

inline

copy constructor

Parameters

  [in] | degPat | some degree pattern

Definition at line 120 of file DegreePattern.h.

: m_data( degPat.m_data )
{
ASSERT( degPat.m_data != NULL, "non-null pointer expected" );
m_data->m_refCounter++;
};
ASSERT
#define ASSERT(expression, message)
Definition cf_assert.h:99
NULL
#define NULL
Definition omList.c:12

## DegreePattern() [3/3]

DegreePattern::DegreePattern | ( | const CFList & | l | ) |

construct a degree pattern from a list of (univariate) polys

Parameters

  [in] | l | some list of (univariate) polys

Definition at line 24 of file DegreePattern.cc.

{
m_data = NULL;
if (l.length() == 0)
m_data = new Pattern();
else
{
Variable x= Variable (1);
int p= getCharacteristic();
int d= 0;
char cGFName= 'Z';
if (CFFactory::gettype() == GaloisFieldDomain)
{
d= getGFDegree();
cGFName= gf_name;
}
setCharacteristic(0);
CanonicalForm buf= 1;
CFListIterator k= l;
for (int i= 0; i < l.length(); i++, k++)
buf *= (power (x, degree (k.getItem(), x)) + 1);
int j= 0;
for (CFIterator i= buf; i.hasTerms(); i++, j++)
;
ASSERT ( j > 1, "j > 1 expected" );
m_data = new Pattern( j - 1 );
int i= 0;
for (CFIterator m = buf; i < getLength(); i++, m++)
(*this) [i]= m.exp();
if (d > 1)
setCharacteristic (p, d, cGFName);
else
setCharacteristic (p);
}
}
power
CanonicalForm power(const CanonicalForm &f, int n)
exponentiation
Definition canonicalform.cc:1896
degree
int degree(const CanonicalForm &f)
Definition canonicalform.h:316
getGFDegree
int getGFDegree()
Definition cf_char.cc:75
setCharacteristic
void FACTORY_PUBLIC setCharacteristic(int c)
Definition cf_char.cc:28
CFListIterator
ListIterator< CanonicalForm > CFListIterator
Definition canonicalform.h:396
getCharacteristic
int FACTORY_PUBLIC getCharacteristic()
Definition cf_char.cc:70
l
int l
Definition cfEzgcd.cc:100
m
int m
Definition cfEzgcd.cc:128
i
int i
Definition cfEzgcd.cc:132
k
int k
Definition cfEzgcd.cc:99
x
Variable x
Definition cfModGcd.cc:4090
p
int p
Definition cfModGcd.cc:4086
GaloisFieldDomain
#define GaloisFieldDomain
Definition cf_defs.h:18
CFFactory::gettype
static int gettype()
Definition cf_factory.h:28
DegreePattern::getLength
int getLength() const
getter
Definition DegreePattern.h:86
j
int j
Definition facHensel.cc:110
gf_name
VAR char gf_name
Definition gfops.cc:52
buf
int status int void * buf
Definition si_signals.h:69

## ~DegreePattern()

DegreePattern::~DegreePattern | ( |  | ) |

inline

destructor

Definition at line 148 of file DegreePattern.h.

{
ASSERT( m_data != NULL, "non-null pointer expected" );
if( (--m_data->m_refCounter) < 1 )
release();
}
DegreePattern::release
void release()
clear m_data
Definition DegreePattern.h:48

## Member Function Documentation

## find()

int DegreePattern::find | ( | const int | x | ) | const

inline

find an element x

Returns
  find returns the index + 1 of x, if x is an element of the degree pattern, 0 otherwise

Parameters

  [in] | x | some int

Definition at line 159 of file DegreePattern.h.

{
if (getLength() == 0) return 0;
for (int i= 0; i < getLength(); i++)
if ((*this)[i] == x) return i + 1;
return 0;
};

## getLength()

int DegreePattern::getLength | ( |  | ) | const

inline

getter

Returns
  getLength returns the length of the degree pattern

Definition at line 86 of file DegreePattern.h.

{
ASSERT( m_data != NULL, "non-null pointer expected" );
return m_data->m_length;
}

## getPattern()

int * DegreePattern::getPattern | ( |  | ) | const

inline private

getter

Returns
  getPattern returns a degree pattern

Definition at line 74 of file DegreePattern.h.

{
ASSERT( m_data != NULL, "non-null pointer expected" );
ASSERT( m_data->m_pattern != NULL, "non-null pointer expected" );
return m_data->m_pattern;
}

## init()

void DegreePattern::init | ( | int | n | ) |

inline private

initialise a DegreePattern

Definition at line 60 of file DegreePattern.h.

{
ASSERT ( m_data != NULL, "non-null pointer expected" );
ASSERT( m_data->m_refCounter > 0, "ref count > 0 expected" );
if( (--m_data->m_refCounter) < 1 )
release();
m_data = new Pattern(n);
}

## intersect()

void DegreePattern::intersect | ( | const DegreePattern & | degPat | ) |

intersect two degree patterns

Parameters

  [in] | degPat | some degree pattern

Definition at line 68 of file DegreePattern.cc.

{
if (degPat.getLength() < getLength())
{
DegreePattern bufDeg= *this;
*this= degPat;
return (*this).intersect (bufDeg);
}
int count= 0;
int length= tmin (getLength(), degPat.getLength());
int* buf= new int [length];
for (int i= 0; i < length; i++)
{
if (degPat.find ((*this)[i]))
{
buf[i]= (*this)[i];
count++;
}
else
buf[i]= -1;
}
ASSERT ( count > 0, "count > 0 expected" );
init (count);
count= 0;
for (int i= 0; i < length; i++)
{
if (buf[i] != -1)
{
(*this) [count]= buf[i];
count++;
}
}
delete[] buf;
}
DegreePattern::find
int find(const int x) const
find an element x
Definition DegreePattern.h:159
DegreePattern::intersect
void intersect(const DegreePattern &degPat)
intersect two degree patterns
Definition DegreePattern.cc:68
DegreePattern::init
void init(int n)
initialise a DegreePattern
Definition DegreePattern.h:60
DegreePattern::DegreePattern
DegreePattern()
default constructor
Definition DegreePattern.h:117
tmin
template CanonicalForm tmin(const CanonicalForm &, const CanonicalForm &)
length
static BOOLEAN length(leftv result, leftv arg)
Definition interval.cc:257
count
int status int void size_t count
Definition si_signals.h:69

## operator=()

DegreePattern & DegreePattern::operator= | ( | const DegreePattern & | degPat | ) |

inline

assignment

Parameters

  [in] | degPat | some degree pattern

Definition at line 132 of file DegreePattern.h.

{
ASSERT( m_data != NULL, "non-null pointer expected" );
ASSERT( degPat.m_data != NULL, "non-null pointer expected" );
if( m_data != degPat.m_data )
{
m_data = degPat.m_data;
m_data->m_refCounter++;
}
return *this;
}

## operator[]() [1/2]

int & DegreePattern::operator[] | ( | const int | index | ) |

inline

operator []

Returns
  operator[] sets the element at index

Parameters

  [in] | index | some int >= 0, < getLength()

Definition at line 107 of file DegreePattern.h.

{
ASSERT( m_data != NULL, "non-null pointer expected" );
ASSERT( index >= 0 && index < getLength(), "bad index" );
ASSERT( getPattern() != NULL, "non-null pointer expected" );
return getPattern()[index];
}
DegreePattern::getPattern
int * getPattern() const
getter
Definition DegreePattern.h:74
index
static int index(p_Length length, p_Ord ord)
Definition p_Procs_Impl.h:592

## operator[]() [2/2]

int DegreePattern::operator[] | ( | const int | index | ) | const

inline

operator []

Returns
  operator[] returns the element at index

Parameters

  [in] | index | some int >= 0, < getLength()

Definition at line 95 of file DegreePattern.h.

{
ASSERT( m_data != NULL, "non-null pointer expected" );
ASSERT( index >= 0 && index < getLength(), "bad index" );
ASSERT( getPattern() != NULL, "non-null pointer expected" );
return getPattern()[index];
}

## refine()

void DegreePattern::refine | ( |  | ) |

Refine a degree pattern. Assumes that (*this)[0]:= d is the degree of the poly to be factored. Now for every other entry a there should be some entry b such that a+b= d. Elements which do not satisfy this relation are removed.

Definition at line 105 of file DegreePattern.cc.

{
if (getLength() <= 1)
return;
int count= 0;
int* buf= new int [getLength()];
int d= (*this) [0];
int pos;
for (int i= 0; i < getLength(); i++)
buf[i]= -1;
for (int i= 1; i < getLength(); i++)
{
pos= (*this).find (d - (*this)[i]);
if (pos)
{
buf[i]= (*this)[i];
count++;
}
}
buf[0]= d;
count++;
if (count == getLength())
{
delete [] buf;
return;
}
int length= getLength();
ASSERT ( count > 0, "count > 0 expected" );
init (count);
count= 0;
for (int i= 0; i < length; i++)
{
if (buf[i] != -1)
{
(*this)[count]= buf[i];
count++;
}
}
delete[] buf;
return;
}

## release()

void DegreePattern::release | ( |  | ) |

inline private

clear m_data

Definition at line 48 of file DegreePattern.h.

{
ASSERT ( m_data != NULL, "non-null pointer expected");
ASSERT ( m_data->m_refCounter == 0, "ref count of 0 expected");
if( m_data->m_pattern != NULL )
delete[] m_data->m_pattern;
m_data->m_pattern = NULL;
delete m_data;
m_data = NULL;
}

## Field Documentation

## m_data

struct DegreePattern::Pattern* DegreePattern::m_data

private

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

- factory/DegreePattern.h
- factory/DegreePattern.cc