Compare commits

...

2 Commits

Author SHA1 Message Date
28944bd871 added createMatrix() + matrix data type 2025-11-11 11:15:40 +01:00
29b2966c63 defined struct matrix 2025-11-11 09:54:31 +01:00
2 changed files with 9 additions and 2 deletions

View File

@ -6,12 +6,13 @@
Matrix createMatrix(unsigned int rows, unsigned int cols) Matrix createMatrix(unsigned int rows, unsigned int cols)
{ {
MatrixType* data = malloc(rows * cols * sizeof(MatrixType));
Matrix newMatrix = {rows, cols, data};
return newMatrix;
} }
void clearMatrix(Matrix *matrix) void clearMatrix(Matrix *matrix)
{ {
} }
void setMatrixAt(MatrixType value, Matrix matrix, unsigned int rowIdx, unsigned int colIdx) void setMatrixAt(MatrixType value, Matrix matrix, unsigned int rowIdx, unsigned int colIdx)

View File

@ -6,6 +6,12 @@
typedef float MatrixType; typedef float MatrixType;
// TODO Matrixtyp definieren // TODO Matrixtyp definieren
typedef struct
{
unsigned int rows;
unsigned int cols;
MatrixType *data;
} Matrix;
Matrix createMatrix(unsigned int rows, unsigned int cols); Matrix createMatrix(unsigned int rows, unsigned int cols);