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

1508  {
1509  this->ncols=nncols;
1510  this->nrows=nnrows;
1511  rows=(number_type**) omalloc(nnrows*sizeof(number_type*));
1512  startIndices=(int*)omalloc(nnrows*sizeof(int));
1513  int i;
1514  for(i=0;i<nnrows;i++)
1515  {
1516  rows[i]=array+(i*nncols);
1517  updateStartIndex(i,-1);
1518  }
1519  }
void updateStartIndex(int row, int lower_bound)
int i
Definition: cfEzgcd.cc:123
#define omalloc(size)
Definition: omAllocDecl.h:228

§ ~ModPMatrixProxyOnArray()

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

Definition at line 1520 of file tgb_internal.h.

1521  {
1522  omfree(rows);
1524  }
#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 1612 of file tgb_internal.h.

1613  {
1614  //row>=r, col>=c
1615 
1616  while(c<ncols)
1617  {
1618  int i;
1619  for(i=r;i<nrows;i++)
1620  {
1621  assume(startIndices[i]>=c);
1622  if (startIndices[i]==c)
1623  {
1624  //r=i;
1625  if (r!=i)
1626  permRows(r,i);
1627  return TRUE;
1628  }
1629  }
1630  c++;
1631  }
1632  return FALSE;
1633  }
#define FALSE
Definition: auxiliary.h:95
#define TRUE
Definition: auxiliary.h:99
const ring r
Definition: syzextra.cc:208
#define assume(x)
Definition: mod2.h:403
void permRows(int i, int j)
int i
Definition: cfEzgcd.cc:123

§ getStartIndex()

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

Definition at line 1608 of file tgb_internal.h.

1609  {
1610  return startIndices[row];
1611  }

§ multiplyRow()

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

Definition at line 1535 of file tgb_internal.h.

1536  {
1537  int i;
1538  number_type* row_array=rows[row];
1539  for(i=startIndices[row];i<ncols;i++)
1540  {
1541  row_array[i]=F4mat_to_number_type(npMult((number)(long) row_array[i],(number)(long) coef,currRing->cf));
1542  }
1543  }
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int i
Definition: cfEzgcd.cc:123
#define npMult
Definition: tgb_internal.h:76
#define F4mat_to_number_type(a)
Definition: tgb_internal.h:425

§ permRows()

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

Definition at line 1526 of file tgb_internal.h.

1527  {
1528  number_type* h=rows[i];
1529  rows[i]=rows[j];
1530  rows[j]=h;
1531  int hs=startIndices[i];
1533  startIndices[j]=hs;
1534  }
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
static Poly * h
Definition: janet.cc:978

§ reduceOtherRowsForward()

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

Definition at line 1544 of file tgb_internal.h.

1545  {
1546  //assume rows "under r" have bigger or equal start index
1547  number_type* row_array=rows[r];
1548  number_type zero=F4mat_to_number_type((number)0 /*npInit(0, currRing)*/);
1549  int start=startIndices[r];
1550  number_type coef=row_array[start];
1551  assume(start<ncols);
1552  int other_row;
1553  assume(!(npIsZero((number)(long) row_array[start],currRing->cf)));
1554  if (!(npIsOne((number)(long) coef,currRing->cf)))
1555  multiplyRow(r,F4mat_to_number_type(npInvers((number)(long) coef,currRing->cf)));
1556  assume(npIsOne((number)(long) row_array[start],currRing->cf));
1557  int lastIndex=modP_lastIndexRow(row_array, ncols);
1558  number minus_one=npInit(-1, currRing->cf);
1559  for (other_row=r+1;other_row<nrows;other_row++)
1560  {
1561  assume(startIndices[other_row]>=start);
1562  if (startIndices[other_row]==start)
1563  {
1564  int i;
1565  number_type* other_row_array=rows[other_row];
1566  number coef2=npNeg((number)(long) other_row_array[start],currRing->cf);
1567  if (coef2==minus_one)
1568  {
1569  for(i=start;i<=lastIndex;i++)
1570  {
1571  if (row_array[i]!=zero)
1572  { STATISTIC(n_Sub);
1573  other_row_array[i]=F4mat_to_number_type(npSubM((number)(long) other_row_array[i], (number)(long) row_array[i],currRing->cf));
1574  }
1575 
1576  }
1577  }
1578  else
1579  {
1580  //assume(FALSE);
1581  for(i=start;i<=lastIndex;i++)
1582  {
1583  if (row_array[i]!=zero)
1584  { STATISTIC(n_Add);
1585  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));
1586  }
1587 
1588  }
1589  }
1590  updateStartIndex(other_row,start);
1591  assume(npIsZero((number)(long) other_row_array[start],currRing->cf));
1592  }
1593  }
1594  }
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:673
#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:82
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
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:403
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:660
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 npInit
Definition: tgb_internal.h:73
#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

§ updateStartIndex()

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

Definition at line 1595 of file tgb_internal.h.

1596  {
1597  number_type* row_array=rows[row];
1598  assume((lower_bound<0)||(npIsZero((number)(long) row_array[lower_bound],currRing->cf)));
1599  int i;
1600  //number_type zero=npInit(0);
1601  for(i=lower_bound+1;i<ncols;i++)
1602  {
1603  if (!(row_array[i]==0))
1604  break;
1605  }
1606  startIndices[row]=i;
1607  }
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define npIsZero
Definition: tgb_internal.h:78
#define assume(x)
Definition: mod2.h:403
int i
Definition: cfEzgcd.cc:123

Friends And Related Function Documentation

§ ModPMatrixBackSubstProxyOnArray< number_type >

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

Definition at line 1504 of file tgb_internal.h.

Field Documentation

§ ncols

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

Definition at line 1506 of file tgb_internal.h.

§ nrows

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

Definition at line 1506 of file tgb_internal.h.

§ rows

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

Definition at line 1635 of file tgb_internal.h.

§ startIndices

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

Definition at line 1636 of file tgb_internal.h.


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