Loading...
Searching...
No Matches
Variable Class Reference

factory's class for variables More...

`#include <factory.h>`

## Public Member Functions

| Variable ()
| Variable (int l)
| Variable (char name)
| Variable (int l, char name)
| Variable (const Variable &v)
| ~Variable ()
Variable & | operator= (const Variable &v)
int | level () const
char | name () const
Variable | next () const
| Variable ()
| Variable (int l)
| Variable (char name)
| Variable (int l, char name)
| Variable (const Variable &v)
| ~Variable ()
Variable & | operator= (const Variable &v)
int | level () const
char | name () const
Variable | next () const
| Variable ()
| Variable (int l)
| Variable (char name)
| Variable (int l, char name)
| Variable (const Variable &v)
| ~Variable ()
Variable & | operator= (const Variable &v)
int | level () const
char | name () const
Variable | next () const

## Static Public Member Functions

static Variable | highest ()
static Variable | highest ()
static Variable | highest ()

## Private Member Functions

| Variable (int l, bool flag)
| Variable (int l, bool flag)
| Variable (int l, bool flag)

## Private Attributes

int | _level

## Friends

bool | operator== (const Variable &lhs, const Variable &rhs)
bool | operator!= (const Variable &lhs, const Variable &rhs)
bool | operator> (const Variable &lhs, const Variable &rhs)
bool | operator< (const Variable &lhs, const Variable &rhs)
bool | operator>= (const Variable &lhs, const Variable &rhs)
bool | operator<= (const Variable &lhs, const Variable &rhs)
OSTREAM & | operator<< (OSTREAM &os, const Variable &v)
void | swap_levels ()
Variable FACTORY_PUBLIC | rootOf (const CanonicalForm &mipo, char name='@')
| returns a symbolic root of polynomial with name name.
bool | operator== (const Variable &lhs, const Variable &rhs)
bool | operator!= (const Variable &lhs, const Variable &rhs)
bool | operator> (const Variable &lhs, const Variable &rhs)
bool | operator< (const Variable &lhs, const Variable &rhs)
bool | operator>= (const Variable &lhs, const Variable &rhs)
bool | operator<= (const Variable &lhs, const Variable &rhs)
OSTREAM & | operator<< (OSTREAM &os, const Variable &v)
void | swap_levels ()
Variable FACTORY_PUBLIC | rootOf (const CanonicalForm &mipo, char name='@')
| returns a symbolic root of polynomial with name name.
bool | operator== (const Variable &lhs, const Variable &rhs)
bool | operator!= (const Variable &lhs, const Variable &rhs)
bool | operator> (const Variable &lhs, const Variable &rhs)
bool | operator< (const Variable &lhs, const Variable &rhs)
bool | operator>= (const Variable &lhs, const Variable &rhs)
bool | operator<= (const Variable &lhs, const Variable &rhs)
OSTREAM & | operator<< (OSTREAM &os, const Variable &v)
void | swap_levels ()
Variable FACTORY_PUBLIC | rootOf (const CanonicalForm &mipo, char name='@')
| returns a symbolic root of polynomial with name name.

## Detailed Description

factory's class for variables

Definition at line 126 of file factory.h.

## Constructor & Destructor Documentation

## Variable() [1/18]

Variable::Variable | ( | int | l,
|  | bool | flag )

private

Definition at line 47 of file variable.cc.

: _level(l)
{
ASSERT( flag, "illegal level" );
}
l
int l
Definition cfEzgcd.cc:100
ASSERT
#define ASSERT(expression, message)
Definition cf_assert.h:99
Variable::_level
int _level
Definition factory.h:129

## Variable() [2/18]

Variable::Variable | ( |  | ) |

inline

Definition at line 132 of file factory.h.

: _level(LEVELBASE) {}
LEVELBASE
#define LEVELBASE
Definition cf_defs.h:25

## Variable() [3/18]

Variable::Variable | ( | int | l | ) |

Definition at line 52 of file variable.cc.

: _level(l)
{
//ASSERT( l > 0 && l != LEVELQUOT, "illegal level" );
}

## Variable() [4/18]

Variable::Variable | ( | char | name | ) |

Definition at line 57 of file variable.cc.

