-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
LiamSmego
committed
Mar 7, 2021
1 parent
985cb95
commit b27bfcd
Showing
2 changed files
with
44 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#ifndef __MATRIX_HH__ | ||
#define __MATRIX_HH__ | ||
|
||
#include <cstdbool> | ||
#include <cstdint> | ||
|
||
|
||
class Matrix | ||
{ | ||
public: | ||
int rows; | ||
int columns; | ||
float * values; | ||
|
||
Matrix(int row_number, int column_number, float * mat_values) | ||
{ | ||
rows=row_number; | ||
columns=column_number; | ||
values=mat_values; | ||
} | ||
|
||
float select(int row, int column) | ||
{ | ||
return values[(row-1)*columns+(column-1)]; | ||
} | ||
}; | ||
|
||
Matrix mMult(Matrix, Matrix); | ||
Matrix mAdd(Matrix, Matrix); | ||
Matrix sMult(Matrix, float); | ||
Matrix mSub(Matrix, Matrix); | ||
void display_matrix(Matrix); | ||
|
||
#endif // __MODING_HH__ |