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 1683 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 1692 of file tgb_internal.h.

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

1825 {
1827 }
#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 1828 of file tgb_internal.h.

1829 {
1830 int i;
1831 for(i=nonZeroUntil;i>0;i--)
1832 {
1834 }
1835 }

◆ backwardSubstitute() [2/2]

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

Definition at line 1760 of file tgb_internal.h.

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

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

◆ updateLastReducibleIndex()

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

Definition at line 1742 of file tgb_internal.h.

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

Field Documentation

◆ lastReducibleIndices

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

Definition at line 1687 of file tgb_internal.h.

◆ ncols

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

Definition at line 1688 of file tgb_internal.h.

◆ nonZeroUntil

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

Definition at line 1690 of file tgb_internal.h.

◆ nrows

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

Definition at line 1689 of file tgb_internal.h.

◆ rows

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

Definition at line 1686 of file tgb_internal.h.

◆ startIndices

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

Definition at line 1685 of file tgb_internal.h.


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