PPL  1.2
Parma_Polyhedra_Library::Variable_Floating_Point_Expression< FP_Interval_Type, FP_Format > Class Template Reference

A generic Variable Floating Point Expression. More...

#include <Variable_Floating_Point_Expression_defs.hh>

Inheritance diagram for Parma_Polyhedra_Library::Variable_Floating_Point_Expression< FP_Interval_Type, FP_Format >:
Collaboration diagram for Parma_Polyhedra_Library::Variable_Floating_Point_Expression< FP_Interval_Type, FP_Format >:

Public Types

typedef Floating_Point_Expression< FP_Interval_Type, FP_Format >::FP_Linear_Form FP_Linear_Form
 Alias for the Linear_Form<FP_Interval_Type> from Floating_Point_Expression. More...
 
typedef Floating_Point_Expression< FP_Interval_Type, FP_Format >::FP_Interval_Abstract_Store FP_Interval_Abstract_Store
 Alias for the Box<FP_Interval_Type> from Floating_Point_Expression. More...
 
typedef Floating_Point_Expression< FP_Interval_Type, FP_Format >::FP_Linear_Form_Abstract_Store FP_Linear_Form_Abstract_Store
 Alias for the std::map<dimension_type, FP_Linear_Form> from Floating_Point_Expression. More...
 
typedef Floating_Point_Expression< FP_Interval_Type, FP_Format >::boundary_type boundary_type
 Alias for the FP_Interval_Type::boundary_type from Floating_Point_Expression. More...
 
typedef Floating_Point_Expression< FP_Interval_Type, FP_Format >::info_type info_type
 Alias for the FP_Interval_Type::info_type from Floating_Point_Expression. More...
 
- Public Types inherited from Parma_Polyhedra_Library::Floating_Point_Expression< FP_Interval_Type, FP_Format >
typedef Linear_Form< FP_Interval_Type > FP_Linear_Form
 Alias for a linear form with template argument FP_Interval_Type. More...
 
typedef Box< FP_Interval_Type > FP_Interval_Abstract_Store
 Alias for a map that associates a variable index to an interval. More...
 
typedef std::map< dimension_type, FP_Linear_FormFP_Linear_Form_Abstract_Store
 Alias for a map that associates a variable index to a linear form. More...
 
typedef FP_Interval_Type::boundary_type boundary_type
 The floating point format used by the analyzer. More...
 
typedef FP_Interval_Type::info_type info_type
 The interval policy used by FP_Interval_Type. More...
 

Public Member Functions

bool linearize (const FP_Interval_Abstract_Store &int_store, const FP_Linear_Form_Abstract_Store &lf_store, FP_Linear_Form &result) const
 Linearizes the expression in a given abstract store. More...
 
void linear_form_assign (const FP_Linear_Form &lf, FP_Linear_Form_Abstract_Store &lf_store) const
 Assigns a linear form to the variable with the same index of *this in a given linear form abstract store. More...
 
void m_swap (Variable_Floating_Point_Expression &y)
 Swaps *this with y. More...
 
Constructors and Destructor
 Variable_Floating_Point_Expression (const dimension_type v_index)
 Constructor with a parameter: builds the variable floating point expression corresponding to the variable having v_index as its index. More...
 
 ~Variable_Floating_Point_Expression ()
 Destructor. More...
 
- Public Member Functions inherited from Parma_Polyhedra_Library::Floating_Point_Expression< FP_Interval_Type, FP_Format >
virtual ~Floating_Point_Expression ()
 Destructor. More...
 

Private Member Functions

 Variable_Floating_Point_Expression (const Variable_Floating_Point_Expression &y)
 Inhibited copy constructor. More...
 
Variable_Floating_Point_Expressionoperator= (const Variable_Floating_Point_Expression &y)
 Inhibited assignment operator. More...
 

Private Attributes

dimension_type variable_index
 The index of the variable. More...
 

Related Functions

(Note that these are not member functions.)

template<typename FP_Interval_Type , typename FP_Format >
void swap (Variable_Floating_Point_Expression< FP_Interval_Type, FP_Format > &x, Variable_Floating_Point_Expression< FP_Interval_Type, FP_Format > &y)
 Swaps x with y. More...
 
template<typename FP_Interval_Type , typename FP_Format >
void swap (Variable_Floating_Point_Expression< FP_Interval_Type, FP_Format > &x, Variable_Floating_Point_Expression< FP_Interval_Type, FP_Format > &y)
 

Additional Inherited Members

- Static Public Member Functions inherited from Parma_Polyhedra_Library::Floating_Point_Expression< FP_Interval_Type, FP_Format >
static bool overflows (const FP_Linear_Form &lf)
 Verifies if a given linear form overflows. More...
 
static void relative_error (const FP_Linear_Form &lf, FP_Linear_Form &result)
 Computes the relative error of a given linear form. More...
 
