Loading...
Searching...
No Matches
ModPMatrixProxyOnArray< number_type > Class Template Reference

`#include <tgb_internal.h>`

## Public Member Functions

| ModPMatrixProxyOnArray (number_type *array, int nnrows, int nncols)
| ~ModPMatrixProxyOnArray ()
void | permRows (int i, int j)
void | multiplyRow (int row, number_type coef)
void | reduceOtherRowsForward (int r)
void | updateStartIndex (int row, int lower_bound)
int | getStartIndex (int row)
BOOLEAN | findPivot (int &r, int &c)

## Data Fields

int | ncols
int | nrows

## Protected Attributes

number_type ** | rows
int * | startIndices

## Friends

class | ModPMatrixBackSubstProxyOnArray< number_type >

## Detailed Description

template<class number_type>
class ModPMatrixProxyOnArray< number_type >

Definition at line 1501 of file tgb_internal.h.

## Constructor & Destructor Documentation

## ModPMatrixProxyOnArray()

template<class number_type>

ModPMatrixProxyOnArray< number_type >::ModPMatrixProxyOnArray | ( | number_type * | array,
|  | int | nnrows,
|  | int | nncols )

inline

Definition at line 1507 of file tgb_internal.h.

{
this->ncols=nncols;
this->nrows=nnrows;
rows=(number_type**) omalloc((size_t)nnrows*sizeof(number_type*));
startIndices=(int*)omalloc((size_t)nnrows*sizeof(int));
int i;
for(i=0;i<nnrows;i++)
{
rows[i]=array+((long)i*(long)nncols);
updateStartIndex(i,-1);
}
}
ModPMatrixProxyOnArray
Definition tgb_internal.h:1502
ModPMatrixProxyOnArray::startIndices
int * startIndices
Definition tgb_internal.h:1681
ModPMatrixProxyOnArray::ncols
int ncols
Definition tgb_internal.h:1506
ModPMatrixProxyOnArray::nrows
int nrows
Definition tgb_internal.h:1506
ModPMatrixProxyOnArray::rows
number_type ** rows
Definition tgb_internal.h:1680
ModPMatrixProxyOnArray::updateStartIndex
void updateStartIndex(int row, int lower_bound)
Definition tgb_internal.h:1640
omalloc
#define omalloc(size)
Definition omAllocDecl.h:228

## ~ModPMatrixProxyOnArray()

template<class number_type>

ModPMatrixProxyOnArray< number_type >::~ModPMatrixProxyOnArray | ( |  | ) |

inline

Definition at line 1520 of file tgb_internal.h.

{
omfree(rows);
omfree(startIndices);
}
omfree
#define omfree(addr)
Definition omAllocDecl.h:237

## Member Function Documentation

## findPivot()

template<class number_type>

BOOLEAN ModPMatrixProxyOnArray< number_type >::findPivot | ( | int & | r,
|  | int & | c )

inline

Definition at line 1657 of file tgb_internal.h.

{
//row>=r, col>=c
while(c<ncols)
{
int i;
for(i=r;i<nrows;i++)
{
assume(startIndices[i]>=c);
if (startIndices[i]==c)
{
//r=i;
if (r!=i)
permRows(r,i);
return TRUE;
}
}
c++;
}
return FALSE;
}
ModPMatrixProxyOnArray::permRows
void permRows(int i, int j)
Definition tgb_internal.h:1526
assume
#define assume(x)
Definition mod2.h:389

## getStartIndex()

template<class number_type>

int ModPMatrixProxyOnArray< number_type >::getStartIndex | ( | int | row | ) |

inline

Definition at line 1653 of file tgb_internal.h.

{
return startIndices[row];
}

## multiplyRow()

template<class number_type>

void ModPMatrixProxyOnArray< number_type >::multiplyRow | ( | int | row,
|  | number_type | coef )

inline

Definition at line 1535 of file tgb_internal.h.

{
int i;
number_type* row_array=rows[row];
if(currRing->cf->ch<=NV_MAX_PRIME)
{
for(i=startIndices[row];i<ncols;i++)
{
row_array[i]=F4mat_to_number_type(npMult((number)(long) row_array[i],(number)(long) coef,currRing->cf));
}
}
else
{
for(i=startIndices[row];i<ncols;i++)
{
row_array[i]=F4mat_to_number_type(nvMult((number)(long) row_array[i],(number)(long) coef,currRing->cf));
}
}
}
nvMult
static number nvMult(number a, number b, const coeffs r)
Definition modulop_inl.h:50
npMult
static number npMult(number a, number b, const coeffs r)
Definition modulop_inl.h:12
F4mat_to_number_type
#define F4mat_to_number_type(a)
Definition tgb_internal.h:410

## permRows()

template<class number_type>

void ModPMatrixProxyOnArray< number_type >::permRows | ( | int | i,
|  | int | j )

inline

Definition at line 1526 of file tgb_internal.h.

{
number_type* h=rows[i];
rows[i]=rows[j];
rows[j]=h;
int hs=startIndices[i];
startIndices[i]=startIndices[j];
startIndices[j]=hs;
}

## reduceOtherRowsForward()

template<class number_type>

void ModPMatrixProxyOnArray< number_type >::reduceOtherRowsForward | ( | int | r | ) |

inline

Definition at line 1554 of file tgb_internal.h.

