My Project
Loading...
Searching...
No Matches
Data Structures | Macros | Functions
variable.h File Reference

operations on variables More...

#include <iostream>
#include "cf_defs.h"

Go to the source code of this file.

Data Structures

class  Variable
 factory's class for variables More...
 

Macros

#define OSTREAM   std::ostream
 

Functions

Variable FACTORY_PUBLIC rootOf (const CanonicalForm &, char name='@')
 returns a symbolic root of polynomial with name name Use it to define algebraic variables More...
 
int level (const Variable &v)
 
char name (const Variable &v)
 
void setReduce (const Variable &alpha, bool reduce)
 
void setMipo (const Variable &alpha, const CanonicalForm &mipo)
 
CanonicalForm getMipo (const Variable &alpha, const Variable &x)
 
bool hasMipo (const Variable &alpha)
 
char getDefaultVarName ()
 
char getDefaultExtName ()
 
void FACTORY_PUBLIC prune (Variable &alpha)
 
void prune1 (const Variable &alpha)
 
int ExtensionLevel ()
 
CanonicalForm getMipo (const Variable &alpha)
 
InternalPolygetInternalMipo (const Variable &alpha)
 
bool getReduce (const Variable &alpha)
 

Detailed Description

operations on variables

Definition in file variable.h.

Macro Definition Documentation

◆ OSTREAM

#define OSTREAM   std::ostream

Definition at line 16 of file variable.h.

Function Documentation

◆ ExtensionLevel()

int ExtensionLevel ( )

Definition at line 254 of file variable.cc.

255{
256 if( var_names_ext == 0)
257 return 0;
258 return strlen( var_names_ext )-1;
259}
STATIC_VAR char * var_names_ext
Definition: variable.cc:43

◆ getDefaultExtName()

char getDefaultExtName ( )

Definition at line 249 of file variable.cc.

250{
251 return default_name_ext;
252}
STATIC_VAR char default_name_ext
Definition: variable.cc:45

◆ getDefaultVarName()

char getDefaultVarName ( )

Definition at line 244 of file variable.cc.

245{
246 return default_name;
247}
STATIC_VAR char default_name
Definition: variable.cc:44

◆ getInternalMipo()

InternalPoly * getInternalMipo ( const Variable alpha)

Definition at line 201 of file variable.cc.

202{
203 ASSERT( alpha.level() < 0 && alpha.level() != LEVELBASE, "illegal extension" );
204 return algextensions[-alpha.level()].mipo();
205}
#define ASSERT(expression, message)
Definition: cf_assert.h:99
#define LEVELBASE
Definition: cf_defs.h:25
int level() const
Definition: variable.h:49
InternalPoly * mipo()
Definition: variable.cc:36
Variable alpha
Definition: facAbsBiFact.cc:51
STATIC_VAR ext_entry * algextensions
Definition: variable.cc:41

◆ getMipo() [1/2]

CanonicalForm getMipo ( const Variable alpha)

Definition at line 213 of file variable.cc.

214{
215 ASSERT( alpha.level() < 0 && alpha.level() != LEVELBASE, "illegal extension" );
217}
factory's main class
Definition: canonicalform.h:86
InternalCF * copyObject()
Definition: int_cf.h:62

◆ getMipo() [2/2]

CanonicalForm getMipo ( const Variable alpha,
const Variable x 
)

Definition at line 207 of file variable.cc.

208{
209 ASSERT( alpha.level() < 0 && alpha.level() != LEVELBASE, "illegal extension" );
211}
Variable x
Definition: cfModGcd.cc:4082

◆ getReduce()

bool getReduce ( const Variable alpha)

Definition at line 232 of file variable.cc.

233{
234 ASSERT( alpha.level() < 0 && alpha.level() != LEVELBASE, "illegal extension" );
235 return algextensions[-alpha.level()].reduce();
236}
bool & reduce()
Definition: variable.cc:38

◆ hasMipo()

bool hasMipo ( const Variable alpha)

Definition at line 226 of file variable.cc.

227{
228 ASSERT( alpha.level() < 0, "illegal extension" );
229 return (alpha.level() != LEVELBASE && (algextensions!=NULL) && getReduce(alpha) );
230}
#define NULL
Definition: omList.c:12
bool getReduce(const Variable &alpha)
Definition: variable.cc:232

◆ level()

int level ( const Variable v)
inline

Definition at line 94 of file variable.h.

94{ return v.level(); }
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:39

◆ name()

char name ( const Variable v)
inline

Definition at line 95 of file variable.h.

95{ return v.name(); }
char name() const
Definition: variable.cc:122

◆ prune()

void FACTORY_PUBLIC prune ( Variable alpha)

Definition at line 261 of file variable.cc.

