My Project
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes
gaussReducer Class Reference

#include <fglmgauss.h>

Public Member Functions

 gaussReducer (int dimen)
 
 ~gaussReducer ()
 
BOOLEAN reduce (fglmVector v)
 
void store ()
 
fglmVector getDependence ()
 

Private Attributes

gaussElemelems
 
BOOLEANisPivot
 
int * perm
 
fglmVector v
 
fglmVector p
 
number pdenom
 
int size
 
int max
 

Detailed Description

Definition at line 18 of file fglmgauss.h.

Constructor & Destructor Documentation

◆ gaussReducer()

gaussReducer::gaussReducer ( int  dimen)

Definition at line 57 of file fglmgauss.cc.

58{
59 int k;
60 size= 0;
61 max= dimen;
62#ifndef HAVE_EXPLICIT_CONSTR
63 elems= new gaussElem[ max+1 ];
64#else
65 elems= (gaussElem *)omAlloc( (max+1)*sizeof( gaussElem ) );
66#endif
67 isPivot= (BOOLEAN *)omAlloc( (max+1)*sizeof( BOOLEAN ) );
68 for ( k= max; k > 0; k-- )
69 isPivot[k]= FALSE;
70 perm= (int *)omAlloc( (max+1)*sizeof( int ) );
71}
int BOOLEAN
Definition: auxiliary.h:87
#define FALSE
Definition: auxiliary.h:96
int k
Definition: cfEzgcd.cc:99
gaussElem * elems
Definition: fglmgauss.h:21
BOOLEAN * isPivot
Definition: fglmgauss.h:22
int * perm
Definition: fglmgauss.h:23
#define omAlloc(size)
Definition: omAllocDecl.h:210

◆ ~gaussReducer()

gaussReducer::~gaussReducer ( )

Definition at line 73 of file fglmgauss.cc.

74{
75#ifndef HAVE_EXPLICIT_CONSTR
76 delete [] elems;
77#else
78 int k;
79 for ( k= size; k > 0; k-- )
80 elems[k].~gaussElem();
81 omFreeSize( (ADDRESS)elems, (max+1)*sizeof( gaussElem ) );
82#endif
83
84 omFreeSize( (ADDRESS)isPivot, (max+1)*sizeof( BOOLEAN ) );
85 omFreeSize( (ADDRESS)perm, (max+1)*sizeof( int ) );
86}
void * ADDRESS
Definition: auxiliary.h:119
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260

Member Function Documentation

◆ getDependence()

fglmVector gaussReducer::getDependence ( )

Definition at line 196 of file fglmgauss.cc.

197{
198 nDelete( & pdenom );
199 // hier kann p noch gekuerzt werden, je nach Charakteristik
201 p= fglmVector();
202 return ( result );
203}
number pdenom
Definition: fglmgauss.h:26
fglmVector p
Definition: fglmgauss.h:25
return result
Definition: facAbsBiFact.cc:75
#define nDelete(n)
Definition: numbers.h:16

◆ reduce()

BOOLEAN gaussReducer::reduce ( fglmVector  v)

Definition at line 89 of file fglmgauss.cc.