{
bool isext = false;
int n, i;
if ( var_names_ext != 0 ) {
n = strlen( var_names_ext );
i = 1;
while ( i < n && var_names_ext[i] != name ) i++;
if ( i < n ) {
_level = -i;
isext = true;
}
}
if ( ! isext ) {
if ( var_names == 0 ) {
var_names = new char [3];
var_names[0] = '@';
var_names[1] = name;
var_names[2] = '\0';
_level = 1;
}
else {
n = strlen( var_names );
i = 1;
while ( i < n && var_names[i] != name ) i++;
if ( i < n )
_level = i;
else {
ASSERT( name != '@', "illegal variable name" );
char * newvarnames = new char [n+2];
for ( i = 0; i < n; i++ )
newvarnames[i] = var_names[i];
newvarnames[n] = name;
newvarnames[n+1] = 0;
delete [] var_names;
var_names = newvarnames;
_level = n;
}
}
}
}
i
int i
Definition cfEzgcd.cc:132
Variable::name
char name() const
Definition variable.cc:122
var_names_ext
STATIC_VAR char * var_names_ext
Definition variable.cc:43
var_names
STATIC_VAR char * var_names
Definition variable.cc:42

## Variable() [5/18]

Variable::Variable | ( | int | l,
|  | char | name )

Definition at line 99 of file variable.cc.

: _level(l)
{
ASSERT( l > 0 && l != LEVELQUOT, "illegal level" );
int n;
if ( (n = (var_names == 0 ? 0 : strlen( var_names ))) <= l ) {
char * newvarnames = new char [l+2];
int i;
for ( i = 0; i < n; i++ )
newvarnames[i] = var_names[i];
for ( i = n; i < l; i++ )
newvarnames[i] = '@';
newvarnames[l] = name;
newvarnames[l+1] = 0;
delete [] var_names;
var_names = newvarnames;
}
else {
ASSERT( var_names[l] == '@', "illegal name" );
var_names[l] = name;
}
}
LEVELQUOT
#define LEVELQUOT
Definition cf_defs.h:27

## Variable() [6/18]

Variable::Variable | ( | const Variable & | v | ) |

inline

Definition at line 136 of file factory.h.

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

## ~Variable() [1/3]

Variable::~Variable | ( |  | ) |

inline

Definition at line 137 of file factory.h.

{};

## Variable() [7/18]

Variable::Variable | ( | int | l,
|  | bool | flag )

private

## Variable() [8/18]

Variable::Variable | ( |  | ) |

inline

Definition at line 132 of file factory.h.

: _level(LEVELBASE) {}

## Variable() [9/18]

Variable::Variable | ( | int | l | ) |

## Variable() [10/18]

Variable::Variable | ( | char | name | ) |

## Variable() [11/18]

Variable::Variable | ( | int | l,
|  | char | name )

## Variable() [12/18]

Variable::Variable | ( | const Variable & | v | ) |

inline

Definition at line 136 of file factory.h.

: _level(v._level) {}

## ~Variable() [2/3]

Variable::~Variable | ( |  | ) |

inline

Definition at line 137 of file factory.h.

{};

## Variable() [13/18]

Variable::Variable | ( | int | l,
|  | bool | flag )

private

## Variable() [14/18]

Variable::Variable | ( |  | ) |

inline

Definition at line 38 of file variable.h.

: _level(LEVELBASE) {}

## Variable() [15/18]

Variable::Variable | ( | int | l | ) |

## Variable() [16/18]

Variable::Variable | ( | char | name | ) |

## Variable() [17/18]

Variable::Variable | ( | int | l,
|  | char | name )

## Variable() [18/18]

Variable::Variable | ( | const Variable & | v | ) |

inline

Definition at line 42 of file variable.h.

: _level(v._level) {}

## ~Variable() [3/3]

Variable::~Variable | ( |  | ) |

inline

Definition at line 43 of file variable.h.

{};

## Member Function Documentation

## highest() [1/3]

Variable Variable::highest | ( |  | ) |

inline static

Definition at line 145 of file factory.h.

{ return Variable( LEVELQUOT-1 ); }
Variable::Variable
Variable()
Definition factory.h:132

## highest() [2/3]

Variable Variable::highest | ( |  | ) |

inline static

Definition at line 145 of file factory.h.

{ return Variable( LEVELQUOT-1 ); }

## highest() [3/3]

Variable Variable::highest | ( |  | ) |

inline static

Definition at line 51 of file variable.h.

{ return Variable( LEVELQUOT-1 ); }

## level() [1/3]

int Variable::level | ( |  | ) | const

inline

Definition at line 143 of file factory.h.

{ return _level; }

## level() [2/3]

int Variable::level | ( |  | ) | const

inline

Definition at line 143 of file factory.h.

