Added operations for floats

This commit is contained in:
Leto 2024-12-27 23:41:16 +01:00
parent 2d2d6afcfb
commit 91348e7c09

View File

@ -36,7 +36,10 @@ class Matrix{
inline Matrix operator+(const Matrix*);
inline Matrix operator-(const Matrix*);
inline Matrix operator*(const Matrix*);
// TODO : Add float parameters for these
inline Matrix operator+(float);
inline Matrix operator-(float);
inline Matrix operator*(float);
// Constructors
inline Matrix(int, int);
@ -59,6 +62,18 @@ Matrix Matrix::operator*(const Matrix* other){
return this->Multiply(other);
}
Matrix Matrix::operator+(float value){
return this->Add(value);
}
Matrix Matrix::operator-(float value){
return this->Substract(value);
}
Matrix Matrix::operator*(float value){
return this->Multiply(value);
}
// Constructs a zero matrix
Matrix::Matrix(int rows, int cols){
for(int m = 0; m < rows; m++){