@@ -189,6 +189,34 @@ namespace ipa {
* \return This vector
*/
+/**
+ * \fn Vector::min(const Vector &other) const
+ * \brief Calculate the minimum of this vector and \a other element-wise
+ * \param[in] other The other vector
+ * \return The element-wise minimum of this vector and \a other
+ */
+
+/**
+ * \fn Vector::min(T scalar) const
+ * \brief Calculate the minimum of this vector and \a scalar element-wise
+ * \param[in] scalar The scalar
+ * \return The element-wise minimum of this vector and \a scalar
+ */
+
+/**
+ * \fn Vector::max(const Vector &other) const
+ * \brief Calculate the maximum of this vector and \a other element-wise
+ * \param[in] other The other vector
+ * \return The element-wise maximum of this vector and \a other
+ */
+
+/**
+ * \fn Vector::max(T scalar) const
+ * \brief Calculate the maximum of this vector and \a scalar element-wise
+ * \param[in] scalar The scalar
+ * \return The element-wise maximum of this vector and \a scalar
+ */
+
/**
* \fn Vector::dot(const Vector<T, Rows> &other) const
* \brief Compute the dot product
@@ -160,6 +160,26 @@ public:
return apply(scalar, [](T a, T b) { return a / b; });
}
+ constexpr Vector min(const Vector &other) const
+ {
+ return apply(*this, other, [](T a, T b) { return std::min(a, b); });
+ }
+
+ constexpr Vector min(T scalar) const
+ {
+ return apply(*this, scalar, [](T a, T b) { return std::min(a, b); });
+ }
+
+ constexpr Vector max(const Vector &other) const
+ {
+ return apply(*this, other, [](T a, T b) { return std::max(a, b); });
+ }
+
+ constexpr Vector max(T scalar) const
+ {
+ return apply(*this, scalar, [](T a, T b) -> T { return std::max(a, b); });
+ }
+
constexpr T dot(const Vector<T, Rows> &other) const
{
T ret = 0;