{ return _level; }

## level() [3/3]

int Variable::level | ( |  | ) | const

inline

Definition at line 49 of file variable.h.

{ return _level; }

## name() [1/3]

char Variable::name | ( |  | ) | const

Definition at line 122 of file variable.cc.

{
if ( _level > 0 && _level < (int)strlen( var_names ) )
return( var_names[_level] );
else if ( _level < 0 && -_level < (int)strlen( var_names_ext ) )
return( var_names_ext[-_level] );
else
return '@';
}

## name() [2/3]

char Variable::name | ( |  | ) | const

## name() [3/3]

char Variable::name | ( |  | ) | const

## next() [1/3]

Variable Variable::next | ( |  | ) | const

inline

Definition at line 146 of file factory.h.

{ return Variable( _level+1 ); }

## next() [2/3]

Variable Variable::next | ( |  | ) | const

inline

Definition at line 146 of file factory.h.

{ return Variable( _level+1 ); }

## next() [3/3]

Variable Variable::next | ( |  | ) | const

inline

Definition at line 52 of file variable.h.

{ return Variable( _level+1 ); }

## operator=() [1/3]

Variable & Variable::operator= | ( | const Variable & | v | ) |

inline

Definition at line 138 of file factory.h.

{
_level = v._level;
return *this;
}

## operator=() [2/3]

Variable & Variable::operator= | ( | const Variable & | v | ) |

inline

Definition at line 138 of file factory.h.

{
_level = v._level;
return *this;
}

## operator=() [3/3]

Variable & Variable::operator= | ( | const Variable & | v | ) |

inline

Definition at line 44 of file variable.h.

{
_level = v._level;
return *this;
}

## Friends And Related Symbol Documentation

## operator!= [1/3]

bool operator!= | ( | const Variable & | lhs,
|  | const Variable & | rhs )

friend

Definition at line 151 of file factory.h.

{
return lhs._level != rhs._level;
}

## operator!= [2/3]

bool operator!= | ( | const Variable & | lhs,
|  | const Variable & | rhs )

friend

Definition at line 151 of file factory.h.

{
return lhs._level != rhs._level;
}

## operator!= [3/3]

bool operator!= | ( | const Variable & | lhs,
|  | const Variable & | rhs )

friend

Definition at line 57 of file variable.h.

{
return lhs._level != rhs._level;
}

## operator< [1/3]

bool operator< | ( | const Variable & | lhs,
|  | const Variable & | rhs )

friend

Definition at line 159 of file factory.h.

{
return lhs._level < rhs._level;
}

## operator< [2/3]

bool operator< | ( | const Variable & | lhs,
|  | const Variable & | rhs )

friend

Definition at line 159 of file factory.h.

{
return lhs._level < rhs._level;
}

## operator< [3/3]

bool operator< | ( | const Variable & | lhs,
|  | const Variable & | rhs )

friend

Definition at line 65 of file variable.h.

{
return lhs._level < rhs._level;
}

## operator<< [1/3]

OSTREAM & operator<< | ( | OSTREAM & | os,
|  | const Variable & | v )

friend

Definition at line 133 of file variable.cc.

{
if ( v._level == LEVELBASE )
os << "1";
else {
char * vn = ( v._level > 0 ) ? var_names : var_names_ext;
char dn = ( v._level > 0 ) ? default_name : default_name_ext;
int l = v._level;
if ( l < 0 ) l = -l;
if ( (vn == 0) || ((int)strlen( vn ) <= l) )
os << dn << "_" << l;
else if ( vn[l] == '@' )
os << dn << "_" << l;
else
os << vn[l];
}
return os;
}
default_name_ext
STATIC_VAR char default_name_ext
Definition variable.cc:45
default_name
STATIC_VAR char default_name
Definition variable.cc:44

## operator<< [2/3]

OSTREAM & operator<< | ( | OSTREAM & | os,
|  | const Variable & | v )

friend

Definition at line 133 of file variable.cc.

{
if ( v._level == LEVELBASE )
os << "1";
else {
char * vn = ( v._level > 0 ) ? var_names : var_names_ext;
char dn = ( v._level > 0 ) ? default_name : default_name_ext;
int l = v._level;
if ( l < 0 ) l = -l;
if ( (vn == 0) || ((int)strlen( vn ) <= l) )
os << dn << "_" << l;
else if ( vn[l] == '@' )
os << dn << "_" << l;
else
os << vn[l];
}
return os;
}

## operator<< [3/3]

