Public Member Functions | Data Fields | Protected Attributes | Friends
ModPMatrixProxyOnArray< number_type > Class Template Reference

#include <tgb_internal.h>

Public Member Functions

 ModPMatrixProxyOnArray (number_type *array, int nnrows, int nncols)
 
 ~ModPMatrixProxyOnArray ()
 
void permRows (int i, int j)
 
void multiplyRow (int row, number_type coef)
 
void reduceOtherRowsForward (int r)
 
void updateStartIndex (int row, int lower_bound)
 
int getStartIndex (int row)
 
BOOLEAN findPivot (int &r, int &c)
 

Data Fields

int ncols
 
int nrows
 

Protected Attributes

number_type ** rows
 
int * startIndices
 

Friends

class ModPMatrixBackSubstProxyOnArray< number_type >
 

Detailed Description

template<class number_type>
class ModPMatrixProxyOnArray< number_type >

Definition at line 1508 of file tgb_internal.h.

Constructor & Destructor Documentation

◆ ModPMatrixProxyOnArray()

template<class number_type>
ModPMatrixProxyOnArray< number_type >::ModPMatrixProxyOnArray ( number_type *  array,
int  nnrows,
int  nncols 
)
inline

Definition at line 1514 of file tgb_internal.h.

1515  {
1516  this->ncols=nncols;
1517  this->nrows=nnrows;
1518  rows=(number_type**) omalloc(nnrows*sizeof(number_type*));
1519  startIndices=(int*)omalloc(nnrows*sizeof(int));
1520  int i;
1521  for(i=0;i<nnrows;i++)
1522  {
1523  rows[i]=array+(i*nncols);
1524  updateStartIndex(i,-1);
1525  }
1526  }
void updateStartIndex(int row, int lower_bound)
int i
Definition: cfEzgcd.cc:125
#define omalloc(size)
Definition: omAllocDecl.h:228

◆ ~ModPMatrixProxyOnArray()

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

Definition at line 1527 of file tgb_internal.h.

1528  {
1529  omfree(rows);
1531  }
#define omfree(addr)
Definition: omAllocDecl.h:237

Member Function Documentation

◆ findPivot()

template<class number_type>
BOOLEAN ModPMatrixProxyOnArray< number_type >::findPivot ( int &  r,
int &  c 
)
inline

Definition at line 1619 of file tgb_internal.h.

1620  {
1621  //row>=r, col>=c
1622 
1623  while(c<ncols)
1624  {
1625  int i;
1626  for(i=r;i<nrows;i++)
1627  {
1628  assume(startIndices[i]>=c);
1629  if (startIndices[i]==c)
1630  {
1631  //r=i;
1632  if (r!=i)
1633  permRows(r,i);
1634  return TRUE;
1635  }
1636  }
1637  c++;
1638  }
1639  return FALSE;
1640  }
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
#define assume(x)
Definition: mod2.h:390
void permRows(int i, int j)
int i
Definition: cfEzgcd.cc:125

◆ getStartIndex()

template<class number_type>
int ModPMatrixProxyOnArray< number_type >::getStartIndex ( int  row)
inline

Definition at line 1615 of file tgb_internal.h.

1616  {
1617  return startIndices[row];
1618  }

◆ multiplyRow()

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

Definition at line 1542 of file tgb_internal.h.

1543  {
1544  int i;
1545  number_type* row_array=rows[row];
1546  for(i=startIndices[row];i<ncols;i++)
1547  {
1548  row_array[i]=F4mat_to_number_type(npMult((number)(long) row_array[i],(number)(long) coef,currRing->cf));
1549  }
1550  }
int i
Definition: cfEzgcd.cc:125
#define npMult
Definition: tgb_internal.h:75
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
#define F4mat_to_number_type(a)
Definition: tgb_internal.h:424

◆ permRows()

template<class number_type>
void ModPMatrixProxyOnArray< number_type >::permRows ( int  i,
int  j 
)
inline

Definition at line 1533 of file tgb_internal.h.

1534  {
1535  number_type* h=rows[i];
1536  rows[i]=rows[j];
1537  rows[j]=h;
1538  int hs=startIndices[i];
1540  startIndices[j]=hs;
1541  }
int j
Definition: facHensel.cc:105
int i
Definition: cfEzgcd.cc:125
static Poly * h
Definition: janet.cc:972

◆ reduceOtherRowsForward()

template<class number_type>
void ModPMatrixProxyOnArray< number_type >::reduceOtherRowsForward ( int  r)
inline

Definition at line 1551 of file tgb_internal.h.

