summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Klug <stefan.klug@ideasonboard.com>2025-01-23 12:40:52 +0100
committerStefan Klug <stefan.klug@ideasonboard.com>2025-02-21 17:35:03 +0100
commit3acacb089dbe8aa26b8085591bad10e317f3de1a (patch)
tree045d6536e081e7880fdd55d12bfcf3fc3bf620f7
parent3c653f3f6532fa30b7ed0426e6bbce7c516e69bb (diff)
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>
-rw-r--r--src/ipa/libipa/pwl.cpp5
-rw-r--r--src/ipa/libipa/pwl.h1
2 files changed, 6 insertions, 0 deletions
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
@@ -160,6 +160,11 @@ void Pwl::prepend(double x, double y, const double eps)
*/
/**
+ * \fn Pwl::clear()
+ * \brief Clear the piecewise linear function
+ */
+
+/**
* \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
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;