My Project  debian-1:4.1.1-p2+ds-4build3
Public Member Functions | Private Attributes
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 1507 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 1654 of file tgb_internal.h.

1664  {
1665 // (number_type* array, int nrows, int ncols, int* startIndices, number_type** rows){
1666  //we borrow some parameters ;-)
1667  //we assume, that nobody changes the order of the rows
1668  this->startIndices=p.startIndices;
1669  this->rows=p.rows;
1670  this->ncols=p.ncols;
1671  this->nrows=p.nrows;
1672  lastReducibleIndices=(int*) omalloc(nrows*sizeof(int));
1673  nonZeroUntil=0;
1674  while(nonZeroUntil<nrows)
1675  {
1677  {
1678  nonZeroUntil++;
1679  }
1680  else break;
1681  }
1682  if (TEST_OPT_PROT)
1683  Print("rank:%i\n",nonZeroUntil);
1684  nonZeroUntil--;
1685  int i;
1686  for(i=0;i<=nonZeroUntil;i++)
1687  {
1689  assume(!(npIsZero((number)(long) rows[i][startIndices[i]],currRing->cf)));
1690  assume(startIndices[i]>=i);
1692  }
1693  }

◆ ~ModPMatrixBackSubstProxyOnArray()

template<class number_type >
ModPMatrixBackSubstProxyOnArray< number_type >::~ModPMatrixBackSubstProxyOnArray ( )
inline

Definition at line 1712 of file tgb_internal.h.

1752  {
1754  }

Member Function Documentation

◆ backwardSubstitute() [1/2]

template<class number_type >
void ModPMatrixBackSubstProxyOnArray< number_type >::backwardSubstitute ( )
inline

Definition at line 1755 of file tgb_internal.h.

1756  {
1757  int i;
1758  for(i=nonZeroUntil;i>0;i--)
1759  {
1761  }
1762  }

◆ backwardSubstitute() [2/2]

template<class number_type >
void ModPMatrixBackSubstProxyOnArray< number_type >::backwardSubstitute ( int  r)
inline

Definition at line 1712 of file tgb_internal.h.

1713  {
1714  int start=startIndices[r];
1715  assume(start<ncols);
1716  number_type zero=0;//npInit(0);
1717  number_type* row_array=rows[r];
1718  assume((!(npIsZero((number)(long) row_array[start],currRing->cf))));
1719  assume(start<ncols);
1720  int other_row;
1721  if (!(npIsOne((number)(long) row_array[r],currRing->cf)))
1722  {
1723  //it should be one, but this safety is not expensive
1724  multiplyRow(r, F4mat_to_number_type(npInvers((number)(long) row_array[start],currRing->cf)));
1725  }
1726  int lastIndex=modP_lastIndexRow(row_array, ncols);
1727  assume(lastIndex<ncols);
1728  assume(lastIndex>=0);
1729  for(other_row=r-1;other_row>=0;other_row--)
1730  {
1731  assume(lastReducibleIndices[other_row]<=start);
1732  if (lastReducibleIndices[other_row]==start)
1733  {
1734  number_type* other_row_array=rows[other_row];
1735  number coef=npNeg((number)(long) other_row_array[start],currRing->cf);
1736  assume(!(npIsZero(coef,currRing->cf)));
1737  int i;
1738  assume(start>startIndices[other_row]);
1739  for(i=start;i<=lastIndex;i++)
1740  {
1741  if (row_array[i]!=zero)
1742  {
1743  STATISTIC(n_Add);
1744  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));
1745  }
1746  }
1747  updateLastReducibleIndex(other_row,r);
1748  }
1749  }
1750  }

◆ multiplyRow()

template<class number_type >
void ModPMatrixBackSubstProxyOnArray< number_type >::multiplyRow ( int  row,
number_type  coef 
)
inline

Definition at line 1654 of file tgb_internal.h.

1655  {
1656  int i;
1657  number_type* row_array=rows[row];
1658  for(i=startIndices[row];i<ncols;i++)
1659  {
1660  row_array[i]=F4mat_to_number_type(npMult((number)(long) row_array[i],(number)(long) coef,currRing->cf));
1661  }
1662  }

◆ updateLastReducibleIndex()

template<class number_type >
void ModPMatrixBackSubstProxyOnArray< number_type >::updateLastReducibleIndex ( int  r,
int  upper_bound 
)
inline

Definition at line 1694 of file tgb_internal.h.

