My Project  UNKNOWN_GIT_VERSION
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 1659 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 1668 of file tgb_internal.h.

1678  {
1679 // (number_type* array, int nrows, int ncols, int* startIndices, number_type** rows){
1680  //we borrow some parameters ;-)
1681  //we assume, that nobody changes the order of the rows
1682  this->startIndices=p.startIndices;
1683  this->rows=p.rows;
1684  this->ncols=p.ncols;
1685  this->nrows=p.nrows;
1686  lastReducibleIndices=(int*) omalloc(nrows*sizeof(int));
1687  nonZeroUntil=0;
1688  while(nonZeroUntil<nrows)
1689  {
1691  {
1692  nonZeroUntil++;
1693  }
1694  else break;
1695  }
1696  if (TEST_OPT_PROT)
1697  Print("rank:%i\n",nonZeroUntil);
1698  nonZeroUntil--;
1699  int i;
1700  for(i=0;i<=nonZeroUntil;i++)
1701  {
1703  assume(!(npIsZero((number)(long) rows[i][startIndices[i]],currRing->cf)));
1704  assume(startIndices[i]>=i);
1706  }
1707  }

◆ ~ModPMatrixBackSubstProxyOnArray()

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

Definition at line 1726 of file tgb_internal.h.

1766  {
1768  }

Member Function Documentation

◆ backwardSubstitute() [1/2]

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

Definition at line 1769 of file tgb_internal.h.

1770  {
1771  int i;
1772  for(i=nonZeroUntil;i>0;i--)
1773  {
1775  }
1776  }

◆ backwardSubstitute() [2/2]

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

Definition at line 1726 of file tgb_internal.h.

1727  {
1728  int start=startIndices[r];
1729  assume(start<ncols);
1730  number_type zero=0;//npInit(0);
1731  number_type* row_array=rows[r];
1732  assume((!(npIsZero((number)(long) row_array[start],currRing->cf))));
1733  assume(start<ncols);
1734  int other_row;
1735  if (!(npIsOne((number)(long) row_array[r],currRing->cf)))
1736  {
1737  //it should be one, but this safety is not expensive
1738  multiplyRow(r, F4mat_to_number_type(npInvers((number)(long) row_array[start],currRing->cf)));
1739  }
1740  int lastIndex=modP_lastIndexRow(row_array, ncols);
1741  assume(lastIndex<ncols);
1742  assume(lastIndex>=0);
1743  for(other_row=r-1;other_row>=0;other_row--)
1744  {
1745  assume(lastReducibleIndices[other_row]<=start);
1746  if (lastReducibleIndices[other_row]==start)
1747  {
1748  number_type* other_row_array=rows[other_row];
1749  number coef=npNeg((number)(long) other_row_array[start],currRing->cf);
1750  assume(!(npIsZero(coef,currRing->cf)));
1751  int i;
1752  assume(start>startIndices[other_row]);
1753  for(i=start;i<=lastIndex;i++)
1754  {
1755  if (row_array[i]!=zero)
1756  {
1757  STATISTIC(n_Add);
1758  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));
1759  }
1760  }
1761  updateLastReducibleIndex(other_row,r);
1762  }
1763  }
1764  }

◆ multiplyRow()

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

Definition at line 1668 of file tgb_internal.h.

1669  {
1670  int i;
1671  number_type* row_array=rows[row];
1672  for(i=startIndices[row];i<ncols;i++)
1673  {
1674  row_array[i]=F4mat_to_number_type(npMult((number)(long) row_array[i],(number)(long) coef,currRing->cf));
1675  }
1676  }

◆ updateLastReducibleIndex()

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

Definition at line 1708 of file tgb_internal.h.

1709  {
1710  number_type* row_array=rows[r];
1711  if (upper_bound>nonZeroUntil) upper_bound=nonZeroUntil+1;
1712  int i;
1713  const number_type zero=0;//npInit(0);
1714  for(i=upper_bound-1;i>r;i--)
1715  {
1716  int start=startIndices[i];
1717  assume(start<ncols);
1718  if (!(row_array[start]==zero))
1719  {
1720  lastReducibleIndices[r]=start;
1721  return;
1722  }
1723  }
1724  lastReducibleIndices[r]=-1;
1725  }

Field Documentation

◆ lastReducibleIndices

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

Definition at line 1663 of file tgb_internal.h.

◆ ncols

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

Definition at line 1664 of file tgb_internal.h.

◆ nonZeroUntil

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

Definition at line 1666 of file tgb_internal.h.

◆ nrows

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

Definition at line 1665 of file tgb_internal.h.

◆ rows

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

Definition at line 1662 of file tgb_internal.h.

◆ startIndices

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

Definition at line 1661 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:428
ModPMatrixBackSubstProxyOnArray::nrows
int nrows
Definition: tgb_internal.h:1665
ModPMatrixProxyOnArray::startIndices
int * startIndices
Definition: tgb_internal.h:1657
modP_lastIndexRow
int modP_lastIndexRow(number_type *row, int ncols)
Definition: tgb_internal.h:1503
ModPMatrixProxyOnArray::nrows
int nrows
Definition: tgb_internal.h:1527
npInvers
#define npInvers
Definition: tgb_internal.h:74
ModPMatrixBackSubstProxyOnArray::multiplyRow
void multiplyRow(int row, number_type coef)
Definition: tgb_internal.h:1668
ModPMatrixBackSubstProxyOnArray::nonZeroUntil
int nonZeroUntil
Definition: tgb_internal.h:1666
ModPMatrixBackSubstProxyOnArray::lastReducibleIndices
int * lastReducibleIndices
Definition: tgb_internal.h:1663
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:656
i
int i
Definition: cfEzgcd.cc:125
npAddM
static number npAddM(number a, number b, const coeffs r)
Definition: modulop.h:125
ModPMatrixProxyOnArray::ncols
int ncols
Definition: tgb_internal.h:1527
ModPMatrixBackSubstProxyOnArray::backwardSubstitute
void backwardSubstitute()
Definition: tgb_internal.h:1769
npMult
#define npMult
Definition: tgb_internal.h:78
ModPMatrixBackSubstProxyOnArray::startIndices
int * startIndices
Definition: tgb_internal.h:1661
STATISTIC
#define STATISTIC(f)
Definition: numstats.h:16
npIsZero
#define npIsZero
Definition: tgb_internal.h:76
npNeg
#define npNeg
Definition: tgb_internal.h:73
ModPMatrixProxyOnArray::rows
number_type ** rows
Definition: tgb_internal.h:1656
npIsOne
#define npIsOne
Definition: tgb_internal.h:75
ModPMatrixBackSubstProxyOnArray::rows
number_type ** rows
Definition: tgb_internal.h:1662
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:1708
assume
#define assume(x)
Definition: mod2.h:390
ModPMatrixBackSubstProxyOnArray::ncols
int ncols
Definition: tgb_internal.h:1664
omfree
#define omfree(addr)
Definition: omAllocDecl.h:237