Patch Detail
Show a patch.
GET /api/1.1/patches/22005/?format=api
{ "id": 22005, "url": "https://patchwork.libcamera.org/api/1.1/patches/22005/?format=api", "web_url": "https://patchwork.libcamera.org/patch/22005/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20241119121928.30939-8-laurent.pinchart@ideasonboard.com>", "date": "2024-11-19T12:19:18", "name": "[v4,07/17] ipa: libipa: vector: Add missing binary arithemtic operators", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "f4748c6f7b16052be8483dd58690ffd320f29551", "submitter": { "id": 2, "url": "https://patchwork.libcamera.org/api/1.1/people/2/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/22005/mbox/", "series": [ { "id": 4804, "url": "https://patchwork.libcamera.org/api/1.1/series/4804/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4804", "date": "2024-11-19T12:19:11", "name": "Improve linear algebra helpers in libipa", "version": 4, "mbox": "https://patchwork.libcamera.org/series/4804/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/22005/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/22005/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 ED5EBC330B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 19 Nov 2024 12:20:04 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 6D2D065F28;\n\tTue, 19 Nov 2024 13:20:04 +0100 (CET)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D14D865F26\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 19 Nov 2024 13:20:00 +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 215591211\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 19 Nov 2024 13:19:43 +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=\"BrcNyrq0\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1732018783;\n\tbh=4N+++9E/T/t8o7/PaCBa/jkDDe51oLGMigWb6vPc+7s=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=BrcNyrq0Xw+GBOzU0tn9PLKMwy8DiMnTWitSE2OqOE1HSK6R5YFAEvQEPs0WzNytc\n\tzw4mBCagB++NsmJ2SfS09s9tgq1uYbPwxhDPHlgPXdBWmTsLR4QexcsQwHsrNMSXu0\n\t68dqf1ZBrjXFqAmosEO9GXqKv3SwhQ/FTeHCaCv8=", "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Subject": "[PATCH v4 07/17] ipa: libipa: vector: Add missing binary arithemtic\n\toperators", "Date": "Tue, 19 Nov 2024 14:19:18 +0200", "Message-ID": "<20241119121928.30939-8-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.45.2", "In-Reply-To": "<20241119121928.30939-1-laurent.pinchart@ideasonboard.com>", "References": "<20241119121928.30939-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": "The Vector class defines multiple element-wise arithmetic operators\nbetween vectors or between a vector and a scalar. A few variants are\nmissing. Add them.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nReviewed-by: Milan Zamazal <mzamazal@redhat.com>\n---\nChanges since v2:\n\n- Use std::plus, std::minus, std::multiplies and std::divides\n---\n src/ipa/libipa/vector.cpp | 54 +++++++++++++++++++++++++++++----------\n src/ipa/libipa/vector.h | 38 ++++++++++++++++++++-------\n 2 files changed, 70 insertions(+), 22 deletions(-)", "diff": "diff --git a/src/ipa/libipa/vector.cpp b/src/ipa/libipa/vector.cpp\nindex 473e6d8bad01..13aaacbed20e 100644\n--- a/src/ipa/libipa/vector.cpp\n+++ b/src/ipa/libipa/vector.cpp\n@@ -77,32 +77,60 @@ namespace ipa {\n * \\return The negated vector\n */\n \n+/**\n+ * \\fn Vector::operator+(Vector const &other) const\n+ * \\brief Calculate the sum of this vector and \\a other element-wise\n+ * \\param[in] other The other vector\n+ * \\return The element-wise sum of this vector and \\a other\n+ */\n+\n+/**\n+ * \\fn Vector::operator+(T scalar) const\n+ * \\brief Calculate the sum of this vector and \\a scalar element-wise\n+ * \\param[in] scalar The scalar\n+ * \\return The element-wise sum of this vector and \\a other\n+ */\n+\n /**\n * \\fn Vector::operator-(Vector const &other) const\n- * \\brief Subtract one vector from another\n+ * \\brief Calculate the difference of this vector and \\a other element-wise\n * \\param[in] other The other vector\n- * \\return The difference of \\a other from this vector\n+ * \\return The element-wise subtraction of \\a other from this vector\n */\n \n /**\n- * \\fn Vector::operator+()\n- * \\brief Add two vectors together\n+ * \\fn Vector::operator-(T scalar) const\n+ * \\brief Calculate the difference of this vector and \\a scalar element-wise\n+ * \\param[in] scalar The scalar\n+ * \\return The element-wise subtraction of \\a scalar from this vector\n+ */\n+\n+/**\n+ * \\fn Vector::operator*(const Vector &other) const\n+ * \\brief Calculate the product of this vector and \\a other element-wise\n * \\param[in] other The other vector\n- * \\return The sum of the two vectors\n+ * \\return The element-wise product of this vector and \\a other\n */\n \n /**\n- * \\fn Vector::operator*(T factor) const\n- * \\brief Multiply the vector by a scalar\n- * \\param[in] factor The factor\n- * \\return The vector multiplied by \\a factor\n+ * \\fn Vector::operator*(T scalar) const\n+ * \\brief Calculate the product of this vector and \\a scalar element-wise\n+ * \\param[in] scalar The scalar\n+ * \\return The element-wise product of this vector and \\a scalar\n */\n \n /**\n- * \\fn Vector::operator/()\n- * \\brief Divide the vector by a scalar\n- * \\param[in] factor The factor\n- * \\return The vector divided by \\a factor\n+ * \\fn Vector::operator/(const Vector &other) const\n+ * \\brief Calculate the quotient of this vector and \\a other element-wise\n+ * \\param[in] other The other vector\n+ * \\return The element-wise division of this vector by \\a other\n+ */\n+\n+/**\n+ * \\fn Vector::operator/(T scalar) const\n+ * \\brief Calculate the quotient of this vector and \\a scalar element-wise\n+ * \\param[in] scalar The scalar\n+ * \\return The element-wise division of this vector by \\a scalar\n */\n \n /**\ndiff --git a/src/ipa/libipa/vector.h b/src/ipa/libipa/vector.h\nindex 10e16d41aa8b..6e24cdcebec0 100644\n--- a/src/ipa/libipa/vector.h\n+++ b/src/ipa/libipa/vector.h\n@@ -72,24 +72,44 @@ public:\n \t\treturn ret;\n \t}\n \n-\tconstexpr Vector operator-(const Vector &other) const\n-\t{\n-\t\treturn apply(*this, other, std::minus<>{});\n-\t}\n-\n \tconstexpr Vector operator+(const Vector &other) const\n \t{\n \t\treturn apply(*this, other, std::plus<>{});\n \t}\n \n-\tconstexpr Vector operator*(T factor) const\n+\tconstexpr Vector operator+(T scalar) const\n \t{\n-\t\treturn apply(*this, factor, std::multiplies<>{});\n+\t\treturn apply(*this, scalar, std::plus<>{});\n \t}\n \n-\tconstexpr Vector operator/(T factor) const\n+\tconstexpr Vector operator-(const Vector &other) const\n \t{\n-\t\treturn apply(*this, factor, std::divides<>{});\n+\t\treturn apply(*this, other, std::minus<>{});\n+\t}\n+\n+\tconstexpr Vector operator-(T scalar) const\n+\t{\n+\t\treturn apply(*this, scalar, std::minus<>{});\n+\t}\n+\n+\tconstexpr Vector operator*(const Vector &other) const\n+\t{\n+\t\treturn apply(*this, other, std::multiplies<>{});\n+\t}\n+\n+\tconstexpr Vector operator*(T scalar) const\n+\t{\n+\t\treturn apply(*this, scalar, std::multiplies<>{});\n+\t}\n+\n+\tconstexpr Vector operator/(const Vector &other) const\n+\t{\n+\t\treturn apply(*this, other, std::divides<>{});\n+\t}\n+\n+\tconstexpr Vector operator/(T scalar) const\n+\t{\n+\t\treturn apply(*this, scalar, std::divides<>{});\n \t}\n \n \tconstexpr T dot(const Vector<T, Rows> &other) const\n", "prefixes": [ "v4", "07/17" ] }