262{
263 if (alpha.level()==LEVELBASE) return;
264 int last_var=-alpha.level();
265 if ((last_var <= 0)||(var_names_ext==NULL)) return;
266 int i, n = strlen( var_names_ext );
267 ASSERT (n+1 >= last_var, "wrong variable");
268 if (last_var == 1)
269 {
270 delete [] var_names_ext;
271 delete [] algextensions;
272 var_names_ext= 0;
273 algextensions= 0;
274 alpha= Variable();
275 return;
276 }
277 char * newvarnames = new char [last_var+1];
278 for ( i = 0; i < last_var; i++ )
279 newvarnames[i] = var_names_ext[i];
280 newvarnames[last_var] = 0;
281 delete [] var_names_ext;
282 var_names_ext = newvarnames;
283 ext_entry * newalgext = new ext_entry [last_var];
284 for ( i = 0; i < last_var; i++ )
285 newalgext[i] = algextensions[i];
286 delete [] algextensions;
287 algextensions = newalgext;
288 alpha= Variable();
289}
int i
Definition: cfEzgcd.cc:132
factory's class for variables
Definition: variable.h:33
Definition: variable.cc:19

◆ prune1()

void prune1 ( const Variable alpha)

Definition at line 291 of file variable.cc.

292{
293 int i, n = strlen( var_names_ext );
294 ASSERT (n+1 >= -alpha.level(), "wrong variable");
295
296 char * newvarnames = new char [-alpha.level() + 2];
297 for ( i = 0; i <= -alpha.level(); i++ )
298 newvarnames[i] = var_names_ext[i];
299 newvarnames[-alpha.level()+1] = 0;
300 delete [] var_names_ext;
301 var_names_ext = newvarnames;
302 ext_entry * newalgext = new ext_entry [-alpha.level()+1];
303 for ( i = 0; i <= -alpha.level(); i++ )
304 newalgext[i] = algextensions[i];
305 delete [] algextensions;
306 algextensions = newalgext;
307}

◆ rootOf()

Variable FACTORY_PUBLIC rootOf ( const CanonicalForm mipo,
char  name 
)

returns a symbolic root of polynomial with name name Use it to define algebraic variables

returns a symbolic root of polynomial with name name.

Note
: algebraic variables have a level < 0

Use it to define algebraic variables

Note
: algebraic variables have a level < 0

Definition at line 85 of file variable.cc.

163{
164 ASSERT (mipo.isUnivariate(), "not a legal extension");
165
166 int l;
167 if ( var_names_ext == 0 ) {
168 var_names_ext = new char [3];
169 var_names_ext[0] = '@';
170 var_names_ext[1] = name;
171 var_names_ext[2] = '\0';
172 l = 1;
173 Variable result( -l, true );
174 algextensions = new ext_entry [2];
175 algextensions[1] = ext_entry( 0, false );
176 algextensions[1] = ext_entry( (InternalPoly*)(conv2mipo( mipo, result ).getval()), true );
177 return result;
178 }
179 else {
180 int i, n = strlen( var_names_ext );
181 char * newvarnames = new char [n+2];
182 for ( i = 0; i < n; i++ )
183 newvarnames[i] = var_names_ext[i];
184 newvarnames[n] = name;
185 newvarnames[n+1] = 0;
186 delete [] var_names_ext;
187 var_names_ext = newvarnames;
188 l = n;
189 Variable result( -l, true );
190 ext_entry * newalgext = new ext_entry [n+1];
191 for ( i = 0; i < n; i++ )
192 newalgext[i] = algextensions[i];
193 newalgext[n] = ext_entry( 0, false );
194 delete [] algextensions;
195 algextensions = newalgext;
196 algextensions[n] = ext_entry( (InternalPoly*)(conv2mipo( mipo, result ).getval()), true );
197 return result;
198 }
199}
int l
Definition: cfEzgcd.cc:100
bool isUnivariate() const
factory's class for polynomials
Definition: int_poly.h:71
return result
Definition: facAbsBiFact.cc:75
CanonicalForm mipo
Definition: facAlgExt.cc:57
int name
New type name for int.
Definition: templateForC.h:21
static CanonicalForm conv2mipo(const CanonicalForm &mipo, const Variable &alpha)
Definition: variable.cc:154

◆ setMipo()

void setMipo ( const Variable alpha,
const CanonicalForm mipo 
)

Definition at line 219 of file variable.cc.

220{
221 ASSERT( alpha.level() < 0 && alpha.level() != LEVELBASE, "illegal extension" );
222 algextensions[-alpha.level()]= ext_entry( 0, false );
223 algextensions[-alpha.level()]= ext_entry((InternalPoly*)(conv2mipo( mipo, alpha ).getval()), true );
224}

◆ setReduce()

void setReduce ( const Variable alpha,
bool  reduce 
)

Definition at line 238 of file variable.cc.

239{
240 ASSERT( alpha.level() < 0 && alpha.level() != LEVELBASE, "illegal extension" );
242}
CanonicalForm reduce(const CanonicalForm &f, const CanonicalForm &M)
polynomials in M.mvar() are considered coefficients M univariate monic polynomial the coefficients of...
Definition: cf_ops.cc:660