{
//assume rows "under r" have bigger or equal start index
number_type* row_array=rows[r];
number_type zero=F4mat_to_number_type((number)0 /*npInit(0, currRing)*/);
int start=startIndices[r];
number_type coef=row_array[start];
assume(start<ncols);
int other_row;
assume(!(npIsZero((number)(long) row_array[start],currRing->cf)));
if (!(npIsOne((number)(long) coef,currRing->cf)))
multiplyRow(r,F4mat_to_number_type(npInversM((number)(long) coef,currRing->cf)));
assume(npIsOne((number)(long) row_array[start],currRing->cf));
int lastIndex=modP_lastIndexRow(row_array, ncols);
number minus_one=npInit(-1, currRing->cf);
if(currRing->cf->ch<=NV_MAX_PRIME)
{
for (other_row=r+1;other_row<nrows;other_row++)
{
assume(startIndices[other_row]>=start);
if (startIndices[other_row]==start)
{
int i;
number_type* other_row_array=rows[other_row];
number coef2=npNegM((number)(long) other_row_array[start],currRing->cf);
if (coef2==minus_one)
{
for(i=start;i<=lastIndex;i++)
{
if (row_array[i]!=zero)
{
other_row_array[i]=F4mat_to_number_type(npSubM((number)(long) other_row_array[i], (number)(long) row_array[i],currRing->cf));
}
}
}
else
{
for(i=start;i<=lastIndex;i++)
{
if (row_array[i]!=zero)
{
other_row_array[i]=F4mat_to_number_type(npAddM(npMult(coef2,(number)(long) row_array[i],currRing->cf),(number)(long) other_row_array[i],currRing->cf));
}
}
}
updateStartIndex(other_row,start);
assume(npIsZero((number)(long) other_row_array[start],currRing->cf));
}
}
}
else /* ch>NV_MAX_PRIME*/
{
for (other_row=r+1;other_row<nrows;other_row++)
{
assume(startIndices[other_row]>=start);
if (startIndices[other_row]==start)
{
int i;
number_type* other_row_array=rows[other_row];
number coef2=npNegM((number)(long) other_row_array[start],currRing->cf);
if (coef2==minus_one)
{
for(i=start;i<=lastIndex;i++)
{
if (row_array[i]!=zero)
{
other_row_array[i]=F4mat_to_number_type(npSubM((number)(long) other_row_array[i], (number)(long) row_array[i],currRing->cf));
}
}
}
else
{
for(i=start;i<=lastIndex;i++)
{
if (row_array[i]!=zero)
{
other_row_array[i]=F4mat_to_number_type(npAddM(nvMult(coef2,(number)(long) row_array[i],currRing->cf),(number)(long) other_row_array[i],currRing->cf));
}
}
}
updateStartIndex(other_row,start);
assume(npIsZero((number)(long) other_row_array[start],currRing->cf));
}
}
}
}
ModPMatrixProxyOnArray::multiplyRow
void multiplyRow(int row, number_type coef)
Definition tgb_internal.h:1535
npIsOne
static BOOLEAN npIsOne(number a, const coeffs)
Definition modulop.h:179
npAddM
static number npAddM(number a, number b, const coeffs r)
Definition modulop.h:124
npNegM
static number npNegM(number a, const coeffs r)
Definition modulop.h:174
npInversM
static number npInversM(number c, const coeffs r)
Definition modulop.h:223
npSubM
static number npSubM(number a, number b, const coeffs r)
Definition modulop.h:134
npInit
static number npInit(long i, const coeffs r)
Definition modulop_inl.h:27
npIsZero
static BOOLEAN npIsZero(number a, const coeffs r)
Definition modulop_inl.h:38
modP_lastIndexRow
int modP_lastIndexRow(number_type *row, int ncols)
Definition tgb_internal.h:1482

## updateStartIndex()

template<class number_type>

void ModPMatrixProxyOnArray< number_type >::updateStartIndex | ( | int | row,
|  | int | lower_bound )

inline

Definition at line 1640 of file tgb_internal.h.

{
number_type* row_array=rows[row];
assume((lower_bound<0)||(npIsZero((number)(long) row_array[lower_bound],currRing->cf)));
int i;
//number_type zero=npInit(0);
for(i=lower_bound+1;i<ncols;i++)
{
if (!(row_array[i]==0))
break;
}
startIndices[row]=i;
}

## Friends And Related Symbol Documentation

## ModPMatrixBackSubstProxyOnArray< number_type >

template<class number_type>

friend class ModPMatrixBackSubstProxyOnArray< number_type >

friend

Definition at line 1170 of file tgb_internal.h.

## Field Documentation

## ncols

template<class number_type>

int ModPMatrixProxyOnArray< number_type >::ncols

Definition at line 1506 of file tgb_internal.h.

## nrows

template<class number_type>

int ModPMatrixProxyOnArray< number_type >::nrows

Definition at line 1506 of file tgb_internal.h.

## rows

template<class number_type>

number_type** ModPMatrixProxyOnArray< number_type >::rows

protected

Definition at line 1680 of file tgb_internal.h.

## startIndices

template<class number_type>

int* ModPMatrixProxyOnArray< number_type >::startIndices

protected

Definition at line 1681 of file tgb_internal.h.

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

- kernel/GBEngine/tgb_internal.h