OSTREAM & operator<< | ( | OSTREAM & | os,
|  | const Variable & | v )

friend

Definition at line 133 of file variable.cc.

{
if ( v._level == LEVELBASE )
os << "1";
else {
char * vn = ( v._level > 0 ) ? var_names : var_names_ext;
char dn = ( v._level > 0 ) ? default_name : default_name_ext;
int l = v._level;
if ( l < 0 ) l = -l;
if ( (vn == 0) || ((int)strlen( vn ) <= l) )
os << dn << "_" << l;
else if ( vn[l] == '@' )
os << dn << "_" << l;
else
os << vn[l];
}
return os;
}

## operator<= [1/3]

bool operator<= | ( | const Variable & | lhs,
|  | const Variable & | rhs )

friend

Definition at line 167 of file factory.h.

{
return lhs._level <= rhs._level;
}

## operator<= [2/3]

bool operator<= | ( | const Variable & | lhs,
|  | const Variable & | rhs )

friend

Definition at line 167 of file factory.h.

{
return lhs._level <= rhs._level;
}

## operator<= [3/3]

bool operator<= | ( | const Variable & | lhs,
|  | const Variable & | rhs )

friend

Definition at line 73 of file variable.h.

{
return lhs._level <= rhs._level;
}

## operator== [1/3]

bool operator== | ( | const Variable & | lhs,
|  | const Variable & | rhs )

friend

Definition at line 147 of file factory.h.

{
return lhs._level == rhs._level;
}

## operator== [2/3]

bool operator== | ( | const Variable & | lhs,
|  | const Variable & | rhs )

friend

Definition at line 147 of file factory.h.

{
return lhs._level == rhs._level;
}

## operator== [3/3]

bool operator== | ( | const Variable & | lhs,
|  | const Variable & | rhs )

friend

Definition at line 53 of file variable.h.

{
return lhs._level == rhs._level;
}

## operator> [1/3]

bool operator> | ( | const Variable & | lhs,
|  | const Variable & | rhs )

friend

Definition at line 155 of file factory.h.

{
return lhs._level > rhs._level;
}

## operator> [2/3]

bool operator> | ( | const Variable & | lhs,
|  | const Variable & | rhs )

friend

Definition at line 155 of file factory.h.

{
return lhs._level > rhs._level;
}

## operator> [3/3]

bool operator> | ( | const Variable & | lhs,
|  | const Variable & | rhs )

friend

Definition at line 61 of file variable.h.

{
return lhs._level > rhs._level;
}

## operator>= [1/3]

bool operator>= | ( | const Variable & | lhs,
|  | const Variable & | rhs )

friend

Definition at line 163 of file factory.h.

{
return lhs._level >= rhs._level;
}

## operator>= [2/3]

bool operator>= | ( | const Variable & | lhs,
|  | const Variable & | rhs )

friend

Definition at line 163 of file factory.h.

{
return lhs._level >= rhs._level;
}

## operator>= [3/3]

bool operator>= | ( | const Variable & | lhs,
|  | const Variable & | rhs )

friend

Definition at line 69 of file variable.h.

{
return lhs._level >= rhs._level;
}

## rootOf [1/3]

Variable FACTORY_PUBLIC rootOf | ( | const CanonicalForm & | mipo,
|  | char | name = '@' )

friend

returns a symbolic root of polynomial with name name.

Use it to define algebraic variables

Note
  : algebraic variables have a level < 0
  : algebraic variables have a level < 0

Definition at line 162 of file variable.cc.

{
ASSERT (mipo.isUnivariate(), "not a legal extension");
int l;
if ( var_names_ext == 0 ) {
var_names_ext = new char [3];
var_names_ext[0] = '@';
var_names_ext[1] = name;
var_names_ext[2] = '\0';
l = 1;
Variable result( -l, true );
algextensions = new ext_entry [2];
algextensions[1] = ext_entry( 0, false );
algextensions[1] = ext_entry( (InternalPoly*)(conv2mipo( mipo, result ).getval()), true );
return result;
}
else {
int i, n = strlen( var_names_ext );
char * newvarnames = new char [n+2];
for ( i = 0; i < n; i++ )
newvarnames[i] = var_names_ext[i];
newvarnames[n] = name;
newvarnames[n+1] = 0;
delete [] var_names_ext;
var_names_ext = newvarnames;
l = n;
Variable result( -l, true );
ext_entry * newalgext = new ext_entry [n+1];
for ( i = 0; i < n; i++ )
newalgext[i] = algextensions[i];
newalgext[n] = ext_entry( 0, false );
delete [] algextensions;
algextensions = newalgext;
algextensions[n] = ext_entry( (InternalPoly*)(conv2mipo( mipo, result ).getval()), true );
return result;
}
}
CanonicalForm::isUnivariate
bool isUnivariate() const
Definition canonicalform.cc:155
Variable::Variable
Variable(int l, bool flag)
Definition variable.cc:47
result
return result
Definition facAbsBiFact.cc:76
mipo
CanonicalForm mipo
Definition facAlgExt.cc:57
conv2mipo
static CanonicalForm conv2mipo(const CanonicalForm &mipo, const Variable &alpha)
Definition variable.cc:154
algextensions
STATIC_VAR ext_entry * algextensions
Definition variable.cc:41

