From 1e67b96fb0b6b45b9b73dc2e13833efff5254ee1 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Thu, 3 Apr 2025 17:49:13 +0200 Subject: libcamera: vector: Extend matrix multiplication operator to heterogenous types It is useful to multiply matrices and vectors of heterogeneous types, for instance float and double. Extend the multiplication operator to support this, avoiding the need to convert one of the operations. The type of the returned vector is selected automatically to avoid loosing precision. Signed-off-by: Laurent Pinchart Signed-off-by: Stefan Klug Acked-by: Kieran Bingham Reviewed-by: Paul Elder --- src/libcamera/vector.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/libcamera/vector.cpp b/src/libcamera/vector.cpp index 5567d5b8..4dad1b90 100644 --- a/src/libcamera/vector.cpp +++ b/src/libcamera/vector.cpp @@ -308,9 +308,10 @@ LOG_DEFINE_CATEGORY(Vector) */ /** - * \fn Vector operator*(const Matrix &m, const Vector &v) + * \fn operator*(const Matrix &m, const Vector &v) * \brief Multiply a matrix by a vector - * \tparam T Numerical type of the contents of the matrix and vector + * \tparam T Numerical type of the contents of the matrix + * \tparam U Numerical type of the contents of the vector * \tparam Rows The number of rows in the matrix * \tparam Cols The number of columns in the matrix (= rows in the vector) * \param m The matrix -- cgit v1.2.1