From 3acacb089dbe8aa26b8085591bad10e317f3de1a Mon Sep 17 00:00:00 2001
From: Stefan Klug <stefan.klug@ideasonboard.com>
Date: Thu, 23 Jan 2025 12:40:52 +0100
Subject: 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>
---
 src/ipa/libipa/pwl.cpp | 5 +++++
 src/ipa/libipa/pwl.h   | 1 +
 2 files changed, 6 insertions(+)

(limited to 'src/ipa/libipa')

diff --git a/src/ipa/libipa/pwl.cpp b/src/ipa/libipa/pwl.cpp
index 88fe2022..3fa005ba 100644
--- a/src/ipa/libipa/pwl.cpp
+++ b/src/ipa/libipa/pwl.cpp
@@ -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
diff --git a/src/ipa/libipa/pwl.h b/src/ipa/libipa/pwl.h
index 8fdc7053..c1496c30 100644
--- a/src/ipa/libipa/pwl.h
+++ b/src/ipa/libipa/pwl.h
@@ -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;
-- 
cgit v1.2.1