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

`#include <tgb_internal.h>`

## Public Member Functions

void | multiplyRow (int row, number_type coef)
| ModPMatrixBackSubstProxyOnArray (ModPMatrixProxyOnArray< number_type > &p)
void | updateLastReducibleIndex (int r, int upper_bound)
void | backwardSubstitute (int r)
| ~ModPMatrixBackSubstProxyOnArray ()
void | backwardSubstitute ()

## Private Attributes

int * | startIndices
number_type ** | rows
int * | lastReducibleIndices
int | ncols
int | nrows
int | nonZeroUntil

## Detailed Description

template<class number_type>
class ModPMatrixBackSubstProxyOnArray< number_type >

Definition at line 1683 of file tgb_internal.h.

## Constructor & Destructor Documentation

## ModPMatrixBackSubstProxyOnArray()

template<class number_type>

ModPMatrixBackSubstProxyOnArray< number_type >::ModPMatrixBackSubstProxyOnArray | ( | ModPMatrixProxyOnArray< number_type > & | p | ) |

inline

Definition at line 1692 of file tgb_internal.h.

{
// (number_type* array, int nrows, int ncols, int* startIndices, number_type** rows){
//we borrow some parameters ;-)
//we assume, that nobody changes the order of the rows
this->startIndices=p.startIndices;
this->rows=p.rows;
this->ncols=p.ncols;
this->nrows=p.nrows;
lastReducibleIndices=(int*) omalloc(nrows*sizeof(int));
nonZeroUntil=0;
while(nonZeroUntil<nrows)
{
if (startIndices[nonZeroUntil]<ncols)
{
nonZeroUntil++;
}
else break;
}
if (TEST_OPT_PROT)
Print("rank:%i\n",nonZeroUntil);
nonZeroUntil--;
int i;
for(i=0;i<=nonZeroUntil;i++)
{
assume(startIndices[i]<ncols);
assume(!(npIsZero((number)(long) rows[i][startIndices[i]],currRing->cf)));
assume(startIndices[i]>=i);
updateLastReducibleIndex(i,nonZeroUntil+1);
}
}
ModPMatrixBackSubstProxyOnArray
Definition tgb_internal.h:1684
ModPMatrixBackSubstProxyOnArray::updateLastReducibleIndex
void updateLastReducibleIndex(int r, int upper_bound)
Definition tgb_internal.h:1742
ModPMatrixBackSubstProxyOnArray::startIndices
int * startIndices
Definition tgb_internal.h:1685
ModPMatrixBackSubstProxyOnArray::nonZeroUntil
int nonZeroUntil
Definition tgb_internal.h:1690
ModPMatrixBackSubstProxyOnArray::lastReducibleIndices
int * lastReducibleIndices
Definition tgb_internal.h:1687
ModPMatrixBackSubstProxyOnArray::nrows
int nrows
Definition tgb_internal.h:1689
ModPMatrixBackSubstProxyOnArray::rows
number_type ** rows
Definition tgb_internal.h:1686
ModPMatrixBackSubstProxyOnArray::ncols
int ncols
Definition tgb_internal.h:1688
Print
#define Print
Definition emacs.cc:80
assume
#define assume(x)
Definition mod2.h:389
npIsZero
static BOOLEAN npIsZero(number a, const coeffs r)
Definition modulop_inl.h:38
omalloc
#define omalloc(size)
Definition omAllocDecl.h:228

## ~ModPMatrixBackSubstProxyOnArray()

template<class number_type>

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

inline

Definition at line 1760 of file tgb_internal.h.

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

## Member Function Documentation

## backwardSubstitute() [1/2]

template<class number_type>

void ModPMatrixBackSubstProxyOnArray< number_type >::backwardSubstitute | ( |  | ) |

inline

Definition at line 1828 of file tgb_internal.h.

{
int i;
for(i=nonZeroUntil;i>0;i--)
{
backwardSubstitute(i);
}
}
ModPMatrixBackSubstProxyOnArray::backwardSubstitute
void backwardSubstitute(int r)
Definition tgb_internal.h:1760

## backwardSubstitute() [2/2]

template<class number_type>

void ModPMatrixBackSubstProxyOnArray< number_type >::backwardSubstitute | ( | int | r | ) |

inline

Definition at line 1760 of file tgb_internal.h.

