PPL  0.12.1
Parma_Polyhedra_Library::Variable Class Reference

A dimension of the vector space. More...

#include <Variable.defs.hh>

List of all members.

Classes

struct  Compare
 Binary predicate defining the total ordering on variables. More...

Public Types

typedef void output_function_type (std::ostream &s, const Variable v)
 Type of output functions.

Public Member Functions

 Variable (dimension_type i)
 Builds the variable corresponding to the Cartesian axis of index i.
dimension_type id () const
 Returns the index of the Cartesian axis associated to the variable.
dimension_type space_dimension () const
 Returns the dimension of the vector space enclosing *this.
memory_size_type total_memory_in_bytes () const
 Returns the total size in bytes of the memory occupied by *this.
memory_size_type external_memory_in_bytes () const
 Returns the size in bytes of the memory managed by *this.
bool OK () const
 Checks if all the invariants are satisfied.

Static Public Member Functions

static dimension_type max_space_dimension ()
 Returns the maximum space dimension a Variable can handle.
static void set_output_function (output_function_type *p)
 Sets the output function to be used for printing Variable objects.
static output_function_typeget_output_function ()
 Returns the pointer to the current output function.

Static Private Member Functions

static void default_output_function (std::ostream &s, const Variable v)
 The default output function.

Private Attributes

dimension_type varid
 The index of the Cartesian axis.

Static Private Attributes

static output_function_typecurrent_output_function = 0
 Pointer to the current output function.

Friends

class Init
std::ostream & Parma_Polyhedra_Library::IO_Operators::operator<< (std::ostream &s, const Variable v)

Related Functions

(Note that these are not member functions.)

std::ostream & operator<< (std::ostream &s, const Variable v)
std::ostream & operator<< (std::ostream &s, const Variable v)
 Output operator.
bool less (Variable v, Variable w)
 Defines a total ordering on variables.
bool less (const Variable v, const Variable w)

Detailed Description

A dimension of the vector space.

An object of the class Variable represents a dimension of the space, that is one of the Cartesian axes. Variables are used as basic blocks in order to build more complex linear expressions. Each variable is identified by a non-negative integer, representing the index of the corresponding Cartesian axis (the first axis has index 0). The space dimension of a variable is the dimension of the vector space made by all the Cartesian axes having an index less than or equal to that of the considered variable; thus, if a variable has index $i$, its space dimension is $i+1$.

Note that the ``meaning'' of an object of the class Variable is completely specified by the integer index provided to its constructor: be careful not to be mislead by C++ language variable names. For instance, in the following example the linear expressions e1 and e2 are equivalent, since the two variables x and z denote the same Cartesian axis.

  Variable x(0);
  Variable y(1);
  Variable z(0);
  Linear_Expression e1 = x + y;
  Linear_Expression e2 = y + z;

Definition at line 81 of file Variable.defs.hh.


Member Typedef Documentation

typedef void Parma_Polyhedra_Library::Variable::output_function_type(std::ostream &s, const Variable v)

Type of output functions.

Definition at line 114 of file Variable.defs.hh.


Constructor & Destructor Documentation

Builds the variable corresponding to the Cartesian axis of index i.

Exceptions:
std::length_errorThrown if i+1 exceeds Variable::max_space_dimension().

Definition at line 38 of file Variable.inlines.hh.

  : varid((i < max_space_dimension())
          ? i
          : (throw std::length_error("PPL::Variable::Variable(i):\n"
                                     "i exceeds the maximum allowed "
                                     "variable identifier."), i)) {
}

Member Function Documentation

void Parma_Polyhedra_Library::Variable::default_output_function ( std::ostream &  s,
const Variable  v 
)
staticprivate

The default output function.

Definition at line 39 of file Variable.cc.

References id().

