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

Public Member Functions

 idealFunctionals (int blockSize, int numFuncs)
 
 ~idealFunctionals ()
 
int dimen () const
 
void endofConstruction ()
 
void map (ring source)
 
void insertCols (int *divisors, int to)
 
void insertCols (int *divisors, const fglmVector to)
 
fglmVector addCols (const int var, int basisSize, const fglmVector v) const
 
fglmVector multiply (const fglmVector v, int var) const
 

Private Member Functions

matHeadergrow (int var)
 

Private Attributes

int _block
 
int _max
 
int _size
 
int _nfunc
 
int * currentSize
 
matHeader ** func
 

Detailed Description

Definition at line 74 of file fglmzero.cc.

Constructor & Destructor Documentation

◆ idealFunctionals()

idealFunctionals::idealFunctionals ( int  blockSize,
int  numFuncs 
)

Definition at line 98 of file fglmzero.cc.

99{
100 int k;
101 _block= blockSize;
102 _max= _block;
103 _size= 0;
104 _nfunc= numFuncs;
105
106 currentSize= (int *)omAlloc0( _nfunc*sizeof( int ) );
107 //for ( k= _nfunc-1; k >= 0; k-- )
108 // currentSize[k]= 0;
109
110 func= (matHeader **)omAlloc( _nfunc*sizeof( matHeader * ) );
111 for ( k= _nfunc-1; k >= 0; k-- )
112 func[k]= (matHeader *)omAlloc( _max*sizeof( matHeader ) );
113}
int k
Definition: cfEzgcd.cc:99
int * currentSize
Definition: fglmzero.cc:81
matHeader ** func
Definition: fglmzero.cc:82
#define omAlloc(size)
Definition: omAllocDecl.h:210
#define omAlloc0(size)
Definition: omAllocDecl.h:211

◆ ~idealFunctionals()

idealFunctionals::~idealFunctionals ( )

Definition at line 115 of file fglmzero.cc.

116{
117 int k;
118 int l;
119 int row;
120 matHeader * colp;
121 matElem * elemp;
122 for ( k= _nfunc-1; k >= 0; k-- ) {
123 for ( l= _size-1, colp= func[k]; l >= 0; l--, colp++ ) {
124 if ( ( colp->owner == TRUE ) && ( colp->size > 0 ) ) {
125 for ( row= colp->size-1, elemp= colp->elems; row >= 0; row--, elemp++ )
126 nDelete( & elemp->elem );
127 omFreeSize( (ADDRESS)colp->elems, colp->size*sizeof( matElem ) );
128 }
129 }
130 omFreeSize( (ADDRESS)func[k], _max*sizeof( matHeader ) );
131 }
132 omFreeSize( (ADDRESS)func, _nfunc*sizeof( matHeader * ) );
133 omFreeSize( (ADDRESS)currentSize, _nfunc*sizeof( int ) );
134}
#define TRUE
Definition: auxiliary.h:100
void * ADDRESS
Definition: auxiliary.h:119
int l
Definition: cfEzgcd.cc:100
matElem * elems
Definition: fglmzero.cc:71
BOOLEAN owner
Definition: fglmzero.cc:70
number elem
Definition: fglmzero.cc:64
int size
Definition: fglmzero.cc:69
The idealFunctionals.
Definition: fglmzero.cc:62
#define nDelete(n)
Definition: numbers.h:16
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260

Member Function Documentation

◆ addCols()

fglmVector idealFunctionals::addCols ( const int  var,
int  basisSize,
const fglmVector  v 
) const

Definition at line 241 of file fglmzero.cc.

