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 1500 of file tgb_internal.h.

Constructor & Destructor Documentation

template<class number_type>
ModPMatrixBackSubstProxyOnArray< number_type >::ModPMatrixBackSubstProxyOnArray ( ModPMatrixProxyOnArray< number_type > &  p)
inline

Definition at line 1656 of file tgb_internal.h.

1657  {
1658 // (number_type* array, int nrows, int ncols, int* startIndices, number_type** rows){
1659  //we borrow some parameters ;-)
1660  //we assume, that nobody changes the order of the rows
1661  this->startIndices=p.startIndices;
1662  this->rows=p.rows;
1663  this->ncols=p.ncols;
1664  this->nrows=p.nrows;
1665  lastReducibleIndices=(int*) omalloc(nrows*sizeof(int));
1666  nonZeroUntil=0;
1667  while(nonZeroUntil<nrows)
1668  {
1670  {
1671  nonZeroUntil++;
1672  }
1673  else break;
1674  }
1675  if (TEST_OPT_PROT)
1676  Print("rank:%i\n",nonZeroUntil);
1677  nonZeroUntil--;
1678  int i;
1679  for(i=0;i<=nonZeroUntil;i++)
1680  {
1682  assume(!(npIsZero((number)(long) rows[i][startIndices[i]],currRing->cf)));
1683  assume(startIndices[i]>=i);
1685  }
1686  }
#define Print
Definition: emacs.cc:83
#define TEST_OPT_PROT
Definition: options.h:98
void updateLastReducibleIndex(int r, int upper_bound)
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define npIsZero
Definition: tgb_internal.h:78
#define assume(x)
Definition: mod2.h:405
int i
Definition: cfEzgcd.cc:123
#define omalloc(size)
Definition: omAllocDecl.h:228
template<class number_type>
ModPMatrixBackSubstProxyOnArray< number_type >::~ModPMatrixBackSubstProxyOnArray ( )
inline

Definition at line 1744 of file tgb_internal.h.

1745  {
1747  }
#define omfree(addr)
Definition: omAllocDecl.h:237

Member Function Documentation

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

Definition at line 1705 of file tgb_internal.h.

1706  {
1707  int start=startIndices[r];
1708  assume(start<ncols);
1709  number_type zero=0;//npInit(0);
1710  number_type* row_array=rows[r];
1711  assume((!(npIsZero((number)(long) row_array[start],currRing->cf))));
1712  assume(start<ncols);
1713  int other_row;
1714  if (!(npIsOne((number)(long) row_array[r],currRing->cf)))
1715  {
1716  //it should be one, but this safety is not expensive
1717  multiplyRow(r, F4mat_to_number_type(npInvers((number)(long) row_array[start],currRing->cf)));
1718  }
1719  int lastIndex=modP_lastIndexRow(row_array, ncols);
1720  assume(lastIndex<ncols);
1721  assume(lastIndex>=0);
1722  for(other_row=r-1;other_row>=0;other_row--)
1723  {
1724  assume(lastReducibleIndices[other_row]<=start);
1725  if (lastReducibleIndices[other_row]==start)
1726  {
1727  number_type* other_row_array=rows[other_row];
1728  number coef=npNeg((number)(long) other_row_array[start],currRing->cf);
1729  assume(!(npIsZero(coef,currRing->cf)));
1730  int i;
1731  assume(start>startIndices[other_row]);
1732  for(i=start;i<=lastIndex;i++)
1733  {
1734  if (row_array[i]!=zero)
1735  {
1736  STATISTIC(n_Add);
1737  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));
1738  }
1739  }
1740  updateLastReducibleIndex(other_row,r);
1741  }
1742  }
1743  }
#define STATISTIC(f)
Definition: numstats.h:16
void updateLastReducibleIndex(int r, int upper_bound)
int modP_lastIndexRow(number_type *row, int ncols)
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
const ring r
Definition: syzextra.cc:208
#define npInvers
Definition: tgb_internal.h:75
#define npIsZero
Definition: tgb_internal.h:78
#define assume(x)
Definition: mod2.h:405
static FORCE_INLINE number n_Add(number a, number b, const coeffs r)
return the sum of &#39;a&#39; and &#39;b&#39;, i.e., a+b
Definition: coeffs.h:655
static number npAddM(number a, number b, const coeffs r)
Definition: modulop.h:77
int i
Definition: cfEzgcd.cc:123
#define npMult
Definition: tgb_internal.h:76
void multiplyRow(int row, number_type coef)
#define F4mat_to_number_type(a)
Definition: tgb_internal.h:425
#define npNeg
Definition: tgb_internal.h:74
#define npIsOne
Definition: tgb_internal.h:77
template<class number_type>
void ModPMatrixBackSubstProxyOnArray< number_type >::backwardSubstitute ( )
inline

Definition at line 1748 of file tgb_internal.h.

1749  {
1750  int i;
1751  for(i=nonZeroUntil;i>0;i--)
1752  {
1753  backwardSubstitute(i);
1754  }
1755  }
int i
Definition: cfEzgcd.cc:123
template<class number_type>
void ModPMatrixBackSubstProxyOnArray< number_type >::multiplyRow ( int  row,
number_type  coef 
)
inline

Definition at line 1647 of file tgb_internal.h.

1648  {
1649  int i;
1650  number_type* row_array=rows[row];
1651  for(i=startIndices[row];i<ncols;i++)
1652  {
1653  row_array[i]=F4mat_to_number_type(npMult((number)(long) row_array[i],(number)(long) coef,currRing->cf));
1654  }
1655  }
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int i
Definition: cfEzgcd.cc:123
#define npMult
Definition: tgb_internal.h:76
#define F4mat_to_number_type(a)
Definition: tgb_internal.h:425
template<class number_type>
void ModPMatrixBackSubstProxyOnArray< number_type >::updateLastReducibleIndex ( int  r,
int  upper_bound 
)
inline

Definition at line 1687 of file tgb_internal.h.

1688  {
1689  number_type* row_array=rows[r];
1690  if (upper_bound>nonZeroUntil) upper_bound=nonZeroUntil+1;
1691  int i;
1692  const number_type zero=0;//npInit(0);
1693  for(i=upper_bound-1;i>r;i--)
1694  {
1695  int start=startIndices[i];
1696  assume(start<ncols);
1697  if (!(row_array[start]==zero))
1698  {
1699  lastReducibleIndices[r]=start;
1700  return;
1701  }
1702  }
1703  lastReducibleIndices[r]=-1;
1704  }
const ring r
Definition: syzextra.cc:208
#define assume(x)
Definition: mod2.h:405
int i
Definition: cfEzgcd.cc:123

Field Documentation

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

Definition at line 1642 of file tgb_internal.h.

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

Definition at line 1643 of file tgb_internal.h.

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

Definition at line 1645 of file tgb_internal.h.

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

Definition at line 1644 of file tgb_internal.h.

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

Definition at line 1641 of file tgb_internal.h.

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

Definition at line 1640 of file tgb_internal.h.


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