[PPL-devel] [GIT] ppl/ppl(products): The method frequency() added to the Affine_Space domain.
Patricia Hill
p.m.hill at leeds.ac.uk
Sun May 24 08:16:12 CEST 2009
Module: ppl/ppl
Branch: products
Commit: 68dd5db1d102fc5bd5157fc14124abc5c5bf9b43
URL: http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=68dd5db1d102fc5bd5157fc14124abc5c5bf9b43
Author: Patricia Hill <p.m.hill at leeds.ac.uk>
Date: Sat May 23 20:56:45 2009 +0100
The method frequency() added to the Affine_Space domain.
---
src/Affine_Space.defs.hh | 33 +++++++++++++++++++++++++++++++++
src/Affine_Space.inlines.hh | 7 +++++++
2 files changed, 40 insertions(+), 0 deletions(-)
diff --git a/src/Affine_Space.defs.hh b/src/Affine_Space.defs.hh
index 464936a..2a7a9e7 100644
--- a/src/Affine_Space.defs.hh
+++ b/src/Affine_Space.defs.hh
@@ -828,6 +828,39 @@ public:
Coefficient& inf_n, Coefficient& inf_d, bool& minimum,
Generator& point) const;
+ /*! \brief
+ Returns <CODE>true</CODE> if and only if \p *this is not empty and
+ \p expr is discrete in \p *this, in which case the maximum frequency
+ and the value for \p expr that is closest to zero are computed.
+
+ \param expr
+ The linear expression for which the frequency is needed;
+
+ \param freq_n
+ The numerator of the maximum frequency of \p expr;
+
+ \param freq_d
+ The denominator of the maximum frequency of \p expr;
+
+ \param val_n
+ The numerator of a value of \p expr at a point in the grid
+ that is closest to zero;
+
+ \param val_d
+ The denominator of a value of \p expr at a point in the grid
+ that is closest to zero;
+
+ \exception std::invalid_argument
+ Thrown if \p expr and \p *this are dimension-incompatible.
+
+ If \p *this is empty or \p expr can take any real number in \p *this,
+ <CODE>false</CODE> is returned and \p freq_n, \p freq_d,
+ \p val_n and \p val_d are left untouched.
+ */
+ bool frequency(const Linear_Expression& expr,
+ Coefficient& freq_n, Coefficient& freq_d,
+ Coefficient& val_n, Coefficient& val_d) const;
+
//! Returns <CODE>true</CODE> if and only if \p *this contains \p y.
/*!
\exception std::invalid_argument
diff --git a/src/Affine_Space.inlines.hh b/src/Affine_Space.inlines.hh
index 10a236c..b79e725 100644
--- a/src/Affine_Space.inlines.hh
+++ b/src/Affine_Space.inlines.hh
@@ -175,6 +175,13 @@ Affine_Space::minimize(const Linear_Expression& expr,
return gr.minimize(expr, inf_n, inf_d, minimum, point);
}
+inline bool
+Affine_Space::frequency(const Linear_Expression& expr,
+ Coefficient& freq_n, Coefficient& freq_d,
+ Coefficient& val_n, Coefficient& val_d) const {
+ return gr.frequency(expr, freq_n, freq_d, val_n, val_d);
+}
+
/*! \relates Affine_Space */
inline bool
operator!=(const Affine_Space& x, const Affine_Space& y) {
More information about the PPL-devel
mailing list