static void intervalize (const FP_Linear_Form &lf, const FP_Interval_Abstract_Store &store, FP_Interval_Type &result)
 Makes result become an interval that overapproximates all the possible values of lf in the interval abstract store store. More...
 
- Static Public Attributes inherited from Parma_Polyhedra_Library::Floating_Point_Expression< FP_Interval_Type, FP_Format >
static FP_Interval_Type absolute_error = compute_absolute_error()
 Absolute error. More...
 

Detailed Description

template<typename FP_Interval_Type, typename FP_Format>
class Parma_Polyhedra_Library::Variable_Floating_Point_Expression< FP_Interval_Type, FP_Format >

A generic Variable Floating Point Expression.

Template type parameters
  • The class template type parameter FP_Interval_Type represents the type of the intervals used in the abstract domain.
  • The class template type parameter FP_Format represents the floating point format used in the concrete domain.
Linearization of floating-point variable expressions

Given a variable expression $v$ and a composite abstract store $\left \llbracket \rho^{\#}, \rho^{\#}_l \right \rrbracket$, we construct the interval linear form $\linexprenv{v}{\rho^{\#}}{\rho^{\#}_l}$ as $\rho^{\#}_l(v)$ if it is defined; otherwise we construct it as $[-1, 1]v$.

Definition at line 64 of file Variable_Floating_Point_Expression_defs.hh.

Member Typedef Documentation

template<typename FP_Interval_Type, typename FP_Format>
typedef Floating_Point_Expression<FP_Interval_Type, FP_Format>::boundary_type Parma_Polyhedra_Library::Variable_Floating_Point_Expression< FP_Interval_Type, FP_Format >::boundary_type

Alias for the FP_Interval_Type::boundary_type from Floating_Point_Expression.

Definition at line 99 of file Variable_Floating_Point_Expression_defs.hh.

template<typename FP_Interval_Type, typename FP_Format>
typedef Floating_Point_Expression<FP_Interval_Type, FP_Format>:: FP_Interval_Abstract_Store Parma_Polyhedra_Library::Variable_Floating_Point_Expression< FP_Interval_Type, FP_Format >::FP_Interval_Abstract_Store

Alias for the Box<FP_Interval_Type> from Floating_Point_Expression.

Definition at line 83 of file Variable_Floating_Point_Expression_defs.hh.

template<typename FP_Interval_Type, typename FP_Format>
typedef Floating_Point_Expression<FP_Interval_Type, FP_Format>:: FP_Linear_Form Parma_Polyhedra_Library::Variable_Floating_Point_Expression< FP_Interval_Type, FP_Format >::FP_Linear_Form

Alias for the Linear_Form<FP_Interval_Type> from Floating_Point_Expression.

Definition at line 75 of file Variable_Floating_Point_Expression_defs.hh.

template<typename FP_Interval_Type, typename FP_Format>
typedef Floating_Point_Expression<FP_Interval_Type, FP_Format>:: FP_Linear_Form_Abstract_Store Parma_Polyhedra_Library::Variable_Floating_Point_Expression< FP_Interval_Type, FP_Format >::FP_Linear_Form_Abstract_Store

Alias for the std::map<dimension_type, FP_Linear_Form> from Floating_Point_Expression.

Definition at line 91 of file Variable_Floating_Point_Expression_defs.hh.

template<typename FP_Interval_Type, typename FP_Format>
typedef Floating_Point_Expression<FP_Interval_Type, FP_Format>::info_type Parma_Polyhedra_Library::Variable_Floating_Point_Expression< FP_Interval_Type, FP_Format >::info_type

Alias for the FP_Interval_Type::info_type from Floating_Point_Expression.

Definition at line 105 of file Variable_Floating_Point_Expression_defs.hh.

Constructor & Destructor Documentation

template<typename FP_Interval_Type , typename FP_Format >
Parma_Polyhedra_Library::Variable_Floating_Point_Expression< FP_Interval_Type, FP_Format >::Variable_Floating_Point_Expression ( const dimension_type  v_index)
inlineexplicit

Constructor with a parameter: builds the variable floating point expression corresponding to the variable having v_index as its index.

Definition at line 34 of file Variable_Floating_Point_Expression_inlines.hh.

35  : variable_index(v_index) {}
template<typename FP_Interval_Type , typename FP_Format >
Parma_Polyhedra_Library::Variable_Floating_Point_Expression< FP_Interval_Type, FP_Format >::~Variable_Floating_Point_Expression ( )
inline

Destructor.

Definition at line 40 of file Variable_Floating_Point_Expression_inlines.hh.

40 {}
template<typename FP_Interval_Type, typename FP_Format>
Parma_Polyhedra_Library::Variable_Floating_Point_Expression< FP_Interval_Type, FP_Format >::Variable_Floating_Point_Expression ( const Variable_Floating_Point_Expression< FP_Interval_Type, FP_Format > &  y)
private

Inhibited copy constructor.

Member Function Documentation

template<typename FP_Interval_Type , typename FP_Format >
void Parma_Polyhedra_Library::Variable_Floating_Point_Expression< FP_Interval_Type, FP_Format >::linear_form_assign ( const FP_Linear_Form lf,
FP_Linear_Form_Abstract_Store lf_store 
) const
inline

Assigns a linear form to the variable with the same index of *this in a given linear form abstract store.

Parameters
lfThe linear form assigned to the variable.
lf_storeThe linear form abstract store.

Note that once lf is assigned to a variable, all the other entries of lf_store which contain that variable are discarded.

Definition at line 71 of file Variable_Floating_Point_Expression_inlines.hh.

72  {
73  for (typename FP_Linear_Form_Abstract_Store::iterator
74  i = lf_store.begin(); i != lf_store.end(); ) {
75  if ((i->second).coefficient(Variable(variable_index)) != 0) {
76  i = lf_store.erase(i);
77  }
78  else {
79  ++i;
80  }
81  }
82  lf_store[variable_index] = lf;
83  return;
84 }
template<typename FP_Interval_Type , typename FP_Format >
bool Parma_Polyhedra_Library::Variable_Floating_Point_Expression< FP_Interval_Type, FP_Format >::linearize ( const FP_Interval_Abstract_Store int_store,
const FP_Linear_Form_Abstract_Store lf_store,
FP_Linear_Form result 
) const
inlinevirtual

Linearizes the expression in a given abstract store.

Makes result become the linearization of *this in the given composite abstract store.

Parameters
int_storeThe interval abstract store.
lf_storeThe linear form abstract store.
resultThe modified linear form.
Returns
true if the linearization succeeded, false otherwise.

Note that the variable in the expression MUST have an associated value in int_store. If this precondition is not met, calling the method causes an undefined behavior.

See the class description for a detailed explanation of how result is computed.

Implements Parma_Polyhedra_Library::Floating_Point_Expression< FP_Interval_Type, FP_Format >.

Definition at line 53 of file Variable_Floating_Point_Expression_inlines.hh.

55  {
56  typename FP_Linear_Form_Abstract_Store::const_iterator
57  variable_value = lf_store.find(variable_index);
58 
59  if (variable_value == lf_store.end()) {
60  result = FP_Linear_Form(Variable(variable_index));
61  return true;
62  }
63 
64  result = FP_Linear_Form(variable_value->second);
65  return !this->overflows(result);
66 }
Floating_Point_Expression< FP_Interval_Type, FP_Format >::FP_Linear_Form FP_Linear_Form
Alias for the Linear_Form from Floating_Point_Expression.
static bool overflows(const FP_Linear_Form &lf)
Verifies if a given linear form overflows.
template<typename FP_Interval_Type , typename FP_Format >
void Parma_Polyhedra_Library::Variable_Floating_Point_Expression< FP_Interval_Type, FP_Format >::m_swap ( Variable_Floating_Point_Expression< FP_Interval_Type, FP_Format > &  y)
inline

Swaps *this with y.

Definition at line 45 of file Variable_Floating_Point_Expression_inlines.hh.

References Parma_Polyhedra_Library::swap(), and Parma_Polyhedra_Library::Variable_Floating_Point_Expression< FP_Interval_Type, FP_Format >::variable_index.

Referenced by Parma_Polyhedra_Library::Variable_Floating_Point_Expression< FP_Interval_Type, FP_Format >::swap().

45  {
46  using std::swap;
47  swap(variable_index, y.variable_index);
48 }
void swap(CO_Tree &x, CO_Tree &y)
void swap(Variable_Floating_Point_Expression< FP_Interval_Type, FP_Format > &x, Variable_Floating_Point_Expression< FP_Interval_Type, FP_Format > &y)
Swaps x with y.
template<typename FP_Interval_Type, typename FP_Format>
Variable_Floating_Point_Expression& Parma_Polyhedra_Library::Variable_Floating_Point_Expression< FP_Interval_Type, FP_Format >::operator= ( const Variable_Floating_Point_Expression< FP_Interval_Type, FP_Format > &  y)
private

Inhibited assignment operator.

Friends And Related Function Documentation

template<typename FP_Interval_Type , typename FP_Format >
void swap ( Variable_Floating_Point_Expression< FP_Interval_Type, FP_Format > &  x,
Variable_Floating_Point_Expression< FP_Interval_Type, FP_Format > &  y 
)
related

Swaps x with y.

template<typename FP_Interval_Type , typename FP_Format >
void swap ( Variable_Floating_Point_Expression< FP_Interval_Type, FP_Format > &  x,
Variable_Floating_Point_Expression< FP_Interval_Type, FP_Format > &  y 
)
related

Member Data Documentation

template<typename FP_Interval_Type, typename FP_Format>
dimension_type Parma_Polyhedra_Library::Variable_Floating_Point_Expression< FP_Interval_Type, FP_Format >::variable_index
private

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