My Project
Loading...
Searching...
No Matches
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 1687 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 1696 of file tgb_internal.h.

1716 {
1717// (number_type* array, int nrows, int ncols, int* startIndices, number_type** rows){
1718 //we borrow some parameters ;-)
1719 //we assume, that nobody changes the order of the rows
1720 this->startIndices=p.startIndices;
1721 this->rows=p.rows;
1722 this->ncols=p.ncols;
1723 this->nrows=p.nrows;
1724 lastReducibleIndices=(int*) omalloc(nrows*sizeof(int));
1725 nonZeroUntil=0;
1726 while(nonZeroUntil<nrows)
1727 {
1729 {
1730 nonZeroUntil++;
1731 }
1732 else break;
1733 }
1734 if (TEST_OPT_PROT)
1735 Print("rank:%i\n",nonZeroUntil);
1736 nonZeroUntil--;
1737 int i;
1738 for(i=0;i<=nonZeroUntil;i++)
1739 {
1741 assume(!(npIsZero((number)(long) rows[i][startIndices[i]],currRing->cf)));
1744 }
1745 }
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:103
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 1764 of file tgb_internal.h.

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

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

◆ backwardSubstitute() [2/2]

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

Definition at line 1764 of file tgb_internal.h.

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

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

◆ updateLastReducibleIndex()

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

Definition at line 1746 of file tgb_internal.h.

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

Field Documentation

◆ lastReducibleIndices

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

Definition at line 1691 of file tgb_internal.h.

◆ ncols

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

Definition at line 1692 of file tgb_internal.h.

◆ nonZeroUntil

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

Definition at line 1694 of file tgb_internal.h.

◆ nrows

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

Definition at line 1693 of file tgb_internal.h.

◆ rows

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

Definition at line 1690 of file tgb_internal.h.

◆ startIndices

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

Definition at line 1689 of file tgb_internal.h.


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