Loading...
Searching...
No Matches
fglmVector Class Reference

`#include <fglmvec.h>`

## Public Member Functions

| fglmVector ()
| fglmVector (int size)
| fglmVector (int size, int basis)
| fglmVector (const fglmVector &v)
| ~fglmVector ()
int | size () const
int | numNonZeroElems () const
void | nihilate (const number fac1, const number fac2, const fglmVector v)
fglmVector & | operator= (const fglmVector &v)
int | operator== (const fglmVector &)
int | operator!= (const fglmVector &)
int | isZero ()
int | elemIsZero (int i)
fglmVector & | operator+= (const fglmVector &)
fglmVector & | operator-= (const fglmVector &)
fglmVector & | operator*= (const number &)
fglmVector & | operator/= (const number &)
number | getconstelem (int i) const
number & | getelem (int i)
void | setelem (int i, number &n)
number | gcd () const
number | clearDenom ()

## Protected Member Functions

void | makeUnique ()
| fglmVector (fglmVectorRep *rep)

## Protected Attributes

fglmVectorRep * | rep

## Friends

fglmVector | operator- (const fglmVector &v)
fglmVector | operator+ (const fglmVector &lhs, const fglmVector &rhs)
fglmVector | operator- (const fglmVector &lhs, const fglmVector &rhs)
fglmVector | operator* (const fglmVector &v, const number n)
fglmVector | operator* (const number n, const fglmVector &v)

## Detailed Description

Definition at line 18 of file fglmvec.h.

## Constructor & Destructor Documentation

## fglmVector() [1/5]

fglmVector::fglmVector | ( | fglmVectorRep * | r | ) |

protected

## Implementation of class fglmVector

Definition at line 152 of file fglmvec.cc.

:rep (r)
{
}
fglmVector::rep
fglmVectorRep * rep
Definition fglmvec.h:21

## fglmVector() [2/5]

fglmVector::fglmVector | ( |  | ) |

Definition at line 156 of file fglmvec.cc.

:rep (new fglmVectorRep ())
{
}

## fglmVector() [3/5]

fglmVector::fglmVector | ( | int | size | ) |

Definition at line 160 of file fglmvec.cc.

:rep (new fglmVectorRep (size))
{
}
fglmVector::size
int size() const
Definition fglmvec.cc:207

## fglmVector() [4/5]

fglmVector::fglmVector | ( | int | size,
|  | int | basis )

Definition at line 164 of file fglmvec.cc.

:rep (new fglmVectorRep (size))
{
rep->setelem (basis, nInit (1));
}
nInit
#define nInit(i)
Definition numbers.h:24

## fglmVector() [5/5]

fglmVector::fglmVector | ( | const fglmVector & | v | ) |

Definition at line 169 of file fglmvec.cc.

{
rep = v.rep->copyObject ();
}
v
const Variable & v
< [in] a sqrfree bivariate poly
Definition facBivar.h:39

## ~fglmVector()

fglmVector::~fglmVector | ( |  | ) |

Definition at line 174 of file fglmvec.cc.

{
if(rep->deleteObject ())
delete rep;
}

## Member Function Documentation

## clearDenom()

number fglmVector::clearDenom | ( |  | ) |

Definition at line 505 of file fglmvec.cc.

