Multiplication was completely broken actually

This commit is contained in:
2025-02-06 21:56:54 -05:00
parent 9726ebbca0
commit 3b023d2104
2 changed files with 8 additions and 6 deletions

View File

@@ -111,8 +111,8 @@ Matrix<rows, columns>::Mult(const Matrix<columns, other_columns> &other,
{ {
// allocate some buffers for all of our dot products // allocate some buffers for all of our dot products
Matrix<1, columns> this_row; Matrix<1, columns> this_row;
Matrix<rows, 1> other_column; Matrix<columns, 1> other_column;
Matrix<1, rows> other_column_t; Matrix<1, columns> other_column_t;
for (uint8_t row_idx{0}; row_idx < rows; row_idx++) for (uint8_t row_idx{0}; row_idx < rows; row_idx++)
{ {
@@ -371,10 +371,11 @@ operator-(const Matrix<rows, columns> &other) const
} }
template <uint8_t rows, uint8_t columns> template <uint8_t rows, uint8_t columns>
Matrix<rows, columns> Matrix<rows, columns>:: template <uint8_t other_columns>
operator*(const Matrix<rows, columns> &other) const Matrix<rows, other_columns> Matrix<rows, columns>::
operator*(const Matrix<columns, other_columns> &other) const
{ {
Matrix<rows, columns> buffer{}; Matrix<rows, other_columns> buffer{};
this->Mult(other, buffer); this->Mult(other, buffer);
return buffer; return buffer;
} }

View File

@@ -181,7 +181,8 @@ public:
Matrix<rows, columns> operator-(const Matrix<rows, columns> &other) const; Matrix<rows, columns> operator-(const Matrix<rows, columns> &other) const;
Matrix<rows, columns> operator*(const Matrix<rows, columns> &other) const; template <uint8_t other_columns>
Matrix<rows, other_columns> operator*(const Matrix<columns, other_columns> &other) const;
Matrix<rows, columns> operator*(float scalar) const; Matrix<rows, columns> operator*(float scalar) const;