242{
243 fglmVector result( basisSize );
244 matHeader * colp;
245 matElem * elemp;
246 number factor, temp;
247 int k, l;
248 int vsize = v.size();
249
250 fglmASSERT( currentSize[var-1]+1 >= vsize, "wrong v.size()" );
251 for ( k= 1, colp= func[var-1]; k <= vsize; k++, colp++ ) {
252 factor= v.getconstelem( k );
253 if ( ! nIsZero( factor ) ) {
254 for ( l= colp->size-1, elemp= colp->elems; l >= 0; l--, elemp++ ) {
255 temp= nMult( factor, elemp->elem );
256 number newelem= nAdd( result.getconstelem( elemp->row ), temp );
257 nDelete( & temp );
258 nNormalize( newelem );
259 result.setelem( elemp->row, newelem );
260 }
261 }
262 }
263 return result;
264}
return result
Definition: facAbsBiFact.cc:75
CanonicalForm factor
Definition: facAbsFact.cc:97
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:39
int row
Definition: fglmzero.cc:63
#define fglmASSERT(ignore1, ignore2)
Definition: fglmzero.cc:52
#define nIsZero(n)
Definition: numbers.h:19
#define nAdd(n1, n2)
Definition: numbers.h:18
#define nNormalize(n)
Definition: numbers.h:30
#define nMult(n1, n2)
Definition: numbers.h:17

◆ dimen()

int idealFunctionals::dimen ( ) const
inline

Definition at line 88 of file fglmzero.cc.

88{ fglmASSERT( _size>0, "called too early"); return _size; }

◆ endofConstruction()

void idealFunctionals::endofConstruction ( )

Definition at line 137 of file fglmzero.cc.

138{
139 _size= currentSize[0];
140}

◆ grow()

matHeader * idealFunctionals::grow ( int  var)
private

Definition at line 177 of file fglmzero.cc.

178{
179 if ( currentSize[var-1] == _max ) {
180 int k;
181 for ( k= _nfunc; k > 0; k-- )
182 func[k-1]= (matHeader *)omReallocSize( func[k-1], _max*sizeof( matHeader ), (_max + _block)*sizeof( matHeader ) );
183 _max+= _block;
184 }
185 currentSize[var-1]++;
186 return func[var-1] + currentSize[var-1] - 1;
187}
#define omReallocSize(addr, o_size, size)
Definition: omAllocDecl.h:220

◆ insertCols() [1/2]

void idealFunctionals::insertCols ( int *  divisors,
const fglmVector  to 
)

Definition at line 210 of file fglmzero.cc.

211{
212 // divisors runs from divisors[0]..divisors[size-1]
213 fglmASSERT( 0 < divisors[0] && divisors[0] <= _nfunc, "wrong number of divisors" );
214 int k, l;
215 int numElems= to.numNonZeroElems();
216 matElem * elems;
217 matElem * elemp;
218 BOOLEAN owner = TRUE;
219 if ( numElems > 0 ) {
220 elems= (matElem *)omAlloc( numElems * sizeof( matElem ) );
221 for ( k= 1, l= 1, elemp= elems; k <= numElems; k++, elemp++ ) {
222 while ( nIsZero( to.getconstelem(l) ) ) l++;
223 elemp->row= l;
224 elemp->elem= nCopy( to.getconstelem( l ) );
225 l++; // hochzaehlen, damit wir nicht noch einmal die gleiche Stelle testen
226 }
227 }
228 else
229 elems= NULL;
230 for ( k= divisors[0]; k > 0; k-- ) {
231 fglmASSERT( 0 < divisors[k] && divisors[k] <= _nfunc, "wrong divisor" );
232 matHeader * colp = grow( divisors[k] );
233 colp->size= numElems;
234 colp->elems= elems;
235 colp->owner= owner;
236 owner= FALSE;
237 }
238}
int BOOLEAN
Definition: auxiliary.h:87
#define FALSE
Definition: auxiliary.h:96
int numNonZeroElems() const
Definition: fglmvec.cc:212
number getconstelem(int i) const
Definition: fglmvec.cc:446
matHeader * grow(int var)
Definition: fglmzero.cc:177
#define nCopy(n)
Definition: numbers.h:15
#define NULL
Definition: omList.c:12

◆ insertCols() [2/2]

void idealFunctionals::insertCols ( int *  divisors,
int  to 
)

Definition at line 190 of file fglmzero.cc.

