My Project
Loading...
Searching...
No Matches
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((size_t)nnrows*sizeof(number_type*));
1512 startIndices=(int*)omalloc((size_t)nnrows*sizeof(int));
1513 int i;
1514 for(i=0;i<nnrows;i++)
1515 {
1516 rows[i]=array+((long)i*(long)nncols);
1517 updateStartIndex(i,-1);
1518 }
1519 }
void updateStartIndex(int row, int lower_bound)
#define omalloc(size)

◆ ~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)

Member Function Documentation

◆ findPivot()

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

Definition at line 1657 of file tgb_internal.h.

1658{
1659 //row>=r, col>=c
1660
1661 while(c<ncols)
1662 {
1663 int i;
1664 for(i=r;i<nrows;i++)
1665 {
1667 if (startIndices[i]==c)
1668 {
1669 //r=i;
1670 if (r!=i)
1671 permRows(r,i);
1672 return TRUE;
1673 }
1674 }
1675 c++;
1676 }
1677 return FALSE;
1678}
void permRows(int i, int j)
#define assume(x)
Definition mod2.h:389

◆ getStartIndex()

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

Definition at line 1653 of file tgb_internal.h.

1654{
1655 return startIndices[row];
1656}

◆ 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;
1539 if(currRing->cf->ch<=NV_MAX_PRIME)
1540 {
1541 for(i=startIndices[row];i<ncols;i++)
1542 {
1544 }
1545 }
1546 else
1547 {
1548 for(i=startIndices[row];i<ncols;i++)
1549 {
1551 }
1552 }
1553 }
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)

◆ 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 }

◆ reduceOtherRowsForward()

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

Definition at line 1554 of file tgb_internal.h.

1555 {
1556 //assume rows "under r" have bigger or equal start index
1558 number_type zero=F4mat_to_number_type((number)0 /*npInit(0, currRing)*/);
1559 int start=startIndices[r];
1562 int other_row;
1563 assume(!(npIsZero((number)(long) row_array[start],currRing->cf)));
1564 if (!(npIsOne((number)(long) coef,currRing->cf)))
1569 if(currRing->cf->ch<=NV_MAX_PRIME)
1570 {
1572 {
1575 {
1576 int i;
1579 if (coef2==minus_one)
1580 {
1581 for(i=start;i<=lastIndex;i++)
1582 {
1583 if (row_array[i]!=zero)
1584 {
1586 }
1587 }
1588 }
1589 else
1590 {
1591 for(i=start;i<=lastIndex;i++)
1592 {
1593 if (row_array[i]!=zero)
1594 {
1596 }
1597 }
1598 }
1601 }
1602 }
1603 }
1604 else /* ch>NV_MAX_PRIME*/
1605 {
1607 {
1610 {
1611 int i;
1614 if (coef2==minus_one)
1615 {
1616 for(i=start;i<=lastIndex;i++)
1617 {
1618 if (row_array[i]!=zero)
1619 {
1621 }
1622 }
1623 }
1624 else
1625 {
1626 for(i=start;i<=lastIndex;i++)
1627 {
1628 if (row_array[i]!=zero)
1629 {
1631 }
1632 }
1633 }
1636 }
1637 }
1638 }
1639}
void multiplyRow(int row, number_type coef)
static BOOLEAN npIsOne(number a, const coeffs)
Definition modulop.h:179
static number npAddM(number a, number b, const coeffs r)
Definition modulop.h:124
static number npNegM(number a, const coeffs r)
Definition modulop.h:174
static number npInversM(number c, const coeffs r)
Definition modulop.h:223
static number npSubM(number a, number b, const coeffs r)
Definition modulop.h:134
static number npInit(long i, const coeffs r)
Definition modulop_inl.h:27
static BOOLEAN npIsZero(number a, const coeffs r)
Definition modulop_inl.h:38
int modP_lastIndexRow(number_type *row, int ncols)

◆ updateStartIndex()

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

Definition at line 1640 of file tgb_internal.h.

1641{
1644 int i;
1645 //number_type zero=npInit(0);
1646 for(i=lower_bound+1;i<ncols;i++)
1647 {
1648 if (!(row_array[i]==0))
1649 break;
1650 }
1652}

Friends And Related Symbol Documentation

◆ ModPMatrixBackSubstProxyOnArray< number_type >

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

Definition at line 1170 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 1680 of file tgb_internal.h.

◆ startIndices

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

Definition at line 1681 of file tgb_internal.h.


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