{
number theLcm = nInit (1);
if (getCoeffType(currRing->cf)==n_Zp)
{
return theLcm;
}
BOOLEAN isZero = TRUE;
int i;
for(i = size (); i > 0; i--)
{
if(!nIsZero (rep->getconstelem (i)))
{
isZero = FALSE;
number temp = n_NormalizeHelper (theLcm, rep->getconstelem (i), currRing->cf);
nDelete (&theLcm);
theLcm = temp;
}
}
if(isZero)
{
nDelete (&theLcm);
theLcm = nInit (0);
}
else
{
if(!nIsOne (theLcm))
{
*this *= theLcm;
for(i = size (); i > 0; i--)
{
nNormalize (rep->getelem (i));
}
}
}
return theLcm;
}
BOOLEAN
int BOOLEAN
Definition auxiliary.h:88
TRUE
#define TRUE
Definition auxiliary.h:101
FALSE
#define FALSE
Definition auxiliary.h:97
i
int i
Definition cfEzgcd.cc:132
fglmVector::isZero
int isZero()
Definition fglmvec.cc:295
n_NormalizeHelper
static FORCE_INLINE number n_NormalizeHelper(number a, number b, const coeffs r)
assume that r is a quotient field (otherwise, return 1) for arguments (a1/a2,b1/b2) return (lcm(a1,...
Definition coeffs.h:698
n_Zp
@ n_Zp
\F{p < 2^31}
Definition coeffs.h:29
getCoeffType
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition coeffs.h:431
nDelete
#define nDelete(n)
Definition numbers.h:16
nIsZero
#define nIsZero(n)
Definition numbers.h:19
nIsOne
#define nIsOne(n)
Definition numbers.h:25
nNormalize
#define nNormalize(n)
Definition numbers.h:30
currRing
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition polys.cc:13

## elemIsZero()

int fglmVector::elemIsZero | ( | int | i | ) |

Definition at line 300 of file fglmvec.cc.

{
return nIsZero (rep->getconstelem (i));
}

## gcd()

number fglmVector::gcd | ( |  | ) | const

Definition at line 458 of file fglmvec.cc.

{
int i = rep->size ();
BOOLEAN found = FALSE;
BOOLEAN gcdIsOne = FALSE;
number theGcd;
number current;
while(i > 0 && !found)
{
current = rep->getconstelem (i);
if(!nIsZero (current))
{
theGcd = nCopy (current);
found = TRUE;
if(!nGreaterZero (theGcd))
{
theGcd = nInpNeg (theGcd);
}
if(nIsOne (theGcd))
gcdIsOne = TRUE;
}
i--;
}
if(found)
{
if (getCoeffType(currRing->cf)!=n_Zp)
{
while(i > 0 && !gcdIsOne)
{
current = rep->getconstelem (i);
if(!nIsZero (current))
{
number temp = n_SubringGcd (theGcd, current, currRing->cf);
nDelete (&theGcd);
theGcd = temp;
if(nIsOne (theGcd))
gcdIsOne = TRUE;
}
i--;
}
}
}
else
theGcd = nInit (0);
return theGcd;
}
n_SubringGcd
static FORCE_INLINE number n_SubringGcd(number a, number b, const coeffs r)
Definition coeffs.h:669
found
bool found
Definition facFactorize.cc:55
nInpNeg
#define nInpNeg(n)
Definition numbers.h:21
nCopy
#define nCopy(n)
Definition numbers.h:15
nGreaterZero
#define nGreaterZero(n)
Definition numbers.h:27

## getconstelem()

number fglmVector::getconstelem | ( | int | i | ) | const

Definition at line 446 of file fglmvec.cc.

{
return rep->getconstelem (i);
}

## getelem()

number & fglmVector::getelem | ( | int | i | ) |

Definition at line 440 of file fglmvec.cc.

{
makeUnique ();
return rep->getelem (i);
}
fglmVector::makeUnique
void makeUnique()
Definition fglmvec.cc:198

## isZero()

int fglmVector::isZero | ( |  | ) |

Definition at line 295 of file fglmvec.cc.

{
return rep->isZero ();
}

## makeUnique()

void fglmVector::makeUnique | ( |  | ) |

protected

Definition at line 198 of file fglmvec.cc.

{
if(rep->refcount () != 1)
{
rep->deleteObject ();
rep = rep->clone ();
}
}

## nihilate()

void fglmVector::nihilate | ( | const number | fac1,
|  | const number | fac2,
|  | const fglmVector | v )

Definition at line 218 of file fglmvec.cc.

{
int i;
int vsize = v.size ();
number term1, term2;
fglmASSERT (vsize <= rep->size (), "v has to be smaller or equal");
if(rep->isUnique ())
{
for(i = vsize; i > 0; i--)
{
term1 = nMult (fac1, rep->getconstelem (i));
term2 = nMult (fac2, v.rep->getconstelem (i));
rep->setelem (i, nSub (term1, term2));
nDelete (&term1);
nDelete (&term2);
}
for(i = rep->size (); i > vsize; i--)
{
rep->setelem (i, nMult (fac1, rep->getconstelem (i)));
}
}
else
{
number *newelems;
newelems = (number *) omAlloc (rep->size () * sizeof (number));
for(i = vsize; i > 0; i--)
{
term1 = nMult (fac1, rep->getconstelem (i));
term2 = nMult (fac2, v.rep->getconstelem (i));
newelems[i - 1] = nSub (term1, term2);
nDelete (&term1);
nDelete (&term2);
}
for(i = rep->size (); i > vsize; i--)
{
newelems[i - 1] = nMult (fac1, rep->getconstelem (i));
}
rep->deleteObject ();
rep = new fglmVectorRep (rep->size (), newelems);
}
}
fglmASSERT
#define fglmASSERT(ignore1, ignore2)
Definition fglm.h:23
nSub
#define nSub(n1, n2)
Definition numbers.h:22
nMult
#define nMult(n1, n2)
Definition numbers.h:17
omAlloc
#define omAlloc(size)
Definition omAllocDecl.h:210

## numNonZeroElems()

int fglmVector::numNonZeroElems | ( |  | ) | const

Definition at line 212 of file fglmvec.cc.

{
return rep->numNonZeroElems ();
}

## operator!=()

int fglmVector::operator!= | ( | const fglmVector & | v | ) |

Definition at line 290 of file fglmvec.cc.

{
return !(*this == v);
}

## operator*=()

fglmVector & fglmVector::operator*= | ( | const number & | n | ) |

Definition at line 350 of file fglmvec.cc.

{
int s = rep->size ();
int i;
if(!rep->isUnique ())
{
number *temp;
temp = (number *) omAlloc (s * sizeof (number));
for(i = s; i > 0; i--)
temp[i - 1] = nMult (rep->getconstelem (i), n);
rep->deleteObject ();
rep = new fglmVectorRep (s, temp);
}
else
{
for(i = s; i > 0; i--)
nInpMult (rep->getelem (i), n);
}
return *this;
}
s
const CanonicalForm int s
Definition facAbsFact.cc:51
nInpMult
#define nInpMult(a, b)
Definition numbers.h:37

## operator+=()

fglmVector & fglmVector::operator+= | ( | const fglmVector & | v | ) |

Definition at line 305 of file fglmvec.cc.

{
fglmASSERT (size () == v.size (), "incompatible vectors");
// ACHTUNG : Das Verhalten hier mit gcd genau ueberpruefen!
int i;
if(rep->isUnique ())
{
for(i = rep->size (); i > 0; i--)
n_InpAdd (rep->getelem(i), v.rep->getconstelem (i), currRing->cf);
}
else
{
int n = rep->size ();
number *newelems;
newelems = (number *) omAlloc (n * sizeof (number));
for(i = n; i > 0; i--)
newelems[i - 1] = nAdd (rep->getconstelem (i), v.rep->getconstelem (i));
rep->deleteObject ();
rep = new fglmVectorRep (n, newelems);
}
return *this;
}
n_InpAdd
static FORCE_INLINE void n_InpAdd(number &a, number b, const coeffs r)
addition of 'a' and 'b'; replacement of 'a' by the sum a+b
Definition coeffs.h:649
nAdd
#define nAdd(n1, n2)
Definition numbers.h:18

## operator-=()

fglmVector & fglmVector::operator-= | ( | const fglmVector & | v | ) |

Definition at line 328 of file fglmvec.cc.

{
fglmASSERT (size () == v.size (), "incompatible vectors");
int i;
if(rep->isUnique ())
{
for(i = rep->size (); i > 0; i--)
rep->setelem (i, nSub (rep->getconstelem (i), v.rep->getconstelem (i)));
}
else
{
int n = rep->size ();
number *newelems;
newelems = (number *) omAlloc (n * sizeof (number));
for(i = n; i > 0; i--)
newelems[i - 1] = nSub (rep->getconstelem (i), v.rep->getconstelem (i));
rep->deleteObject ();
rep = new fglmVectorRep (n, newelems);
}
return *this;
}

## operator/=()

fglmVector & fglmVector::operator/= | ( | const number & | n | ) |

Definition at line 371 of file fglmvec.cc.

{
int s = rep->size ();
int i;
if(!rep->isUnique ())
{
number *temp;
temp = (number *) omAlloc (s * sizeof (number));
for(i = s; i > 0; i--)
{
temp[i - 1] = nDiv (rep->getconstelem (i), n);
nNormalize (temp[i - 1]);
}
rep->deleteObject ();
rep = new fglmVectorRep (s, temp);
}
else
{
for(i = s; i > 0; i--)
{
rep->setelem (i, nDiv (rep->getconstelem (i), n));
nNormalize (rep->getelem (i));
}
}
return *this;
}
nDiv
#define nDiv(a, b)
Definition numbers.h:32

## operator=()

fglmVector & fglmVector::operator= | ( | const fglmVector & | v | ) |

Definition at line 261 of file fglmvec.cc.

{
if(this != &v)
{
if(rep->deleteObject ())
delete rep;
rep = v.rep->copyObject ();
}
return *this;
}

## operator==()

int fglmVector::operator== | ( | const fglmVector & | v | ) |

Definition at line 272 of file fglmvec.cc.

{
if(rep->size () == v.rep->size ())
{
if(rep == v.rep)
return 1;
else
{
int i;
for(i = rep->size (); i > 0; i--)
if(!nEqual (rep->getconstelem (i), v.rep->getconstelem (i)))
return 0;
return 1;
}
}
return 0;
}
nEqual
#define nEqual(n1, n2)
Definition numbers.h:20

## setelem()

void fglmVector::setelem | ( | int | i,
|  | number & | n )

Definition at line 451 of file fglmvec.cc.

{
makeUnique ();
rep->setelem (i, n);
n = n_Init (0, currRing->cf);
}
n_Init
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:541

## size()

int fglmVector::size | ( |  | ) | const

Definition at line 207 of file fglmvec.cc.

{
return rep->size ();
}

## Friends And Related Symbol Documentation

## operator* [1/2]

fglmVector operator* | ( | const fglmVector & | v,
|  | const number | n )

friend

Definition at line 426 of file fglmvec.cc.

{
fglmVector temp = v;
temp *= n;
return temp;
}
fglmVector::fglmVector
fglmVector(fglmVectorRep *rep)
Definition fglmvec.cc:152

## operator* [2/2]

fglmVector operator* | ( | const number | n,
|  | const fglmVector & | v )

friend

Definition at line 433 of file fglmvec.cc.

{
fglmVector temp = v;
temp *= n;
return temp;
}

## operator+

fglmVector operator+ | ( | const fglmVector & | lhs,
|  | const fglmVector & | rhs )

friend

Definition at line 412 of file fglmvec.cc.

{
fglmVector temp = lhs;
temp += rhs;
return temp;
}

## operator- [1/2]

fglmVector operator- | ( | const fglmVector & | lhs,
|  | const fglmVector & | rhs )

friend

Definition at line 419 of file fglmvec.cc.

{
fglmVector temp = lhs;
temp -= rhs;
return temp;
}

## operator- [2/2]

fglmVector operator- | ( | const fglmVector & | v | ) |

friend

Definition at line 398 of file fglmvec.cc.

{
fglmVector temp (v.size ());
int i;
number n;
for(i = v.size (); i > 0; i--)
{
n = nCopy (v.getconstelem (i));
n = nInpNeg (n);
temp.setelem (i, n);
}
return temp;
}

## Field Documentation

## rep

fglmVectorRep* fglmVector::rep

protected

Definition at line 21 of file fglmvec.h.

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

- kernel/fglm/fglmvec.h
- kernel/fglm/fglmvec.cc