Referenced by Parma_Polyhedra_Library::Init::Init().

                                                                    {
  dimension_type varid = v.id();
  static const char var_name_letters[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  const dimension_type num_letters = sizeof(var_name_letters) - 1;
  s << var_name_letters[varid % num_letters];
  if (dimension_type i = varid / num_letters)
    s << i;
}

Returns the size in bytes of the memory managed by *this.

Definition at line 57 of file Variable.inlines.hh.

Referenced by total_memory_in_bytes().

                                         {
  return 0;
}

Returns the index of the Cartesian axis associated to the variable.

Definition at line 47 of file Variable.inlines.hh.

References varid.

Referenced by Parma_Polyhedra_Library::affine_form_image(), Parma_Polyhedra_Library::Box< ITV >::affine_form_image(), Parma_Polyhedra_Library::Octagonal_Shape< T >::affine_form_image(), Parma_Polyhedra_Library::BD_Shape< T >::affine_form_image(), Parma_Polyhedra_Library::Polyhedron::affine_form_image(), Parma_Polyhedra_Library::Box< ITV >::affine_image(), Parma_Polyhedra_Library::Octagonal_Shape< T >::affine_image(), Parma_Polyhedra_Library::BD_Shape< T >::affine_image(), Parma_Polyhedra_Library::Box< ITV >::affine_preimage(), Parma_Polyhedra_Library::Octagonal_Shape< T >::affine_preimage(), Parma_Polyhedra_Library::BD_Shape< T >::affine_preimage(), Parma_Polyhedra_Library::Box< ITV >::bounded_affine_image(), Parma_Polyhedra_Library::Octagonal_Shape< T >::bounded_affine_image(), Parma_Polyhedra_Library::BD_Shape< T >::bounded_affine_image(), Parma_Polyhedra_Library::Box< ITV >::bounded_affine_preimage(), Parma_Polyhedra_Library::Octagonal_Shape< T >::bounded_affine_preimage(), Parma_Polyhedra_Library::BD_Shape< T >::bounded_affine_preimage(), Parma_Polyhedra_Library::Congruence::coefficient(), Parma_Polyhedra_Library::Linear_Form< C >::coefficient(), Parma_Polyhedra_Library::Constraint::coefficient(), Parma_Polyhedra_Library::Linear_Expression::coefficient(), Parma_Polyhedra_Library::Generator::coefficient(), Parma_Polyhedra_Library::Polyhedron::constrains(), Parma_Polyhedra_Library::Grid::constrains(), default_output_function(), Parma_Polyhedra_Library::Box< ITV >::expand_space_dimension(), Parma_Polyhedra_Library::Octagonal_Shape< T >::expand_space_dimension(), Parma_Polyhedra_Library::BD_Shape< T >::expand_space_dimension(), Parma_Polyhedra_Library::Grid::expand_space_dimension(), Parma_Polyhedra_Library::Polyhedron::expand_space_dimension(), Parma_Polyhedra_Library::Box< ITV >::fold_space_dimensions(), Parma_Polyhedra_Library::Octagonal_Shape< T >::fold_space_dimensions(), Parma_Polyhedra_Library::BD_Shape< T >::fold_space_dimensions(), Parma_Polyhedra_Library::Grid::fold_space_dimensions(), Parma_Polyhedra_Library::Polyhedron::fold_space_dimensions(), Parma_Polyhedra_Library::Box< ITV >::generalized_affine_image(), Parma_Polyhedra_Library::Octagonal_Shape< T >::generalized_affine_image(), Parma_Polyhedra_Library::BD_Shape< T >::generalized_affine_image(), Parma_Polyhedra_Library::BD_Shape< T >::generalized_affine_preimage(), Parma_Polyhedra_Library::Octagonal_Shape< T >::generalized_affine_preimage(), Parma_Polyhedra_Library::Box< ITV >::get_interval(), Parma_Polyhedra_Library::Box< ITV >::has_lower_bound(), Parma_Polyhedra_Library::Box< ITV >::has_upper_bound(), Parma_Polyhedra_Library::BD_Shape< T >::incremental_shortest_path_closure_assign(), Parma_Polyhedra_Library::Octagonal_Shape< T >::incremental_strong_closure_assign(), Parma_Polyhedra_Library::Variables_Set::insert(), less(), OK(), Parma_Polyhedra_Library::PIP_Solution_Node::parametric_values(), Parma_Polyhedra_Library::Octagonal_Shape< T >::refine(), Parma_Polyhedra_Library::BD_Shape< T >::refine(), Parma_Polyhedra_Library::Box< ITV >::set_interval(), Parma_Polyhedra_Library::Box< ITV >::unconstrain(), Parma_Polyhedra_Library::Octagonal_Shape< T >::unconstrain(), Parma_Polyhedra_Library::Variables_Set::Variables_Set(), and Parma_Polyhedra_Library::Implementation::wrap_assign_ind().

                   {
  return varid;
}

Returns the maximum space dimension a Variable can handle.

Definition at line 33 of file Variable.inlines.hh.

References Parma_Polyhedra_Library::not_a_dimension().

Referenced by Parma_Polyhedra_Library::max_space_dimension(), and OK().

                              {
  return not_a_dimension() - 1;
}

Checks if all the invariants are satisfied.

Definition at line 34 of file Variable.cc.

References id(), and max_space_dimension().

Referenced by Parma_Polyhedra_Library::Variables_Set::OK().

                      {
  return id() < max_space_dimension();
}

Returns the dimension of the vector space enclosing *this.

The returned value is id()+1.

Definition at line 52 of file Variable.inlines.hh.

References varid.

Referenced by Parma_Polyhedra_Library::Linear_Expression::add_mul_assign(), Parma_Polyhedra_Library::Box< ITV >::affine_form_image(), Parma_Polyhedra_Library::Box< ITV >::affine_image(), Parma_Polyhedra_Library::Grid::affine_image(), Parma_Polyhedra_Library::Polyhedron::affine_image(), Parma_Polyhedra_Library::Box< ITV >::affine_preimage(), Parma_Polyhedra_Library::Grid::affine_preimage(), Parma_Polyhedra_Library::Polyhedron::affine_preimage(), Parma_Polyhedra_Library::Box< ITV >::bounded_affine_image(), Parma_Polyhedra_Library::Grid::bounded_affine_image(), Parma_Polyhedra_Library::Polyhedron::bounded_affine_image(), Parma_Polyhedra_Library::Box< ITV >::bounded_affine_preimage(), Parma_Polyhedra_Library::Grid::bounded_affine_preimage(), Parma_Polyhedra_Library::Polyhedron::bounded_affine_preimage(), Parma_Polyhedra_Library::Congruence::coefficient(), Parma_Polyhedra_Library::Linear_Form< C >::coefficient(), Parma_Polyhedra_Library::Grid_Generator::coefficient(), Parma_Polyhedra_Library::Constraint::coefficient(), Parma_Polyhedra_Library::Linear_Expression::coefficient(), Parma_Polyhedra_Library::Generator::coefficient(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::constrains(), Parma_Polyhedra_Library::Box< ITV >::constrains(), Parma_Polyhedra_Library::Polyhedron::constrains(), Parma_Polyhedra_Library::Octagonal_Shape< T >::constrains(), Parma_Polyhedra_Library::Grid::constrains(), Parma_Polyhedra_Library::BD_Shape< T >::constrains(), Parma_Polyhedra_Library::Box< ITV >::expand_space_dimension(), Parma_Polyhedra_Library::BD_Shape< T >::expand_space_dimension(), Parma_Polyhedra_Library::Grid::expand_space_dimension(), Parma_Polyhedra_Library::Polyhedron::expand_space_dimension(), Parma_Polyhedra_Library::Box< ITV >::fold_space_dimensions(), Parma_Polyhedra_Library::Octagonal_Shape< T >::fold_space_dimensions(), Parma_Polyhedra_Library::BD_Shape< T >::fold_space_dimensions(), Parma_Polyhedra_Library::Grid::fold_space_dimensions(), Parma_Polyhedra_Library::Polyhedron::fold_space_dimensions(), Parma_Polyhedra_Library::Box< ITV >::generalized_affine_image(), Parma_Polyhedra_Library::Grid::generalized_affine_image(), Parma_Polyhedra_Library::Polyhedron::generalized_affine_image(), Parma_Polyhedra_Library::Box< ITV >::generalized_affine_preimage(), Parma_Polyhedra_Library::Grid::generalized_affine_preimage(), Parma_Polyhedra_Library::Polyhedron::generalized_affine_preimage(), Parma_Polyhedra_Library::Box< ITV >::get_interval(), Parma_Polyhedra_Library::Linear_Expression::Linear_Expression(), Parma_Polyhedra_Library::Linear_Form< C >::Linear_Form(), Parma_Polyhedra_Library::Linear_Form< C >::operator+(), Parma_Polyhedra_Library::Linear_Expression::operator+(), Parma_Polyhedra_Library::Linear_Form< C >::operator+=(), Parma_Polyhedra_Library::Linear_Expression::operator+=(), Parma_Polyhedra_Library::Linear_Form< C >::operator-(), Parma_Polyhedra_Library::Linear_Expression::operator-(), Parma_Polyhedra_Library::Linear_Form< C >::operator-=(), Parma_Polyhedra_Library::Linear_Expression::operator-=(), Parma_Polyhedra_Library::Constraint::operator==(), Parma_Polyhedra_Library::Constraint::operator>(), Parma_Polyhedra_Library::PIP_Solution_Node::parametric_values(), Parma_Polyhedra_Library::Octagonal_Shape< T >::relation_with(), Parma_Polyhedra_Library::Box< ITV >::set_interval(), Parma_Polyhedra_Library::Linear_Expression::sub_mul_assign(), Parma_Polyhedra_Library::Generator::throw_dimension_incompatible(), Parma_Polyhedra_Library::Congruence::throw_dimension_incompatible(), Parma_Polyhedra_Library::Constraint::throw_dimension_incompatible(), Parma_Polyhedra_Library::Grid::throw_dimension_incompatible(), Parma_Polyhedra_Library::Polyhedron::throw_dimension_incompatible(), Parma_Polyhedra_Library::Polyhedron::unconstrain(), Parma_Polyhedra_Library::Grid::unconstrain(), and Parma_Polyhedra_Library::BD_Shape< T >::unconstrain().

                                {
  return varid + 1;
}

Returns the total size in bytes of the memory occupied by *this.

Definition at line 62 of file Variable.inlines.hh.

References external_memory_in_bytes().

                                      {
  return sizeof(*this) + external_memory_in_bytes();
}

Friends And Related Function Documentation

friend class Init
friend

Definition at line 134 of file Variable.defs.hh.

bool less ( Variable  v,
Variable  w 
)
related

Defines a total ordering on variables.

Referenced by Parma_Polyhedra_Library::Variable::Compare::operator()().

bool less ( const Variable  v,
const Variable  w 
)
related

Definition at line 78 of file Variable.inlines.hh.

References id().

                                         {
  return v.id() < w.id();
}
std::ostream & operator<< ( std::ostream &  s,
const Variable  v 
)
related

Output operator.

std::ostream & operator<< ( std::ostream &  s,
const Variable  v 
)
related

Definition at line 50 of file Variable.cc.

                                                           {
  (*Variable::current_output_function)(s, v);
  return s;
}
std::ostream& Parma_Polyhedra_Library::IO_Operators::operator<< ( std::ostream &  s,
const Variable  v 
)
friend

Member Data Documentation

Pointer to the current output function.

Definition at line 141 of file Variable.defs.hh.

Referenced by get_output_function(), and set_output_function().

The index of the Cartesian axis.

Definition at line 131 of file Variable.defs.hh.

Referenced by id(), and space_dimension().


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