ipa: libipa: pwl: Add a size() function

Add a size() function to the Pwl class to return the number of points in
the piecewise linear function. This is useful, for instance, to validate
that all points added with append() or prepend() have been taken into
account.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
Laurent Pinchart
2024-06-13 03:21:46 +03:00
parent e127e63c93
commit 0706c67711
2 changed files with 8 additions and 0 deletions
+6
View File
@@ -188,6 +188,12 @@ void Pwl::prepend(double x, double y, const double eps)
* \return True if there are no points in the function, false otherwise
*/
/**
* \fn Pwl::size() const
* \brief Retrieve the number of points in the piecewise linear function
* \return The number of points in the piecewise linear function
*/
/**
* \brief Get the domain of the piecewise linear function
* \return An interval representing the domain
+2
View File
@@ -52,6 +52,8 @@ public:
void append(double x, double y, double eps = 1e-6);
bool empty() const { return points_.empty(); }
size_t size() const { return points_.size(); }
Interval domain() const;
Interval range() const;