forked from leto/LeMA
Added operator = overload
This commit is contained in:
38
matrices.h
38
matrices.h
@@ -1,6 +1,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <cassert>
|
||||
#include <iostream>
|
||||
|
||||
#define assertm(exp, msg) assert((void(msg), exp))
|
||||
|
||||
@@ -8,31 +9,40 @@ class Matrix{
|
||||
private:
|
||||
std::vector<std::vector<float>> values;
|
||||
public:
|
||||
void Randomize();
|
||||
void Randomize(float, float);
|
||||
inline void Randomize();
|
||||
inline void Randomize(float, float);
|
||||
|
||||
void Set(float);
|
||||
inline void Set(float);
|
||||
|
||||
void Multiply(float);
|
||||
Matrix Multiply(Matrix*);
|
||||
inline void Multiply(float);
|
||||
inline Matrix Multiply(Matrix*);
|
||||
|
||||
void Hadamard(Matrix*);
|
||||
inline void Hadamard(Matrix*);
|
||||
|
||||
void Add(float);
|
||||
void Add(Matrix*);
|
||||
inline void Add(float);
|
||||
inline void Add(Matrix*);
|
||||
|
||||
void Substract(float);
|
||||
void Substract(Matrix*);
|
||||
inline void Substract(float);
|
||||
inline void Substract(Matrix*);
|
||||
|
||||
void Print(std::string_view);
|
||||
inline void Print(std::string_view);
|
||||
|
||||
void Transpose();
|
||||
inline void Transpose();
|
||||
|
||||
// --- Operators
|
||||
// Assign
|
||||
inline Matrix operator=(const Matrix*);
|
||||
|
||||
// Constructors
|
||||
Matrix(int, int);
|
||||
Matrix(Matrix*);
|
||||
inline Matrix(int, int);
|
||||
inline Matrix(Matrix*);
|
||||
};
|
||||
|
||||
Matrix Matrix::operator=(const Matrix* other){
|
||||
this->values = other->values;
|
||||
return *this;
|
||||
}
|
||||
|
||||
// Constructs a zero matrix
|
||||
Matrix::Matrix(int rows, int cols){
|
||||
for(int m = 0; m < rows; m++){
|
||||
|
||||
Reference in New Issue
Block a user