[{"id":33329,"web_url":"https://patchwork.libcamera.org/comment/33329/","msgid":"<173926719004.2293020.5964948490561635843@ping.linuxembedded.co.uk>","date":"2025-02-11T09:46:30","subject":"Re: [PATCH 4/4] libipa: Drop Vector class","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Stefan Klug (2025-02-06 14:10:11)\n> The Vector class from libipa is not used anymore. Drop it.\n> \n> Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n\n\nAcked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n> ---\n>  src/ipa/libipa/meson.build  |   2 -\n>  src/ipa/libipa/vector.cpp   | 351 ----------------------------------\n>  src/ipa/libipa/vector.h     | 370 ------------------------------------\n>  test/ipa/libipa/meson.build |   1 -\n>  test/ipa/libipa/vector.cpp  | 100 ----------\n>  5 files changed, 824 deletions(-)\n>  delete mode 100644 src/ipa/libipa/vector.cpp\n>  delete mode 100644 src/ipa/libipa/vector.h\n>  delete mode 100644 test/ipa/libipa/vector.cpp\n> \n> diff --git a/src/ipa/libipa/meson.build b/src/ipa/libipa/meson.build\n> index f2b2f4be50db..12d8d15bf52a 100644\n> --- a/src/ipa/libipa/meson.build\n> +++ b/src/ipa/libipa/meson.build\n> @@ -14,7 +14,6 @@ libipa_headers = files([\n>      'lux.h',\n>      'module.h',\n>      'pwl.h',\n> -    'vector.h',\n>  ])\n>  \n>  libipa_sources = files([\n> @@ -31,7 +30,6 @@ libipa_sources = files([\n>      'lux.cpp',\n>      'module.cpp',\n>      'pwl.cpp',\n> -    'vector.cpp',\n>  ])\n>  \n>  libipa_includes = include_directories('..')\n> diff --git a/src/ipa/libipa/vector.cpp b/src/ipa/libipa/vector.cpp\n> deleted file mode 100644\n> index 8019f8cfdc85..000000000000\n> --- a/src/ipa/libipa/vector.cpp\n> +++ /dev/null\n> @@ -1,351 +0,0 @@\n> -/* SPDX-License-Identifier: LGPL-2.1-or-later */\n> -/*\n> - * Copyright (C) 2024, Paul Elder <paul.elder@ideasonboard.com>\n> - *\n> - * Vector and related operations\n> - */\n> -\n> -#include \"vector.h\"\n> -\n> -#include <libcamera/base/log.h>\n> -\n> -/**\n> - * \\file vector.h\n> - * \\brief Vector class\n> - */\n> -\n> -namespace libcamera {\n> -\n> -LOG_DEFINE_CATEGORY(Vector)\n> -\n> -namespace ipa {\n> -\n> -/**\n> - * \\class Vector\n> - * \\brief Vector class\n> - * \\tparam T Type of numerical values to be stored in the vector\n> - * \\tparam Rows Number of dimension of the vector (= number of elements)\n> - */\n> -\n> -/**\n> - * \\fn Vector::Vector()\n> - * \\brief Construct an uninitialized vector\n> - */\n> -\n> -/**\n> - * \\fn Vector::Vector(T scalar)\n> - * \\brief Construct a vector filled with a \\a scalar value\n> - * \\param[in] scalar The scalar value\n> - */\n> -\n> -/**\n> - * \\fn Vector::Vector(const std::array<T, Rows> &data)\n> - * \\brief Construct vector from supplied data\n> - * \\param data Data from which to construct a vector\n> - *\n> - * The size of \\a data must be equal to the dimension size Rows of the vector.\n> - */\n> -\n> -/**\n> - * \\fn T Vector::operator[](size_t i) const\n> - * \\brief Index to an element in the vector\n> - * \\param i Index of element to retrieve\n> - * \\return Element at index \\a i from the vector\n> - */\n> -\n> -/**\n> - * \\fn T &Vector::operator[](size_t i)\n> - * \\copydoc Vector::operator[](size_t i) const\n> - */\n> -\n> -/**\n> - * \\fn Vector::operator-() const\n> - * \\brief Negate a Vector by negating both all of its coordinates\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 Calculate the difference of this vector and \\a other element-wise\n> - * \\param[in] other The other vector\n> - * \\return The element-wise subtraction of \\a other from this vector\n> - */\n> -\n> -/**\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 element-wise product of this vector and \\a other\n> - */\n> -\n> -/**\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/(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> -/**\n> - * \\fn Vector::operator+=(Vector const &other)\n> - * \\brief Add \\a other element-wise to this vector\n> - * \\param[in] other The other vector\n> - * \\return This vector\n> - */\n> -\n> -/**\n> - * \\fn Vector::operator+=(T scalar)\n> - * \\brief Add \\a scalar element-wise to this vector\n> - * \\param[in] scalar The scalar\n> - * \\return This vector\n> - */\n> -\n> -/**\n> - * \\fn Vector::operator-=(Vector const &other)\n> - * \\brief Subtract \\a other element-wise from this vector\n> - * \\param[in] other The other vector\n> - * \\return This vector\n> - */\n> -\n> -/**\n> - * \\fn Vector::operator-=(T scalar)\n> - * \\brief Subtract \\a scalar element-wise from this vector\n> - * \\param[in] scalar The scalar\n> - * \\return This vector\n> - */\n> -\n> -/**\n> - * \\fn Vector::operator*=(const Vector &other)\n> - * \\brief Multiply this vector by \\a other element-wise\n> - * \\param[in] other The other vector\n> - * \\return This vector\n> - */\n> -\n> -/**\n> - * \\fn Vector::operator*=(T scalar)\n> - * \\brief Multiply this vector by \\a scalar element-wise\n> - * \\param[in] scalar The scalar\n> - * \\return This vector\n> - */\n> -\n> -/**\n> - * \\fn Vector::operator/=(const Vector &other)\n> - * \\brief Divide this vector by \\a other element-wise\n> - * \\param[in] other The other vector\n> - * \\return This vector\n> - */\n> -\n> -/**\n> - * \\fn Vector::operator/=(T scalar)\n> - * \\brief Divide this vector by \\a scalar element-wise\n> - * \\param[in] scalar The scalar\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\n> - * \\param[in] other The other vector\n> - * \\return The dot product of the two vectors\n> - */\n> -\n> -/**\n> - * \\fn constexpr T &Vector::x()\n> - * \\brief Convenience function to access the first element of the vector\n> - * \\return The first element of the vector\n> - */\n> -\n> -/**\n> - * \\fn constexpr T &Vector::y()\n> - * \\brief Convenience function to access the second element of the vector\n> - * \\return The second element of the vector\n> - */\n> -\n> -/**\n> - * \\fn constexpr T &Vector::z()\n> - * \\brief Convenience function to access the third element of the vector\n> - * \\return The third element of the vector\n> - */\n> -\n> -/**\n> - * \\fn constexpr const T &Vector::x() const\n> - * \\copydoc Vector::x()\n> - */\n> -\n> -/**\n> - * \\fn constexpr const T &Vector::y() const\n> - * \\copydoc Vector::y()\n> - */\n> -\n> -/**\n> - * \\fn constexpr const T &Vector::z() const\n> - * \\copydoc Vector::z()\n> - */\n> -\n> -/**\n> - * \\fn constexpr T &Vector::r()\n> - * \\brief Convenience function to access the first element of the vector\n> - * \\return The first element of the vector\n> - */\n> -\n> -/**\n> - * \\fn constexpr T &Vector::g()\n> - * \\brief Convenience function to access the second element of the vector\n> - * \\return The second element of the vector\n> - */\n> -\n> -/**\n> - * \\fn constexpr T &Vector::b()\n> - * \\brief Convenience function to access the third element of the vector\n> - * \\return The third element of the vector\n> - */\n> -\n> -/**\n> - * \\fn constexpr const T &Vector::r() const\n> - * \\copydoc Vector::r()\n> - */\n> -\n> -/**\n> - * \\fn constexpr const T &Vector::g() const\n> - * \\copydoc Vector::g()\n> - */\n> -\n> -/**\n> - * \\fn constexpr const T &Vector::b() const\n> - * \\copydoc Vector::b()\n> - */\n> -\n> -/**\n> - * \\fn Vector::length2()\n> - * \\brief Get the squared length of the vector\n> - * \\return The squared length of the vector\n> - */\n> -\n> -/**\n> - * \\fn Vector::length()\n> - * \\brief Get the length of the vector\n> - * \\return The length of the vector\n> - */\n> -\n> -/**\n> - * \\fn Vector::sum() const\n> - * \\brief Calculate the sum of all the vector elements\n> - * \\tparam R The type of the sum\n> - *\n> - * The type R of the sum defaults to the type T of the elements, but can be set\n> - * explicitly to use a different type in case the type T would risk\n> - * overflowing.\n> - *\n> - * \\return The sum of all the vector elements\n> - */\n> -\n> -/**\n> - * \\fn Vector<T, Rows> operator*(const Matrix<T, Rows, Cols> &m, const Vector<T, Cols> &v)\n> - * \\brief Multiply a matrix by a vector\n> - * \\tparam T Numerical type of the contents of the matrix and vector\n> - * \\tparam Rows The number of rows in the matrix\n> - * \\tparam Cols The number of columns in the matrix (= rows in the vector)\n> - * \\param m The matrix\n> - * \\param v The vector\n> - * \\return Product of matrix \\a m and vector \\a v\n> - */\n> -\n> -/**\n> - * \\typedef RGB\n> - * \\brief A Vector of 3 elements representing an RGB pixel value\n> - */\n> -\n> -/**\n> - * \\fn bool operator==(const Vector<T, Rows> &lhs, const Vector<T, Rows> &rhs)\n> - * \\brief Compare vectors for equality\n> - * \\return True if the two vectors are equal, false otherwise\n> - */\n> -\n> -/**\n> - * \\fn bool operator!=(const Vector<T, Rows> &lhs, const Vector<T, Rows> &rhs)\n> - * \\brief Compare vectors for inequality\n> - * \\return True if the two vectors are not equal, false otherwise\n> - */\n> -\n> -#ifndef __DOXYGEN__\n> -bool vectorValidateYaml(const YamlObject &obj, unsigned int size)\n> -{\n> -       if (!obj.isList())\n> -               return false;\n> -\n> -       if (obj.size() != size) {\n> -               LOG(Vector, Error)\n> -                       << \"Wrong number of values in YAML vector: expected \"\n> -                       << size << \", got \" << obj.size();\n> -               return false;\n> -       }\n> -\n> -       return true;\n> -}\n> -#endif /* __DOXYGEN__ */\n> -\n> -} /* namespace ipa */\n> -\n> -} /* namespace libcamera */\n> diff --git a/src/ipa/libipa/vector.h b/src/ipa/libipa/vector.h\n> deleted file mode 100644\n> index fe33c9d6fbd1..000000000000\n> --- a/src/ipa/libipa/vector.h\n> +++ /dev/null\n> @@ -1,370 +0,0 @@\n> -/* SPDX-License-Identifier: LGPL-2.1-or-later */\n> -/*\n> - * Copyright (C) 2024, Paul Elder <paul.elder@ideasonboard.com>\n> - *\n> - * Vector and related operations\n> - */\n> -#pragma once\n> -\n> -#include <algorithm>\n> -#include <array>\n> -#include <cmath>\n> -#include <functional>\n> -#include <numeric>\n> -#include <optional>\n> -#include <ostream>\n> -\n> -#include <libcamera/base/log.h>\n> -#include <libcamera/base/span.h>\n> -\n> -#include \"libcamera/internal/matrix.h\"\n> -#include \"libcamera/internal/yaml_parser.h\"\n> -\n> -namespace libcamera {\n> -\n> -LOG_DECLARE_CATEGORY(Vector)\n> -\n> -namespace ipa {\n> -\n> -#ifndef __DOXYGEN__\n> -template<typename T, unsigned int Rows,\n> -        std::enable_if_t<std::is_arithmetic_v<T>> * = nullptr>\n> -#else\n> -template<typename T, unsigned int Rows>\n> -#endif /* __DOXYGEN__ */\n> -class Vector\n> -{\n> -public:\n> -       constexpr Vector() = default;\n> -\n> -       constexpr explicit Vector(T scalar)\n> -       {\n> -               data_.fill(scalar);\n> -       }\n> -\n> -       constexpr Vector(const std::array<T, Rows> &data)\n> -       {\n> -               for (unsigned int i = 0; i < Rows; i++)\n> -                       data_[i] = data[i];\n> -       }\n> -\n> -       const T &operator[](size_t i) const\n> -       {\n> -               ASSERT(i < data_.size());\n> -               return data_[i];\n> -       }\n> -\n> -       T &operator[](size_t i)\n> -       {\n> -               ASSERT(i < data_.size());\n> -               return data_[i];\n> -       }\n> -\n> -       constexpr Vector<T, Rows> operator-() const\n> -       {\n> -               Vector<T, Rows> ret;\n> -               for (unsigned int i = 0; i < Rows; i++)\n> -                       ret[i] = -data_[i];\n> -               return ret;\n> -       }\n> -\n> -       constexpr Vector operator+(const Vector &other) const\n> -       {\n> -               return apply(*this, other, std::plus<>{});\n> -       }\n> -\n> -       constexpr Vector operator+(T scalar) const\n> -       {\n> -               return apply(*this, scalar, std::plus<>{});\n> -       }\n> -\n> -       constexpr Vector operator-(const Vector &other) const\n> -       {\n> -               return apply(*this, other, std::minus<>{});\n> -       }\n> -\n> -       constexpr Vector operator-(T scalar) const\n> -       {\n> -               return apply(*this, scalar, std::minus<>{});\n> -       }\n> -\n> -       constexpr Vector operator*(const Vector &other) const\n> -       {\n> -               return apply(*this, other, std::multiplies<>{});\n> -       }\n> -\n> -       constexpr Vector operator*(T scalar) const\n> -       {\n> -               return apply(*this, scalar, std::multiplies<>{});\n> -       }\n> -\n> -       constexpr Vector operator/(const Vector &other) const\n> -       {\n> -               return apply(*this, other, std::divides<>{});\n> -       }\n> -\n> -       constexpr Vector operator/(T scalar) const\n> -       {\n> -               return apply(*this, scalar, std::divides<>{});\n> -       }\n> -\n> -       Vector &operator+=(const Vector &other)\n> -       {\n> -               return apply(other, [](T a, T b) { return a + b; });\n> -       }\n> -\n> -       Vector &operator+=(T scalar)\n> -       {\n> -               return apply(scalar, [](T a, T b) { return a + b; });\n> -       }\n> -\n> -       Vector &operator-=(const Vector &other)\n> -       {\n> -               return apply(other, [](T a, T b) { return a - b; });\n> -       }\n> -\n> -       Vector &operator-=(T scalar)\n> -       {\n> -               return apply(scalar, [](T a, T b) { return a - b; });\n> -       }\n> -\n> -       Vector &operator*=(const Vector &other)\n> -       {\n> -               return apply(other, [](T a, T b) { return a * b; });\n> -       }\n> -\n> -       Vector &operator*=(T scalar)\n> -       {\n> -               return apply(scalar, [](T a, T b) { return a * b; });\n> -       }\n> -\n> -       Vector &operator/=(const Vector &other)\n> -       {\n> -               return apply(other, [](T a, T b) { return a / b; });\n> -       }\n> -\n> -       Vector &operator/=(T scalar)\n> -       {\n> -               return apply(scalar, [](T a, T b) { return a / b; });\n> -       }\n> -\n> -       constexpr Vector min(const Vector &other) const\n> -       {\n> -               return apply(*this, other, [](T a, T b) { return std::min(a, b); });\n> -       }\n> -\n> -       constexpr Vector min(T scalar) const\n> -       {\n> -               return apply(*this, scalar, [](T a, T b) { return std::min(a, b); });\n> -       }\n> -\n> -       constexpr Vector max(const Vector &other) const\n> -       {\n> -               return apply(*this, other, [](T a, T b) { return std::max(a, b); });\n> -       }\n> -\n> -       constexpr Vector max(T scalar) const\n> -       {\n> -               return apply(*this, scalar, [](T a, T b) -> T { return std::max(a, b); });\n> -       }\n> -\n> -       constexpr T dot(const Vector<T, Rows> &other) const\n> -       {\n> -               T ret = 0;\n> -               for (unsigned int i = 0; i < Rows; i++)\n> -                       ret += data_[i] * other[i];\n> -               return ret;\n> -       }\n> -\n> -#ifndef __DOXYGEN__\n> -       template<bool Dependent = false, typename = std::enable_if_t<Dependent || Rows >= 1>>\n> -#endif /* __DOXYGEN__ */\n> -       constexpr const T &x() const { return data_[0]; }\n> -#ifndef __DOXYGEN__\n> -       template<bool Dependent = false, typename = std::enable_if_t<Dependent || Rows >= 2>>\n> -#endif /* __DOXYGEN__ */\n> -       constexpr const T &y() const { return data_[1]; }\n> -#ifndef __DOXYGEN__\n> -       template<bool Dependent = false, typename = std::enable_if_t<Dependent || Rows >= 3>>\n> -#endif /* __DOXYGEN__ */\n> -       constexpr const T &z() const { return data_[2]; }\n> -#ifndef __DOXYGEN__\n> -       template<bool Dependent = false, typename = std::enable_if_t<Dependent || Rows >= 1>>\n> -#endif /* __DOXYGEN__ */\n> -       constexpr T &x() { return data_[0]; }\n> -#ifndef __DOXYGEN__\n> -       template<bool Dependent = false, typename = std::enable_if_t<Dependent || Rows >= 2>>\n> -#endif /* __DOXYGEN__ */\n> -       constexpr T &y() { return data_[1]; }\n> -#ifndef __DOXYGEN__\n> -       template<bool Dependent = false, typename = std::enable_if_t<Dependent || Rows >= 3>>\n> -#endif /* __DOXYGEN__ */\n> -       constexpr T &z() { return data_[2]; }\n> -\n> -#ifndef __DOXYGEN__\n> -       template<bool Dependent = false, typename = std::enable_if_t<Dependent || Rows >= 1>>\n> -#endif /* __DOXYGEN__ */\n> -       constexpr const T &r() const { return data_[0]; }\n> -#ifndef __DOXYGEN__\n> -       template<bool Dependent = false, typename = std::enable_if_t<Dependent || Rows >= 2>>\n> -#endif /* __DOXYGEN__ */\n> -       constexpr const T &g() const { return data_[1]; }\n> -#ifndef __DOXYGEN__\n> -       template<bool Dependent = false, typename = std::enable_if_t<Dependent || Rows >= 3>>\n> -#endif /* __DOXYGEN__ */\n> -       constexpr const T &b() const { return data_[2]; }\n> -#ifndef __DOXYGEN__\n> -       template<bool Dependent = false, typename = std::enable_if_t<Dependent || Rows >= 1>>\n> -#endif /* __DOXYGEN__ */\n> -       constexpr T &r() { return data_[0]; }\n> -#ifndef __DOXYGEN__\n> -       template<bool Dependent = false, typename = std::enable_if_t<Dependent || Rows >= 2>>\n> -#endif /* __DOXYGEN__ */\n> -       constexpr T &g() { return data_[1]; }\n> -#ifndef __DOXYGEN__\n> -       template<bool Dependent = false, typename = std::enable_if_t<Dependent || Rows >= 3>>\n> -#endif /* __DOXYGEN__ */\n> -       constexpr T &b() { return data_[2]; }\n> -\n> -       constexpr double length2() const\n> -       {\n> -               double ret = 0;\n> -               for (unsigned int i = 0; i < Rows; i++)\n> -                       ret += data_[i] * data_[i];\n> -               return ret;\n> -       }\n> -\n> -       constexpr double length() const\n> -       {\n> -               return std::sqrt(length2());\n> -       }\n> -\n> -       template<typename R = T>\n> -       constexpr R sum() const\n> -       {\n> -               return std::accumulate(data_.begin(), data_.end(), R{});\n> -       }\n> -\n> -private:\n> -       template<class BinaryOp>\n> -       static constexpr Vector apply(const Vector &lhs, const Vector &rhs, BinaryOp op)\n> -       {\n> -               Vector result;\n> -               std::transform(lhs.data_.begin(), lhs.data_.end(),\n> -                              rhs.data_.begin(), result.data_.begin(),\n> -                              op);\n> -\n> -               return result;\n> -       }\n> -\n> -       template<class BinaryOp>\n> -       static constexpr Vector apply(const Vector &lhs, T rhs, BinaryOp op)\n> -       {\n> -               Vector result;\n> -               std::transform(lhs.data_.begin(), lhs.data_.end(),\n> -                              result.data_.begin(),\n> -                              [&op, rhs](T v) { return op(v, rhs); });\n> -\n> -               return result;\n> -       }\n> -\n> -       template<class BinaryOp>\n> -       Vector &apply(const Vector &other, BinaryOp op)\n> -       {\n> -               auto itOther = other.data_.begin();\n> -               std::for_each(data_.begin(), data_.end(),\n> -                             [&op, &itOther](T &v) { v = op(v, *itOther++); });\n> -\n> -               return *this;\n> -       }\n> -\n> -       template<class BinaryOp>\n> -       Vector &apply(T scalar, BinaryOp op)\n> -       {\n> -               std::for_each(data_.begin(), data_.end(),\n> -                             [&op, scalar](T &v) { v = op(v, scalar); });\n> -\n> -               return *this;\n> -       }\n> -\n> -       std::array<T, Rows> data_;\n> -};\n> -\n> -template<typename T>\n> -using RGB = Vector<T, 3>;\n> -\n> -template<typename T, unsigned int Rows, unsigned int Cols>\n> -Vector<T, Rows> operator*(const Matrix<T, Rows, Cols> &m, const Vector<T, Cols> &v)\n> -{\n> -       Vector<T, Rows> result;\n> -\n> -       for (unsigned int i = 0; i < Rows; i++) {\n> -               T sum = 0;\n> -               for (unsigned int j = 0; j < Cols; j++)\n> -                       sum += m[i][j] * v[j];\n> -               result[i] = sum;\n> -       }\n> -\n> -       return result;\n> -}\n> -\n> -template<typename T, unsigned int Rows>\n> -bool operator==(const Vector<T, Rows> &lhs, const Vector<T, Rows> &rhs)\n> -{\n> -       for (unsigned int i = 0; i < Rows; i++) {\n> -               if (lhs[i] != rhs[i])\n> -                       return false;\n> -       }\n> -\n> -       return true;\n> -}\n> -\n> -template<typename T, unsigned int Rows>\n> -bool operator!=(const Vector<T, Rows> &lhs, const Vector<T, Rows> &rhs)\n> -{\n> -       return !(lhs == rhs);\n> -}\n> -\n> -#ifndef __DOXYGEN__\n> -bool vectorValidateYaml(const YamlObject &obj, unsigned int size);\n> -#endif /* __DOXYGEN__ */\n> -\n> -} /* namespace ipa */\n> -\n> -#ifndef __DOXYGEN__\n> -template<typename T, unsigned int Rows>\n> -std::ostream &operator<<(std::ostream &out, const ipa::Vector<T, Rows> &v)\n> -{\n> -       out << \"Vector { \";\n> -       for (unsigned int i = 0; i < Rows; i++) {\n> -               out << v[i];\n> -               out << ((i + 1 < Rows) ? \", \" : \" \");\n> -       }\n> -       out << \" }\";\n> -\n> -       return out;\n> -}\n> -\n> -template<typename T, unsigned int Rows>\n> -struct YamlObject::Getter<ipa::Vector<T, Rows>> {\n> -       std::optional<ipa::Vector<T, Rows>> get(const YamlObject &obj) const\n> -       {\n> -               if (!ipa::vectorValidateYaml(obj, Rows))\n> -                       return std::nullopt;\n> -\n> -               ipa::Vector<T, Rows> vector;\n> -\n> -               unsigned int i = 0;\n> -               for (const YamlObject &entry : obj.asList()) {\n> -                       const auto value = entry.get<T>();\n> -                       if (!value)\n> -                               return std::nullopt;\n> -                       vector[i++] = *value;\n> -               }\n> -\n> -               return vector;\n> -       }\n> -};\n> -#endif /* __DOXYGEN__ */\n> -\n> -} /* namespace libcamera */\n> diff --git a/test/ipa/libipa/meson.build b/test/ipa/libipa/meson.build\n> index 0f4155d25b0c..eaf4b49a187c 100644\n> --- a/test/ipa/libipa/meson.build\n> +++ b/test/ipa/libipa/meson.build\n> @@ -3,7 +3,6 @@\n>  libipa_test = [\n>      {'name': 'fixedpoint', 'sources': ['fixedpoint.cpp']},\n>      {'name': 'interpolator', 'sources': ['interpolator.cpp']},\n> -    {'name': 'vector', 'sources': ['vector.cpp']},\n>  ]\n>  \n>  foreach test : libipa_test\n> diff --git a/test/ipa/libipa/vector.cpp b/test/ipa/libipa/vector.cpp\n> deleted file mode 100644\n> index 8e4ec77d7820..000000000000\n> --- a/test/ipa/libipa/vector.cpp\n> +++ /dev/null\n> @@ -1,100 +0,0 @@\n> -/* SPDX-License-Identifier: GPL-2.0-or-later */\n> -/*\n> - * Copyright (C) 2024, Ideas on Board Oy\n> - *\n> - * Vector tests\n> - */\n> -\n> -#include \"../src/ipa/libipa/vector.h\"\n> -\n> -#include <cmath>\n> -#include <iostream>\n> -\n> -#include \"test.h\"\n> -\n> -using namespace libcamera::ipa;\n> -\n> -#define ASSERT_EQ(a, b)                                                        \\\n> -if ((a) != (b)) {                                                      \\\n> -       std::cout << #a \" != \" #b << \" (line \" << __LINE__ << \")\"       \\\n> -                 << std::endl;                                         \\\n> -       return TestFail;                                                \\\n> -}\n> -\n> -class VectorTest : public Test\n> -{\n> -protected:\n> -       int run()\n> -       {\n> -               Vector<double, 3> v1{ 0.0 };\n> -\n> -               ASSERT_EQ(v1[0], 0.0);\n> -               ASSERT_EQ(v1[1], 0.0);\n> -               ASSERT_EQ(v1[2], 0.0);\n> -\n> -               ASSERT_EQ(v1.length(), 0.0);\n> -               ASSERT_EQ(v1.length2(), 0.0);\n> -\n> -               Vector<double, 3> v2{{ 1.0, 4.0, 8.0 }};\n> -\n> -               ASSERT_EQ(v2[0], 1.0);\n> -               ASSERT_EQ(v2[1], 4.0);\n> -               ASSERT_EQ(v2[2], 8.0);\n> -\n> -               ASSERT_EQ(v2.x(), 1.0);\n> -               ASSERT_EQ(v2.y(), 4.0);\n> -               ASSERT_EQ(v2.z(), 8.0);\n> -\n> -               ASSERT_EQ(v2.r(), 1.0);\n> -               ASSERT_EQ(v2.g(), 4.0);\n> -               ASSERT_EQ(v2.b(), 8.0);\n> -\n> -               ASSERT_EQ(v2.length2(), 81.0);\n> -               ASSERT_EQ(v2.length(), 9.0);\n> -               ASSERT_EQ(v2.sum(), 13.0);\n> -\n> -               Vector<double, 3> v3{ v2 };\n> -\n> -               ASSERT_EQ(v2, v3);\n> -\n> -               v3 = Vector<double, 3>{{ 4.0, 4.0, 4.0 }};\n> -\n> -               ASSERT_EQ(v2 + v3, (Vector<double, 3>{{ 5.0, 8.0, 12.0 }}));\n> -               ASSERT_EQ(v2 + 4.0, (Vector<double, 3>{{ 5.0, 8.0, 12.0 }}));\n> -               ASSERT_EQ(v2 - v3, (Vector<double, 3>{{ -3.0, 0.0, 4.0 }}));\n> -               ASSERT_EQ(v2 - 4.0, (Vector<double, 3>{{ -3.0, 0.0, 4.0 }}));\n> -               ASSERT_EQ(v2 * v3, (Vector<double, 3>{{ 4.0, 16.0, 32.0 }}));\n> -               ASSERT_EQ(v2 * 4.0, (Vector<double, 3>{{ 4.0, 16.0, 32.0 }}));\n> -               ASSERT_EQ(v2 / v3, (Vector<double, 3>{{ 0.25, 1.0, 2.0 }}));\n> -               ASSERT_EQ(v2 / 4.0, (Vector<double, 3>{{ 0.25, 1.0, 2.0 }}));\n> -\n> -               ASSERT_EQ(v2.min(v3), (Vector<double, 3>{{ 1.0, 4.0, 4.0 }}));\n> -               ASSERT_EQ(v2.min(4.0), (Vector<double, 3>{{ 1.0, 4.0, 4.0 }}));\n> -               ASSERT_EQ(v2.max(v3), (Vector<double, 3>{{ 4.0, 4.0, 8.0 }}));\n> -               ASSERT_EQ(v2.max(4.0), (Vector<double, 3>{{ 4.0, 4.0, 8.0 }}));\n> -\n> -               ASSERT_EQ(v2.dot(v3), 52.0);\n> -\n> -               v2 += v3;\n> -               ASSERT_EQ(v2, (Vector<double, 3>{{ 5.0, 8.0, 12.0 }}));\n> -               v2 -= v3;\n> -               ASSERT_EQ(v2, (Vector<double, 3>{{ 1.0, 4.0, 8.0 }}));\n> -               v2 *= v3;\n> -               ASSERT_EQ(v2, (Vector<double, 3>{{ 4.0, 16.0, 32.0 }}));\n> -               v2 /= v3;\n> -               ASSERT_EQ(v2, (Vector<double, 3>{{ 1.0, 4.0, 8.0 }}));\n> -\n> -               v2 += 4.0;\n> -               ASSERT_EQ(v2, (Vector<double, 3>{{ 5.0, 8.0, 12.0 }}));\n> -               v2 -= 4.0;\n> -               ASSERT_EQ(v2, (Vector<double, 3>{{ 1.0, 4.0, 8.0 }}));\n> -               v2 *= 4.0;\n> -               ASSERT_EQ(v2, (Vector<double, 3>{{ 4.0, 16.0, 32.0 }}));\n> -               v2 /= 4.0;\n> -               ASSERT_EQ(v2, (Vector<double, 3>{{ 1.0, 4.0, 8.0 }}));\n> -\n> -               return TestPass;\n> -       }\n> -};\n> -\n> -TEST_REGISTER(VectorTest)\n> -- \n> 2.43.0\n>","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 69609BD1F1\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 11 Feb 2025 09:46:35 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 159DD68623;\n\tTue, 11 Feb 2025 10:46:35 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A42AE6861B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 11 Feb 2025 10:46:32 +0100 (CET)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id AC0A52B3;\n\tTue, 11 Feb 2025 10:45:15 +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=\"RP0H9VEf\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1739267115;\n\tbh=6RVi22BIEhoeIwPdkKgBJROTBytGv8v3G0cdZDPsruE=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=RP0H9VEfQh8Gddp2wTvwD5OlNKBbv7H1WBgxmPRVCz3uZlXy5+LDMjZYNdTYPuuXt\n\tnVwo2lqXM7UOrhVDPy8/b170NHAx3V8VqK5IiTS5FbJpM6QzDoU1g03KwisXSchuSu\n\tMwIA7DXg/lIFU5PvAsUPr2yivdnyOuD8djfDYPMA=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20250206141018.236272-5-stefan.klug@ideasonboard.com>","References":"<20250206141018.236272-1-stefan.klug@ideasonboard.com>\n\t<20250206141018.236272-5-stefan.klug@ideasonboard.com>","Subject":"Re: [PATCH 4/4] libipa: Drop Vector class","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"Stefan Klug <stefan.klug@ideasonboard.com>","To":"Stefan Klug <stefan.klug@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Tue, 11 Feb 2025 09:46:30 +0000","Message-ID":"<173926719004.2293020.5964948490561635843@ping.linuxembedded.co.uk>","User-Agent":"alot/0.10","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>"}}]