Loading...
Searching...
No Matches
fglmVectorRep Class Reference

## Public Member Functions

| fglmVectorRep ()
| fglmVectorRep (int n, number *e)
| fglmVectorRep (int n)
| ~fglmVectorRep ()
fglmVectorRep * | clone () const
BOOLEAN | deleteObject ()
fglmVectorRep * | copyObject ()
int | refcount () const
BOOLEAN | isUnique () const
int | size () const
int | isZero () const
int | numNonZeroElems () const
void | setelem (int i, number n)
number | ejectelem (int i, number n)
number & | getelem (int i)
number | getconstelem (int i) const

## Private Attributes

int | ref_count
int | N
number * | elems

## Friends

class | fglmVector

## Detailed Description

Definition at line 30 of file fglmvec.cc.

## Constructor & Destructor Documentation

## fglmVectorRep() [1/3]

fglmVectorRep::fglmVectorRep | ( |  | ) |

inline

Definition at line 37 of file fglmvec.cc.

:ref_count (1), N (0), elems (0)
{
}
fglmVectorRep::ref_count
int ref_count
Definition fglmvec.cc:33
fglmVectorRep::N
int N
Definition fglmvec.cc:34
fglmVectorRep::elems
number * elems
Definition fglmvec.cc:35

## fglmVectorRep() [2/3]

fglmVectorRep::fglmVectorRep | ( | int | n,
|  | number * | e )

inline

Definition at line 40 of file fglmvec.cc.

:ref_count (1), N (n), elems (e)
{
}

## fglmVectorRep() [3/3]

fglmVectorRep::fglmVectorRep | ( | int | n | ) |

inline

Definition at line 43 of file fglmvec.cc.

:ref_count (1), N (n)
{
fglmASSERT (N >= 0, "illegal Vector representation");
if(N == 0)
elems = 0;
else
{
elems = (number *) omAlloc (N * sizeof (number));
for(int i = N - 1; i >= 0; i--)
elems[i] = nInit (0);
}
}
i
int i
Definition cfEzgcd.cc:132
fglmASSERT
#define fglmASSERT(ignore1, ignore2)
Definition fglmvec.cc:28
nInit
#define nInit(i)
Definition numbers.h:24
omAlloc
#define omAlloc(size)
Definition omAllocDecl.h:210

## ~fglmVectorRep()

fglmVectorRep::~fglmVectorRep | ( |  | ) |

inline

Definition at line 55 of file fglmvec.cc.

{
if(N > 0)
{
for(int i = N - 1; i >= 0; i--)
nDelete (elems + i);
omFreeSize ((ADDRESS) elems, N * sizeof (number));
}
}
ADDRESS
void * ADDRESS
Definition auxiliary.h:120
nDelete
#define nDelete(n)
Definition numbers.h:16
omFreeSize
#define omFreeSize(addr, size)
Definition omAllocDecl.h:260

## Member Function Documentation

## clone()

fglmVectorRep * fglmVectorRep::clone | ( |  | ) | const

inline

Definition at line 65 of file fglmvec.cc.

{
if(N > 0)
{
number *elems_clone;
elems_clone = (number *) omAlloc (N * sizeof (number));
for(int i = N - 1; i >= 0; i--)
elems_clone[i] = nCopy (elems[i]);
return new fglmVectorRep (N, elems_clone);
}
else
return new fglmVectorRep (N, 0);
}
fglmVectorRep::fglmVectorRep
fglmVectorRep()
Definition fglmvec.cc:37
nCopy
#define nCopy(n)
Definition numbers.h:15

## copyObject()

fglmVectorRep * fglmVectorRep::copyObject | ( |  | ) |

inline

Definition at line 82 of file fglmvec.cc.

{
ref_count++;
return this;
}

## deleteObject()

BOOLEAN fglmVectorRep::deleteObject | ( |  | ) |

inline

Definition at line 78 of file fglmvec.cc.

{
return --ref_count == 0;
}

## ejectelem()

number fglmVectorRep::ejectelem | ( | int | i,
|  | number | n )

inline

Definition at line 127 of file fglmvec.cc.

{
fglmASSERT (isUnique (), "should only be called if unique!");
number temp = elems[i - 1];
elems[i - 1] = n;
return temp;
}
fglmVectorRep::isUnique
BOOLEAN isUnique() const
Definition fglmvec.cc:91

## getconstelem()

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

inline

Definition at line 139 of file fglmvec.cc.

{
fglmASSERT (0 < i && i <= N, "getconstelem: wrong index");
return elems[i - 1];
}

## getelem()

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

inline

Definition at line 134 of file fglmvec.cc.

{
fglmASSERT (0 < i && i <= N, "getelem: wrong index");
return elems[i - 1];
}

## isUnique()

BOOLEAN fglmVectorRep::isUnique | ( |  | ) | const

inline

Definition at line 91 of file fglmvec.cc.

{
return ref_count == 1;
}

## isZero()

int fglmVectorRep::isZero | ( |  | ) | const

inline

Definition at line 100 of file fglmvec.cc.

{
int k;
for(k = N; k > 0; k--)
{
if(!nIsZero (getconstelem (k)))
return 0;
}
return 1;
}
k
int k
Definition cfEzgcd.cc:99
fglmVectorRep::getconstelem
number getconstelem(int i) const
Definition fglmvec.cc:139
nIsZero
#define nIsZero(n)
Definition numbers.h:19

## numNonZeroElems()

int fglmVectorRep::numNonZeroElems | ( |  | ) | const

inline

Definition at line 110 of file fglmvec.cc.

{
int num = 0;
int k;
for(k = N; k > 0; k--)
{
if(!nIsZero (getconstelem (k)))
num++;
}
return num;
}
num
CanonicalForm num(const CanonicalForm &f)
Definition canonicalform.h:337

## refcount()

int fglmVectorRep::refcount | ( |  | ) | const

inline

Definition at line 87 of file fglmvec.cc.

{
return ref_count;
}

## setelem()

void fglmVectorRep::setelem | ( | int | i,
|  | number | n )

inline

Definition at line 121 of file fglmvec.cc.

{
fglmASSERT (0 < i && i <= N, "setelem: wrong index");
nDelete (elems + i - 1);
elems[i - 1] = n;
}

## size()

int fglmVectorRep::size | ( |  | ) | const

inline

Definition at line 96 of file fglmvec.cc.

{
return N;
}

## Friends And Related Symbol Documentation

## fglmVector

friend class fglmVector

friend

Definition at line 144 of file fglmvec.cc.

## Field Documentation

## elems

number* fglmVectorRep::elems

private

Definition at line 35 of file fglmvec.cc.

## N

int fglmVectorRep::N

private

Definition at line 34 of file fglmvec.cc.

## ref_count

int fglmVectorRep::ref_count

private

Definition at line 33 of file fglmvec.cc.

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

- kernel/fglm/fglmvec.cc