## rootOf [2/3]

Variable FACTORY_PUBLIC rootOf | ( | const CanonicalForm & | mipo,
|  | char | name = '@' )

friend

returns a symbolic root of polynomial with name name.

Use it to define algebraic variables

Note
  : algebraic variables have a level < 0

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
  : algebraic variables have a level < 0

Definition at line 162 of file variable.cc.

{
ASSERT (mipo.isUnivariate(), "not a legal extension");
int l;
if ( var_names_ext == 0 ) {
var_names_ext = new char [3];
var_names_ext[0] = '@';
var_names_ext[1] = name;
var_names_ext[2] = '\0';
l = 1;
Variable result( -l, true );
algextensions = new ext_entry [2];
algextensions[1] = ext_entry( 0, false );
algextensions[1] = ext_entry( (InternalPoly*)(conv2mipo( mipo, result ).getval()), true );
return result;
}
else {
int i, n = strlen( var_names_ext );
char * newvarnames = new char [n+2];
for ( i = 0; i < n; i++ )
newvarnames[i] = var_names_ext[i];
newvarnames[n] = name;
newvarnames[n+1] = 0;
delete [] var_names_ext;
var_names_ext = newvarnames;
l = n;
Variable result( -l, true );
ext_entry * newalgext = new ext_entry [n+1];
for ( i = 0; i < n; i++ )
newalgext[i] = algextensions[i];
newalgext[n] = ext_entry( 0, false );
delete [] algextensions;
algextensions = newalgext;
algextensions[n] = ext_entry( (InternalPoly*)(conv2mipo( mipo, result ).getval()), true );
return result;
}
}

## rootOf [3/3]

Variable FACTORY_PUBLIC rootOf | ( | const CanonicalForm & | mipo,
|  | char | name = '@' )

friend

returns a symbolic root of polynomial with name name.

Use it to define algebraic variables

Note
  : algebraic variables have a level < 0

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
  : algebraic variables have a level < 0

Definition at line 162 of file variable.cc.

{
ASSERT (mipo.isUnivariate(), "not a legal extension");
int l;
if ( var_names_ext == 0 ) {
var_names_ext = new char [3];
var_names_ext[0] = '@';
var_names_ext[1] = name;
var_names_ext[2] = '\0';
l = 1;
Variable result( -l, true );
algextensions = new ext_entry [2];
algextensions[1] = ext_entry( 0, false );
algextensions[1] = ext_entry( (InternalPoly*)(conv2mipo( mipo, result ).getval()), true );
return result;
}
else {
int i, n = strlen( var_names_ext );
char * newvarnames = new char [n+2];
for ( i = 0; i < n; i++ )
newvarnames[i] = var_names_ext[i];
newvarnames[n] = name;
newvarnames[n+1] = 0;
delete [] var_names_ext;
var_names_ext = newvarnames;
l = n;
Variable result( -l, true );
ext_entry * newalgext = new ext_entry [n+1];
for ( i = 0; i < n; i++ )
newalgext[i] = algextensions[i];
newalgext[n] = ext_entry( 0, false );
delete [] algextensions;
algextensions = newalgext;
algextensions[n] = ext_entry( (InternalPoly*)(conv2mipo( mipo, result ).getval()), true );
return result;
}
}

## swap_levels [1/3]

void swap_levels | ( |  | ) |

friend

## swap_levels [2/3]

void swap_levels | ( |  | ) |

friend

## swap_levels [3/3]

void swap_levels | ( |  | ) |

friend

## Field Documentation

## _level

int Variable::_level

private

Definition at line 129 of file factory.h.

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

- factory/factory.h
- factory/include/factory/factory.h
- factory/variable.h
- factory/variable.cc