|
PPL
0.12.1
|
A generic Multiplication Floating Point Expression. More...
#include <Multiplication_Floating_Point_Expression.defs.hh>


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. | |
| 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. | |
| 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. | |
| 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. | |
| 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. | |
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 astract store. | |
| void | m_swap (Multiplication_Floating_Point_Expression< FP_Interval_Type, FP_Format > &y) |
Swaps *this with y. | |
Constructors and Destructor | |
| Multiplication_Floating_Point_Expression (Floating_Point_Expression< FP_Interval_Type, FP_Format > *const x, Floating_Point_Expression< FP_Interval_Type, FP_Format > *const y) | |
Constructor with two parameters: builds the multiplication floating point expression corresponding to x y. | |
| ~Multiplication_Floating_Point_Expression () | |
| Destructor. | |
Private Member Functions | |
| Multiplication_Floating_Point_Expression (const Multiplication_Floating_Point_Expression< FP_Interval_Type, FP_Format > &e) | |
| Inhibited copy constructor. | |
| Multiplication_Floating_Point_Expression < FP_Interval_Type, FP_Format > & | operator= (const Multiplication_Floating_Point_Expression< FP_Interval_Type, FP_Format > &e) |
| Inhibited assignment operator. | |
Private Attributes | |
| Floating_Point_Expression < FP_Interval_Type, FP_Format > * | first_operand |
| Pointer to the first operand. | |
| Floating_Point_Expression < FP_Interval_Type, FP_Format > * | second_operand |
| Pointer to the second operand. | |
Related Functions | |
(Note that these are not member functions.) | |
| template<typename FP_Interval_Type , typename FP_Format > | |
| void | swap (Multiplication_Floating_Point_Expression< FP_Interval_Type, FP_Format > &x, Multiplication_Floating_Point_Expression< FP_Interval_Type, FP_Format > &y) |
Swaps x with y. | |
| template<typename FP_Interval_Type , typename FP_Format > | |
| void | swap (Multiplication_Floating_Point_Expression< FP_Interval_Type, FP_Format > &x, Multiplication_Floating_Point_Expression< FP_Interval_Type, FP_Format > &y) |
A generic Multiplication Floating Point Expression.
FP_Interval_Type represents the type of the intervals used in the abstract domain.FP_Format represents the floating point format used in the concrete domain.Let
and
be two linear forms,
and
two sound abstract operators on linear forms such that:
Given an expression
and a composite abstract store
, we construct the interval linear form
as follows:
.
Given an expression
and a composite abstract store
, we construct the interval linear form
as follows:
Given an expression
and a composite abstract store
, we construct the interval linear form
as follows:
where
is the linear form computed by calling method Floating_Point_Expression::relative_error on
,
is the linear form computed by calling method Floating_Point_Expression::intervalize on
and
, and
is a rounding error defined in Floating_Point_Expression::absolute_error.
Even though we intervalize the first operand in the above example, the actual implementation utilizes an heuristics for choosing which of the two operands must be intervalized in order to obtain the most precise result.
Definition at line 131 of file Multiplication_Floating_Point_Expression.defs.hh.
| typedef Floating_Point_Expression<FP_Interval_Type, FP_Format>::boundary_type Parma_Polyhedra_Library::Multiplication_Floating_Point_Expression< FP_Interval_Type, FP_Format >::boundary_type |
Alias for the FP_Interval_Type::boundary_type from Floating_Point_Expression.
Reimplemented from Parma_Polyhedra_Library::Floating_Point_Expression< FP_Interval_Type, FP_Format >.
Definition at line 166 of file Multiplication_Floating_Point_Expression.defs.hh.
| typedef Floating_Point_Expression<FP_Interval_Type, FP_Format>::FP_Interval_Abstract_Store Parma_Polyhedra_Library::Multiplication_Floating_Point_Expression< FP_Interval_Type, FP_Format >::FP_Interval_Abstract_Store |
Alias for the Box<FP_Interval_Type> from Floating_Point_Expression.
Reimplemented from Parma_Polyhedra_Library::Floating_Point_Expression< FP_Interval_Type, FP_Format >.
Definition at line 150 of file Multiplication_Floating_Point_Expression.defs.hh.
| typedef Floating_Point_Expression<FP_Interval_Type, FP_Format>::FP_Linear_Form Parma_Polyhedra_Library::Multiplication_Floating_Point_Expression< FP_Interval_Type, FP_Format >::FP_Linear_Form |
Alias for the Linear_Form<FP_Interval_Type> from Floating_Point_Expression.
Reimplemented from Parma_Polyhedra_Library::Floating_Point_Expression< FP_Interval_Type, FP_Format >.
Definition at line 142 of file Multiplication_Floating_Point_Expression.defs.hh.
| typedef Floating_Point_Expression<FP_Interval_Type, FP_Format>:: FP_Linear_Form_Abstract_Store Parma_Polyhedra_Library::Multiplication_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.
Reimplemented from Parma_Polyhedra_Library::Floating_Point_Expression< FP_Interval_Type, FP_Format >.
Definition at line 158 of file Multiplication_Floating_Point_Expression.defs.hh.
| typedef Floating_Point_Expression<FP_Interval_Type, FP_Format>::info_type Parma_Polyhedra_Library::Multiplication_Floating_Point_Expression< FP_Interval_Type, FP_Format >::info_type |
Alias for the FP_Interval_Type::info_type from Floating_Point_Expression.
Reimplemented from Parma_Polyhedra_Library::Floating_Point_Expression< FP_Interval_Type, FP_Format >.
Definition at line 172 of file Multiplication_Floating_Point_Expression.defs.hh.
|
inline |
Constructor with two parameters: builds the multiplication floating point expression corresponding to x
y.
Definition at line 35 of file Multiplication_Floating_Point_Expression.inlines.hh.
: first_operand(x), second_operand(y) { assert(x != 0); assert(y != 0); }
|
inline |
Destructor.
Definition at line 46 of file Multiplication_Floating_Point_Expression.inlines.hh.
{
delete first_operand;
delete second_operand;
}
|
private |
Inhibited copy constructor.
|
virtual |
Linearizes the expression in a given astract store.
Makes result become the linearization of *this in the given composite abstract store.
| int_store | The interval abstract store. |
| lf_store | The linear form abstract store. |
| result | The modified linear form. |
true if the linearization succeeded, false otherwise.Note that all variables occuring in the expressions represented by first_operand and second_operand 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 32 of file Multiplication_Floating_Point_Expression.templates.hh.
{
/*
FIXME: We currently adopt the "Interval-Size Local" strategy in order to
decide which of the two linear forms must be intervalized, as described
in Section 6.2.4 ("Multiplication Strategies") of Antoine Mine's Ph.D.
thesis "Weakly Relational Numerical Abstract Domains".
In this Section are also described other multiplication strategies, such
as All-Cases, Relative-Size Local, Simplification-Driven Global and
Homogeneity Global.
*/
// Here we choose which of the two linear forms must be intervalized.
// true if we intervalize the first form, false if we intervalize the second.
bool intervalize_first;
FP_Linear_Form linearized_first_operand;
if (!first_operand->linearize(int_store, lf_store,
linearized_first_operand))
return false;
FP_Interval_Type intervalized_first_operand;
this->intervalize(linearized_first_operand, int_store,
intervalized_first_operand);
FP_Linear_Form linearized_second_operand;
if (!second_operand->linearize(int_store, lf_store,
linearized_second_operand))
return false;
FP_Interval_Type intervalized_second_operand;
this->intervalize(linearized_second_operand, int_store,
intervalized_second_operand);
// FIXME: we are not sure that what we do here is policy-proof.
if (intervalized_first_operand.is_bounded()) {
if (intervalized_second_operand.is_bounded()) {
boundary_type first_interval_size
= intervalized_first_operand.upper()
- intervalized_first_operand.lower();
boundary_type second_interval_size
= intervalized_second_operand.upper()
- intervalized_second_operand.lower();
if (first_interval_size <= second_interval_size)
intervalize_first = true;
else
intervalize_first = false;
}
else
intervalize_first = true;
}
else {
if (intervalized_second_operand.is_bounded())
intervalize_first = false;
else
return false;
}
// Here we do the actual computation.
// For optimizing, we store the relative error directly into result.
if (intervalize_first) {
relative_error(linearized_second_operand, result);
linearized_second_operand *= intervalized_first_operand;
result *= intervalized_first_operand;
result += linearized_second_operand;
}
else {
relative_error(linearized_first_operand, result);
linearized_first_operand *= intervalized_second_operand;
result *= intervalized_second_operand;
result += linearized_first_operand;
}
result += this->absolute_error;
return !this->overflows(result);
}
|
inline |
Swaps *this with y.
Definition at line 54 of file Multiplication_Floating_Point_Expression.inlines.hh.
References Parma_Polyhedra_Library::swap().
Referenced by Parma_Polyhedra_Library::Multiplication_Floating_Point_Expression< FP_Interval_Type, FP_Format >::swap().
{
using std::swap;
swap(first_operand, y.first_operand);
swap(second_operand, y.second_operand);
}
|
private |
Inhibited assignment operator.
|
related |
Swaps x with y.
|
related |
Definition at line 64 of file Multiplication_Floating_Point_Expression.inlines.hh.
References Parma_Polyhedra_Library::Multiplication_Floating_Point_Expression< FP_Interval_Type, FP_Format >::m_swap().
{
x.m_swap(y);
}
|
private |
Pointer to the first operand.
Definition at line 221 of file Multiplication_Floating_Point_Expression.defs.hh.
|
private |
Pointer to the second operand.
Definition at line 223 of file Multiplication_Floating_Point_Expression.defs.hh.