My Project
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 1688 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 1697 of file tgb_internal.h.

1717  {
1718 // (number_type* array, int nrows, int ncols, int* startIndices, number_type** rows){
1719  //we borrow some parameters ;-)
1720  //we assume, that nobody changes the order of the rows
1721  this->startIndices=p.startIndices;
1722  this->rows=p.rows;
1723  this->ncols=p.ncols;
1724  this->nrows=p.nrows;
1725  lastReducibleIndices=(int*) omalloc(nrows*sizeof(int));
1726  nonZeroUntil=0;
1727  while(nonZeroUntil<nrows)
1728  {
1730  {
1731  nonZeroUntil++;
1732  }
1733  else break;
1734  }
1735  if (TEST_OPT_PROT)
1736  Print("rank:%i\n",nonZeroUntil);
1737  nonZeroUntil--;
1738  int i;
1739  for(i=0;i<=nonZeroUntil;i++)
1740  {
1742  assume(!(npIsZero((number)(long) rows[i][startIndices[i]],currRing->cf)));
1743  assume(startIndices[i]>=i);
1745  }
1746  }
int i
Definition: cfEzgcd.cc:132
void updateLastReducibleIndex(int r, int upper_bound)
#define Print
Definition: emacs.cc:80
#define assume(x)
Definition: mod2.h:387
static BOOLEAN npIsZero(number a, const coeffs r)
Definition: modulop_inl.h:38
#define omalloc(size)
Definition: omAllocDecl.h:228
#define TEST_OPT_PROT
Definition: options.h:102
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13

◆ ~ModPMatrixBackSubstProxyOnArray()

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

Definition at line 1765 of file tgb_internal.h.

1830  {
1832  }
#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 1833 of file tgb_internal.h.

1834  {
1835  int i;
1836  for(i=nonZeroUntil;i>0;i--)
1837  {
1839  }
1840  }

◆ backwardSubstitute() [2/2]

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

Definition at line 1765 of file tgb_internal.h.

1766  {
1767  int start=startIndices[r];
1768  assume(start<ncols);
1769  number_type zero=0;//npInit(0);
1770  number_type* row_array=rows[r];
1771  assume((!(npIsZero((number)(long) row_array[start],currRing->cf))));
1772  assume(start<ncols);
1773  int other_row;
1774  if (!(npIsOne((number)(long) row_array[r],currRing->cf)))
1775  {
1776  //it should be one, but this safety is not expensive
1777  multiplyRow(r, F4mat_to_number_type(npInversM((number)(long) row_array[start],currRing->cf)));
1778  }
1779  int lastIndex=modP_lastIndexRow(row_array, ncols);
1780  assume(lastIndex<ncols);
1781  assume(lastIndex>=0);
1782  if(currRing->cf->ch<=NV_MAX_PRIME)
1783  {
1784  for(other_row=r-1;other_row>=0;other_row--)
1785  {
1786  assume(lastReducibleIndices[other_row]<=start);
1787  if (lastReducibleIndices[other_row]==start)
1788  {
1789  number_type* other_row_array=rows[other_row];
1790  number coef=npNegM((number)(long) other_row_array[start],currRing->cf);
1791  assume(!(npIsZero(coef,currRing->cf)));
1792  int i;
1793  assume(start>startIndices[other_row]);
1794  for(i=start;i<=lastIndex;i++)
1795  {
1796  if (row_array[i]!=zero)
1797  {
1798  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));
1799  }
1800  }
1801  updateLastReducibleIndex(other_row,r);
1802  }
1803  }
1804  }
1805  else
1806  {
1807  for(other_row=r-1;other_row>=0;other_row--)
1808  {
1809  assume(lastReducibleIndices[other_row]<=start);
1810  if (lastReducibleIndices[other_row]==start)
1811  {
1812  number_type* other_row_array=rows[other_row];
1813  number coef=npNegM((number)(long) other_row_array[start],currRing->cf);
1814  assume(!(npIsZero(coef,currRing->cf)));
1815  int i;
1816  assume(start>startIndices[other_row]);
1817  for(i=start;i<=lastIndex;i++)
1818  {
1819  if (row_array[i]!=zero)
1820  {
1821  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));
1822  }
1823  }
1824  updateLastReducibleIndex(other_row,r);
1825  }
1826  }
1827  }
1828  }
void multiplyRow(int row, number_type coef)
static BOOLEAN npIsOne(number a, const coeffs)
Definition: modulop.h:171
static number npAddM(number a, number b, const coeffs r)
Definition: modulop.h:116
static number npNegM(number a, const coeffs r)
Definition: modulop.h:166
#define NV_MAX_PRIME
Definition: modulop.h:29
static number npInversM(number c, const coeffs r)
Definition: modulop.h:215
static number nvMult(number a, number b, const coeffs r)
Definition: modulop_inl.h:50
static number npMult(number a, number b, const coeffs r)
Definition: modulop_inl.h:12
#define F4mat_to_number_type(a)
Definition: tgb_internal.h:414
int modP_lastIndexRow(number_type *row, int ncols)

◆ multiplyRow()

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

Definition at line 1697 of file tgb_internal.h.

1698  {
1699  int i;
1700  number_type* row_array=rows[row];
1701  if (currRing->cf->ch<=NV_MAX_PRIME)
1702  {
1703  for(i=startIndices[row];i<ncols;i++)
1704  {
1705  row_array[i]=F4mat_to_number_type(npMult((number)(long) row_array[i],(number)(long) coef,currRing->cf));
1706  }
1707  }
1708  else
1709  {
1710  for(i=startIndices[row];i<ncols;i++)
1711  {
1712  row_array[i]=F4mat_to_number_type(nvMult((number)(long) row_array[i],(number)(long) coef,currRing->cf));
1713  }
1714  }
1715  }

◆ updateLastReducibleIndex()

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

Definition at line 1747 of file tgb_internal.h.

1748  {
1749  number_type* row_array=rows[r];
1750  if (upper_bound>nonZeroUntil) upper_bound=nonZeroUntil+1;
1751  int i;
1752  const number_type zero=0;//npInit(0);
1753  for(i=upper_bound-1;i>r;i--)
1754  {
1755  int start=startIndices[i];
1756  assume(start<ncols);
1757  if (!(row_array[start]==zero))
1758  {
1759  lastReducibleIndices[r]=start;
1760  return;
1761  }
1762  }
1763  lastReducibleIndices[r]=-1;
1764  }

Field Documentation

◆ lastReducibleIndices

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

Definition at line 1692 of file tgb_internal.h.

◆ ncols

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

Definition at line 1693 of file tgb_internal.h.

◆ nonZeroUntil

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

Definition at line 1695 of file tgb_internal.h.

◆ nrows

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

Definition at line 1694 of file tgb_internal.h.

◆ rows

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

Definition at line 1691 of file tgb_internal.h.

◆ startIndices

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

Definition at line 1690 of file tgb_internal.h.


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