diff --git a/include/libcamera/internal/vector.h b/include/libcamera/internal/vector.h index 4e9ef1ee6..16b6aef0b 100644 --- a/include/libcamera/internal/vector.h +++ b/include/libcamera/internal/vector.h @@ -13,6 +13,7 @@ #include #include #include +#include #include #include @@ -295,13 +296,13 @@ private: template using RGB = Vector; -template -Vector operator*(const Matrix &m, const Vector &v) +template +Vector, Rows> operator*(const Matrix &m, const Vector &v) { - Vector result; + Vector, Rows> result; for (unsigned int i = 0; i < Rows; i++) { - T sum = 0; + std::common_type_t sum = 0; for (unsigned int j = 0; j < Cols; j++) sum += m[i][j] * v[j]; result[i] = sum; diff --git a/src/libcamera/vector.cpp b/src/libcamera/vector.cpp index 5567d5b8d..4dad1b900 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