1552  {
1553  //assume rows "under r" have bigger or equal start index
1554  number_type* row_array=rows[r];
1555  number_type zero=F4mat_to_number_type((number)0 /*npInit(0, currRing)*/);
1556  int start=startIndices[r];
1557  number_type coef=row_array[start];
1558  assume(start<ncols);
1559  int other_row;
1560  assume(!(npIsZero((number)(long) row_array[start],currRing->cf)));
1561  if (!(npIsOne((number)(long) coef,currRing->cf)))
1562  multiplyRow(r,F4mat_to_number_type(npInvers((number)(long) coef,currRing->cf)));
1563  assume(npIsOne((number)(long) row_array[start],currRing->cf));
1564  int lastIndex=modP_lastIndexRow(row_array, ncols);
1565  number minus_one=npInit(-1, currRing->cf);
1566  for (other_row=r+1;other_row<nrows;other_row++)
1567  {
1568  assume(startIndices[other_row]>=start);
1569  if (startIndices[other_row]==start)
1570  {
1571  int i;
1572  number_type* other_row_array=rows[other_row];
1573  number coef2=npNeg((number)(long) other_row_array[start],currRing->cf);
1574  if (coef2==minus_one)
1575  {
1576  for(i=start;i<=lastIndex;i++)
1577  {
1578  if (row_array[i]!=zero)
1579  { STATISTIC(n_Sub);
1580  other_row_array[i]=F4mat_to_number_type(npSubM((number)(long) other_row_array[i], (number)(long) row_array[i],currRing->cf));
1581  }
1582 
1583  }
1584  }
1585  else
1586  {
1587  //assume(FALSE);
1588  for(i=start;i<=lastIndex;i++)
1589  {
1590  if (row_array[i]!=zero)
1591  { STATISTIC(n_Add);
1592  other_row_array[i]=F4mat_to_number_type(npAddM(npMult(coef2,(number)(long) row_array[i],currRing->cf),(number)(long) other_row_array[i],currRing->cf));
1593  }
1594 
1595  }
1596  }
1597  updateStartIndex(other_row,start);
1598  assume(npIsZero((number)(long) other_row_array[start],currRing->cf));
1599  }
1600  }
1601  }
static FORCE_INLINE number n_Sub(number a, number b, const coeffs r)
return the difference of &#39;a&#39; and &#39;b&#39;, i.e., a-b
Definition: coeffs.h:670
#define STATISTIC(f)
Definition: numstats.h:16
void updateStartIndex(int row, int lower_bound)
int modP_lastIndexRow(number_type *row, int ncols)
static number npSubM(number a, number b, const coeffs r)
Definition: modulop.h:126
#define npInvers
Definition: tgb_internal.h:74
#define npIsZero
Definition: tgb_internal.h:77
#define assume(x)
Definition: mod2.h:390
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:657
static number npAddM(number a, number b, const coeffs r)
Definition: modulop.h:116
int i
Definition: cfEzgcd.cc:125
#define npMult
Definition: tgb_internal.h:75
void multiplyRow(int row, number_type coef)
#define npInit
Definition: tgb_internal.h:72
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
#define F4mat_to_number_type(a)
Definition: tgb_internal.h:424
#define npNeg
Definition: tgb_internal.h:73
#define npIsOne
Definition: tgb_internal.h:76

◆ updateStartIndex()

template<class number_type>
void ModPMatrixProxyOnArray< number_type >::updateStartIndex ( int  row,
int  lower_bound 
)
inline

Definition at line 1602 of file tgb_internal.h.

1603  {
1604  number_type* row_array=rows[row];
1605  assume((lower_bound<0)||(npIsZero((number)(long) row_array[lower_bound],currRing->cf)));
1606  int i;
1607  //number_type zero=npInit(0);
1608  for(i=lower_bound+1;i<ncols;i++)
1609  {
1610  if (!(row_array[i]==0))
1611  break;
1612  }
1613  startIndices[row]=i;
1614  }
#define npIsZero
Definition: tgb_internal.h:77
#define assume(x)
Definition: mod2.h:390
int i
Definition: cfEzgcd.cc:125
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13

Friends And Related Function Documentation

◆ ModPMatrixBackSubstProxyOnArray< number_type >

template<class number_type>
friend class ModPMatrixBackSubstProxyOnArray< number_type >
friend

Definition at line 1511 of file tgb_internal.h.

Field Documentation

◆ ncols

template<class number_type>
int ModPMatrixProxyOnArray< number_type >::ncols

Definition at line 1513 of file tgb_internal.h.

◆ nrows

template<class number_type>
int ModPMatrixProxyOnArray< number_type >::nrows

Definition at line 1513 of file tgb_internal.h.

◆ rows

template<class number_type>
number_type** ModPMatrixProxyOnArray< number_type >::rows
protected

Definition at line 1642 of file tgb_internal.h.

◆ startIndices

template<class number_type>
int* ModPMatrixProxyOnArray< number_type >::startIndices
protected

Definition at line 1643 of file tgb_internal.h.


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