{
int start=startIndices[r];
assume(start<ncols);
number_type zero=0;//npInit(0);
number_type* row_array=rows[r];
assume((!(npIsZero((number)(long) row_array[start],currRing->cf))));
assume(start<ncols);
int other_row;
if (!(npIsOne((number)(long) row_array[r],currRing->cf)))
{
//it should be one, but this safety is not expensive
multiplyRow(r, F4mat_to_number_type(npInversM((number)(long) row_array[start],currRing->cf)));
}
int lastIndex=modP_lastIndexRow(row_array, ncols);
assume(lastIndex<ncols);
assume(lastIndex>=0);
if(currRing->cf->ch<=NV_MAX_PRIME)
{
for(other_row=r-1;other_row>=0;other_row--)
{
assume(lastReducibleIndices[other_row]<=start);
if (lastReducibleIndices[other_row]==start)
{
number_type* other_row_array=rows[other_row];
number coef=npNegM((number)(long) other_row_array[start],currRing->cf);
assume(!(npIsZero(coef,currRing->cf)));
int i;
assume(start>startIndices[other_row]);
for(i=start;i<=lastIndex;i++)
{
if (row_array[i]!=zero)
{
other_row_array[i]=F4mat_to_number_type(npAddM(npMult(coef,(number)(long)row_array[i],currRing->cf),(number)(long)other_row_array[i],currRing->cf));
}
}
updateLastReducibleIndex(other_row,r);
}
}
}
else
{
for(other_row=r-1;other_row>=0;other_row--)
{
assume(lastReducibleIndices[other_row]<=start);
if (lastReducibleIndices[other_row]==start)
{
number_type* other_row_array=rows[other_row];
number coef=npNegM((number)(long) other_row_array[start],currRing->cf);
assume(!(npIsZero(coef,currRing->cf)));
int i;
assume(start>startIndices[other_row]);
for(i=start;i<=lastIndex;i++)
{
if (row_array[i]!=zero)
{
other_row_array[i]=F4mat_to_number_type(npAddM(nvMult(coef,(number)(long)row_array[i],currRing->cf),(number)(long)other_row_array[i],currRing->cf));
}
}
updateLastReducibleIndex(other_row,r);
}
}
}
}
ModPMatrixBackSubstProxyOnArray::multiplyRow
void multiplyRow(int row, number_type coef)
Definition tgb_internal.h:1692
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
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
modP_lastIndexRow
int modP_lastIndexRow(number_type *row, int ncols)
Definition tgb_internal.h:1482

## multiplyRow()

template<class number_type>

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

inline

Definition at line 1692 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));
}
}
}

## updateLastReducibleIndex()

template<class number_type>

void ModPMatrixBackSubstProxyOnArray< number_type >::updateLastReducibleIndex | ( | int | r,
|  | int | upper_bound )

inline

Definition at line 1742 of file tgb_internal.h.

{
number_type* row_array=rows[r];
if (upper_bound>nonZeroUntil) upper_bound=nonZeroUntil+1;
int i;
const number_type zero=0;//npInit(0);
for(i=upper_bound-1;i>r;i--)
{
int start=startIndices[i];
assume(start<ncols);
if (!(row_array[start]==zero))
{
lastReducibleIndices[r]=start;
return;
}
}
lastReducibleIndices[r]=-1;
}

## Field Documentation

## lastReducibleIndices

template<class number_type>

int* ModPMatrixBackSubstProxyOnArray< number_type >::lastReducibleIndices

private

Definition at line 1687 of file tgb_internal.h.

## ncols

template<class number_type>

int ModPMatrixBackSubstProxyOnArray< number_type >::ncols

private

Definition at line 1688 of file tgb_internal.h.

## nonZeroUntil

template<class number_type>

int ModPMatrixBackSubstProxyOnArray< number_type >::nonZeroUntil

private

Definition at line 1690 of file tgb_internal.h.

## nrows

template<class number_type>

int ModPMatrixBackSubstProxyOnArray< number_type >::nrows

private

Definition at line 1689 of file tgb_internal.h.

## rows

template<class number_type>

number_type** ModPMatrixBackSubstProxyOnArray< number_type >::rows

private

Definition at line 1686 of file tgb_internal.h.

## startIndices

template<class number_type>

int* ModPMatrixBackSubstProxyOnArray< number_type >::startIndices

private

Definition at line 1685 of file tgb_internal.h.

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

- kernel/GBEngine/tgb_internal.h