PEC-CSS / slowmokit

Library which can be used for machine learning in C++.
https://pec-css.github.io/slowmokit/
GNU General Public License v2.0
17 stars 16 forks source link

Resolved Issue #64 #79

Closed Modernbeast02 closed 1 year ago

Modernbeast02 commented 1 year ago

Implemented addition, subtraction, and multiplication of a matrix with a scaler. Resolved Issue #64

Ishwarendra commented 1 year ago

Hi @Modernbeast02, Do the following changes:

Right way to overload operator+ are ```cpp template Matrix operator+(G num, const Matrix &matrix) { Matrix res = matrix; res += num; return res; } template Matrix operator+(const Matrix &matrix, G num) { Matrix res = matrix; res += num; return res; } ```
Code for operator* as shown ```cpp template Matrix operator*(Matrix matrix, const G &num) { matrix *= num; return matrix; } ```