191{
192 fglmASSERT( 0 < divisors[0] && divisors[0] <= _nfunc, "wrong number of divisors" );
193 int k;
194 BOOLEAN owner = TRUE;
195 matElem * elems = (matElem *)omAlloc( sizeof( matElem ) );
196 elems->row= to;
197 elems->elem= nInit( 1 );
198 for ( k= divisors[0]; k > 0; k-- ) {
199 fglmASSERT( 0 < divisors[k] && divisors[k] <= _nfunc, "wrong divisor" );
200 matHeader * colp = grow( divisors[k] );
201 colp->size= 1;
202 colp->elems= elems;
203 colp->owner= owner;
204 owner= FALSE;
205 }
206}
#define nInit(i)
Definition: numbers.h:24

◆ map()

void idealFunctionals::map ( ring  source)

Definition at line 143 of file fglmzero.cc.

144{
145 // maps from ring source to currentRing.
146 int var, col, row;
147 matHeader * colp;
148 matElem * elemp;
149 number newelem;
150
151 int * perm = (int *)omAlloc0( (_nfunc+1)*sizeof( int ) );
152 maFindPerm( source->names, source->N, NULL, 0, currRing->names,
153 currRing->N, NULL, 0, perm, NULL , currRing->cf->type);
154 nMapFunc nMap=n_SetMap( source->cf, currRing->cf);
155
156 matHeader ** temp = (matHeader **)omAlloc( _nfunc*sizeof( matHeader * ));
157 for ( var= 0; var < _nfunc; var ++ ) {
158 for ( col= 0, colp= func[var]; col < _size; col++, colp++ ) {
159 if ( colp->owner == TRUE ) {
160 for ( row= colp->size-1, elemp= colp->elems; row >= 0;
161 row--, elemp++ )
162 {
163 newelem= nMap( elemp->elem, source->cf, currRing->cf );
164 nDelete( & elemp->elem );
165 elemp->elem= newelem;
166 }
167 }
168 }
169 temp[ perm[var+1]-1 ]= func[var];
170 }
171 omFreeSize( (ADDRESS)func, _nfunc*sizeof( matHeader * ) );
172 omFreeSize( (ADDRESS)perm, (_nfunc+1)*sizeof( int ) );
173 func= temp;
174}
static FORCE_INLINE nMapFunc n_SetMap(const coeffs src, const coeffs dst)
set the mapping function pointers for translating numbers from src to dst
Definition: coeffs.h:697
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
Definition: coeffs.h:73
void maFindPerm(char const *const *const preim_names, int preim_n, char const *const *const preim_par, int preim_p, char const *const *const names, int n, char const *const *const par, int nop, int *perm, int *par_perm, n_coeffType ch)
Definition: maps.cc:163
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13

◆ multiply()

fglmVector idealFunctionals::multiply ( const fglmVector  v,
int  var 
) const

Definition at line 267 of file fglmzero.cc.

268{
269 fglmASSERT( v.size() == _size, "multiply: v has wrong size");
271 matHeader * colp;
272 matElem * elemp;
273 number factor, temp;
274 int k, l;
275 for ( k= 1, colp= func[var-1]; k <= _size; k++, colp++ ) {
276 factor= v.getconstelem( k );
277 if ( ! nIsZero( factor ) ) {
278 for ( l= colp->size-1, elemp= colp->elems; l >= 0; l--, elemp++ ) {
279 temp= nMult( factor, elemp->elem );
280 number newelem= nAdd( result.getconstelem( elemp->row ), temp );
281 nDelete( & temp );
282 nNormalize( newelem );
283 result.setelem( elemp->row, newelem );
284 }
285 }
286 }
287 return result;
288}

Field Documentation

◆ _block

int idealFunctionals::_block
private

Definition at line 77 of file fglmzero.cc.

◆ _max

int idealFunctionals::_max
private

Definition at line 78 of file fglmzero.cc.

◆ _nfunc

int idealFunctionals::_nfunc
private

Definition at line 80 of file fglmzero.cc.

◆ _size

int idealFunctionals::_size
private

Definition at line 79 of file fglmzero.cc.

◆ currentSize

int* idealFunctionals::currentSize
private

Definition at line 81 of file fglmzero.cc.

◆ func

matHeader** idealFunctionals::func
private

Definition at line 82 of file fglmzero.cc.


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