90{
91 number fac1, fac2;
92 number temp;
93 // Hier ueberlegen, ob thev als referenz, oder wie wann was kopiert usw.
94 v= thev;
95 p= fglmVector( size + 1, size + 1 );
96 // fglmASSERT( pdenom == NULL );
97 pdenom= nInit( 1 );
98 number vdenom = v.clearDenom();
99 if ( ! nIsOne( vdenom ) && ! nIsZero( vdenom ) ) {
100 p.setelem( p.size(), vdenom );
101 }
102 else {
103 nDelete( & vdenom );
104 }
105 number gcd = v.gcd();
106 if ( ! nIsOne( gcd ) && ! nIsZero( gcd ) ) {
107 v /= gcd;
108 number temp= nMult( pdenom, gcd );
109 nDelete( & pdenom );
110 pdenom= temp;
111 }
112 nDelete( & gcd );
113
114 int k;
115 for ( k= 1; k <= size; k++ ) {
116 if ( ! v.elemIsZero( perm[k] ) ) {
117 fac1= elems[k].fac;
118 fac2= nCopy( v.getconstelem( perm[k] ) );
119 v.nihilate( fac1, fac2, elems[k].v );
120 fac1= nMult( fac1, elems[k].pdenom );
121 temp= nMult( fac2, pdenom );
122 nDelete( & fac2 );
123 fac2= temp;
124 p.nihilate( fac1, fac2, elems[k].p );
125 temp= nMult( pdenom, elems[k].pdenom );
126 nDelete( & pdenom );
127 pdenom= temp;
128
129 nDelete( & fac1 );
130 nDelete( & fac2 );
131 number gcd = v.gcd();
132 if ( ! nIsOne( gcd ) && ! nIsZero( gcd ) )
133 {
134 v/= gcd;
135 number temp = nMult( pdenom, gcd );
136 nDelete( & pdenom );
137 pdenom= temp;
138 }
139 nDelete( & gcd );
140 gcd= p.gcd();
141 temp= n_SubringGcd( pdenom, gcd, currRing->cf );
142 nDelete( & gcd );
143 gcd= temp;
144 if ( ! nIsZero( gcd ) && ! nIsOne( gcd ) )
145 {
146 p/= gcd;
147 temp= nDiv( pdenom, gcd );
148 nDelete( & pdenom );
149 pdenom= temp;
151 }
152 nDelete( & gcd );
153 }
154 }
155 return ( v.isZero() );
156}
number clearDenom()
Definition: fglmvec.cc:502
int size() const
Definition: fglmvec.cc:207
int elemIsZero(int i)
Definition: fglmvec.cc:300
number getconstelem(int i) const
Definition: fglmvec.cc:446
void setelem(int i, number &n)
Definition: fglmvec.cc:451
number gcd() const
Definition: fglmvec.cc:458
void nihilate(const number fac1, const number fac2, const fglmVector v)
Definition: fglmvec.cc:218
int isZero()
Definition: fglmvec.cc:295
number fac
Definition: fglmgauss.cc:29
fglmVector v
Definition: fglmgauss.h:24
static FORCE_INLINE number n_SubringGcd(number a, number b, const coeffs r)
Definition: coeffs.h:663
#define nDiv(a, b)
Definition: numbers.h:32
#define nIsZero(n)
Definition: numbers.h:19
#define nCopy(n)
Definition: numbers.h:15
#define nIsOne(n)
Definition: numbers.h:25
#define nNormalize(n)
Definition: numbers.h:30
#define nInit(i)
Definition: numbers.h:24
#define nMult(n1, n2)
Definition: numbers.h:17
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
int gcd(int a, int b)
Definition: walkSupport.cc:836

◆ store()

void gaussReducer::store ( )

Definition at line 159 of file fglmgauss.cc.

160{
161 // fglmASSERT( size < max );
162 // number fac;
163 // find the pivot-element in v:
164
165 size++;
166 int k= 1;
167 while ( nIsZero(v.getconstelem(k)) || isPivot[k] ) {
168 k++;
169 }
170 // fglmASSERT( k <= dimen, "Error(1) in fglmDdata::pivot-search");
171 number pivot= v.getconstelem( k );
172 int pivotcol = k;
173 k++;
174 while ( k <= max ) {
175 if ( ! nIsZero( v.getconstelem(k) ) && ! isPivot[k] ) {
176 if ( nGreater( v.getconstelem( k ), pivot ) ) {
177 pivot= v.getconstelem( k );
178 pivotcol= k;
179 }
180 }
181 k++;
182 }
183 // fglmASSERT( ! nIsZero( pivot ), "Error(2) fglmDdata::Pivotelement ist Null" );
184 isPivot[ pivotcol ]= TRUE;
185 perm[size]= pivotcol;
186
187 pivot= nCopy( v.getconstelem( pivotcol ) );
188#ifndef HAVE_EXPLICIT_CONSTR
189 elems[size].mac_gaussElem( v, p, pdenom, pivot );
190#else
192#endif
193}
#define TRUE
Definition: auxiliary.h:100
gaussElem(const fglmVector newv, const fglmVector newp, number &newpdenom, number &newfac)
Definition: fglmgauss.cc:30
bool pivot(const matrix aMat, const int r1, const int r2, const int c1, const int c2, int *bestR, int *bestC, const ring R)
This code computes a score for each non-zero matrix entry in aMat[r1..r2, c1..c2].
#define nGreater(a, b)
Definition: numbers.h:28

Field Documentation

◆ elems

gaussElem* gaussReducer::elems
private

Definition at line 21 of file fglmgauss.h.

◆ isPivot

BOOLEAN* gaussReducer::isPivot
private

Definition at line 22 of file fglmgauss.h.

◆ max

int gaussReducer::max
private

Definition at line 28 of file fglmgauss.h.

◆ p

fglmVector gaussReducer::p
private

Definition at line 25 of file fglmgauss.h.

◆ pdenom

number gaussReducer::pdenom
private

Definition at line 26 of file fglmgauss.h.

◆ perm

int* gaussReducer::perm
private

Definition at line 23 of file fglmgauss.h.

◆ size

int gaussReducer::size
private

Definition at line 27 of file fglmgauss.h.

◆ v

fglmVector gaussReducer::v
private

Definition at line 24 of file fglmgauss.h.


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