{"id":21969,"url":"https://patchwork.libcamera.org/api/patches/21969/?format=json","web_url":"https://patchwork.libcamera.org/patch/21969/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20241118221618.13953-10-laurent.pinchart@ideasonboard.com>","date":"2024-11-18T22:16:10","name":"[v3,09/17] ipa: libipa: vector: Add element-wise min() and max() functions","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"f4c543af6b773c1b96b9e09d6c71398753a32846","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/21969/mbox/","series":[{"id":4798,"url":"https://patchwork.libcamera.org/api/series/4798/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4798","date":"2024-11-18T22:16:01","name":"Improve linear algebra helpers in libipa","version":3,"mbox":"https://patchwork.libcamera.org/series/4798/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/21969/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/21969/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id A7D06C32EA\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 18 Nov 2024 22:16:51 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 26EDD65905;\n\tMon, 18 Nov 2024 23:16:51 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7DEBF658F6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 18 Nov 2024 23:16:40 +0100 (CET)","from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi\n\t[81.175.209.231])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 86CA08DB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 18 Nov 2024 23:16:23 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"b8eLwwEt\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1731968183;\n\tbh=e5yIhDKeKmWDxXmNZ5GaJ7A3z+6gzmeEHE8dB2zg5R0=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=b8eLwwEtWlk6oiA4ESvEi3powk1bR0dryTGqGM9XUKzdXYNu7sA83jLRcIBhCs/Zs\n\t8XzNlDOVJIJrVjOkRLT9GGjUqsqBYalMAGqSbXTIBiGsk8jOCMCYjq9ACbbyHED/27\n\tnTvb+V/gEPZzr8vk4t3MOY6DhItdyINpEds/6+7I=","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Subject":"[PATCH v3 09/17] ipa: libipa: vector: Add element-wise min() and\n\tmax() functions","Date":"Tue, 19 Nov 2024 00:16:10 +0200","Message-ID":"<20241118221618.13953-10-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.45.2","In-Reply-To":"<20241118221618.13953-1-laurent.pinchart@ideasonboard.com>","References":"<20241118221618.13953-1-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Add functions to calculate the element-wise minimum and maximum of two\nvectors or of a vector and a scalar. This will be used in algorithm\nimplementations.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nReviewed-by: Milan Zamazal <mzamazal@redhat.com>\n---\n src/ipa/libipa/vector.cpp | 28 ++++++++++++++++++++++++++++\n src/ipa/libipa/vector.h   | 20 ++++++++++++++++++++\n 2 files changed, 48 insertions(+)","diff":"diff --git a/src/ipa/libipa/vector.cpp b/src/ipa/libipa/vector.cpp\nindex 64ffcf5036a4..56c494a7e4da 100644\n--- a/src/ipa/libipa/vector.cpp\n+++ b/src/ipa/libipa/vector.cpp\n@@ -189,6 +189,34 @@ namespace ipa {\n  * \\return This vector\n  */\n \n+/**\n+ * \\fn Vector::min(const Vector &other) const\n+ * \\brief Calculate the minimum of this vector and \\a other element-wise\n+ * \\param[in] other The other vector\n+ * \\return The element-wise minimum of this vector and \\a other\n+ */\n+\n+/**\n+ * \\fn Vector::min(T scalar) const\n+ * \\brief Calculate the minimum of this vector and \\a scalar element-wise\n+ * \\param[in] scalar The scalar\n+ * \\return The element-wise minimum of this vector and \\a scalar\n+ */\n+\n+/**\n+ * \\fn Vector::max(const Vector &other) const\n+ * \\brief Calculate the maximum of this vector and \\a other element-wise\n+ * \\param[in] other The other vector\n+ * \\return The element-wise maximum of this vector and \\a other\n+ */\n+\n+/**\n+ * \\fn Vector::max(T scalar) const\n+ * \\brief Calculate the maximum of this vector and \\a scalar element-wise\n+ * \\param[in] scalar The scalar\n+ * \\return The element-wise maximum of this vector and \\a scalar\n+ */\n+\n /**\n  * \\fn Vector::dot(const Vector<T, Rows> &other) const\n  * \\brief Compute the dot product\ndiff --git a/src/ipa/libipa/vector.h b/src/ipa/libipa/vector.h\nindex 15f511653b60..3fed9570bf62 100644\n--- a/src/ipa/libipa/vector.h\n+++ b/src/ipa/libipa/vector.h\n@@ -160,6 +160,26 @@ public:\n \t\treturn apply(scalar, [](T a, T b) { return a / b; });\n \t}\n \n+\tconstexpr Vector min(const Vector &other) const\n+\t{\n+\t\treturn apply(*this, other, [](T a, T b) { return std::min(a, b); });\n+\t}\n+\n+\tconstexpr Vector min(T scalar) const\n+\t{\n+\t\treturn apply(*this, scalar, [](T a, T b) { return std::min(a, b); });\n+\t}\n+\n+\tconstexpr Vector max(const Vector &other) const\n+\t{\n+\t\treturn apply(*this, other, [](T a, T b) { return std::max(a, b); });\n+\t}\n+\n+\tconstexpr Vector max(T scalar) const\n+\t{\n+\t\treturn apply(*this, scalar, [](T a, T b) -> T { return std::max(a, b); });\n+\t}\n+\n \tconstexpr T dot(const Vector<T, Rows> &other) const\n \t{\n \t\tT ret = 0;\n","prefixes":["v3","09/17"]}