libipa: pwl: Add clear() function

Sometimes it is necessary to clear a pwl. Add a function for that.

Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
This commit is contained in:
Stefan Klug 2025-01-23 12:40:52 +01:00
parent 3c653f3f65
commit 3acacb089d
2 changed files with 6 additions and 0 deletions

View file

@ -159,6 +159,11 @@ void Pwl::prepend(double x, double y, const double eps)
* \return True if there are no points in the function, false otherwise
*/
/**
* \fn Pwl::clear()
* \brief Clear the piecewise linear function
*/
/**
* \fn Pwl::size() const
* \brief Retrieve the number of points in the piecewise linear function

View file

@ -49,6 +49,7 @@ public:
void append(double x, double y, double eps = 1e-6);
bool empty() const { return points_.empty(); }
void clear() { points_.clear(); }
size_t size() const { return points_.size(); }
Interval domain() const;