1695  {
1696  number_type* row_array=rows[r];
1697  if (upper_bound>nonZeroUntil) upper_bound=nonZeroUntil+1;
1698  int i;
1699  const number_type zero=0;//npInit(0);
1700  for(i=upper_bound-1;i>r;i--)
1701  {
1702  int start=startIndices[i];
1703  assume(start<ncols);
1704  if (!(row_array[start]==zero))
1705  {
1706  lastReducibleIndices[r]=start;
1707  return;
1708  }
1709  }
1710  lastReducibleIndices[r]=-1;
1711  }

Field Documentation

◆ lastReducibleIndices

template<class number_type >
int* ModPMatrixBackSubstProxyOnArray< number_type >::lastReducibleIndices
private

Definition at line 1649 of file tgb_internal.h.

◆ ncols

template<class number_type >
int ModPMatrixBackSubstProxyOnArray< number_type >::ncols
private

Definition at line 1650 of file tgb_internal.h.

◆ nonZeroUntil

template<class number_type >
int ModPMatrixBackSubstProxyOnArray< number_type >::nonZeroUntil
private

Definition at line 1652 of file tgb_internal.h.

◆ nrows

template<class number_type >
int ModPMatrixBackSubstProxyOnArray< number_type >::nrows
private

Definition at line 1651 of file tgb_internal.h.

◆ rows

template<class number_type >
number_type** ModPMatrixBackSubstProxyOnArray< number_type >::rows
private

Definition at line 1648 of file tgb_internal.h.

◆ startIndices

template<class number_type >
int* ModPMatrixBackSubstProxyOnArray< number_type >::startIndices
private

Definition at line 1647 of file tgb_internal.h.


The documentation for this class was generated from the following file:
TEST_OPT_PROT
#define TEST_OPT_PROT
Definition: options.h:102
F4mat_to_number_type
#define F4mat_to_number_type(a)
Definition: tgb_internal.h:424
ModPMatrixBackSubstProxyOnArray::nrows
int nrows
Definition: tgb_internal.h:1651
ModPMatrixProxyOnArray::startIndices
int * startIndices
Definition: tgb_internal.h:1643
modP_lastIndexRow
int modP_lastIndexRow(number_type *row, int ncols)
Definition: tgb_internal.h:1489
ModPMatrixProxyOnArray::nrows
int nrows
Definition: tgb_internal.h:1513
npInvers
#define npInvers
Definition: tgb_internal.h:74
ModPMatrixBackSubstProxyOnArray::multiplyRow
void multiplyRow(int row, number_type coef)
Definition: tgb_internal.h:1654
ModPMatrixBackSubstProxyOnArray::nonZeroUntil
int nonZeroUntil
Definition: tgb_internal.h:1652
ModPMatrixBackSubstProxyOnArray::lastReducibleIndices
int * lastReducibleIndices
Definition: tgb_internal.h:1649
currRing
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
n_Add
static FORCE_INLINE number n_Add(number a, number b, const coeffs r)
return the sum of 'a' and 'b', i.e., a+b
Definition: coeffs.h:657
i
int i
Definition: cfEzgcd.cc:125
npAddM
static number npAddM(number a, number b, const coeffs r)
Definition: modulop.h:116
ModPMatrixProxyOnArray::ncols
int ncols
Definition: tgb_internal.h:1513
ModPMatrixBackSubstProxyOnArray::backwardSubstitute
void backwardSubstitute()
Definition: tgb_internal.h:1755
npMult
#define npMult
Definition: tgb_internal.h:75
ModPMatrixBackSubstProxyOnArray::startIndices
int * startIndices
Definition: tgb_internal.h:1647
STATISTIC
#define STATISTIC(f)
Definition: numstats.h:16
npIsZero
#define npIsZero
Definition: tgb_internal.h:77
npNeg
#define npNeg
Definition: tgb_internal.h:73
ModPMatrixProxyOnArray::rows
number_type ** rows
Definition: tgb_internal.h:1642
npIsOne
#define npIsOne
Definition: tgb_internal.h:76
ModPMatrixBackSubstProxyOnArray::rows
number_type ** rows
Definition: tgb_internal.h:1648
Print
#define Print
Definition: emacs.cc:80
omalloc
#define omalloc(size)
Definition: omAllocDecl.h:228
ModPMatrixBackSubstProxyOnArray::updateLastReducibleIndex
void updateLastReducibleIndex(int r, int upper_bound)
Definition: tgb_internal.h:1694
assume
#define assume(x)
Definition: mod2.h:390
ModPMatrixBackSubstProxyOnArray::ncols
int ncols
Definition: tgb_internal.h:1650
omfree
#define omfree(addr)
Definition: omAllocDecl.h:237