NeuronalesNetz/matrix.h
2025-11-16 18:46:46 +01:00

28 lines
860 B
C

#ifndef MATRIX_H
#define MATRIX_H
#define UNDEFINED_MATRIX_VALUE 0
typedef float MatrixType;
// TODO Matrixtyp definieren
typedef struct{
unsigned int rows;
unsigned int cols;
MatrixType *buffer; //Data wird in einem eindimensionalen Array gespeichert (Spalten und Reihen liegen ja im Speicher hintereinannder)
} Matrix;
Matrix createMatrix(unsigned int rows, unsigned int cols);
void clearMatrix(Matrix *matrix);
void setMatrixAt(MatrixType value, Matrix matrix, unsigned int rowIdx, unsigned int colIdx);
MatrixType getMatrixAt(const Matrix matrix, unsigned int rowIdx, unsigned int colIdx);
Matrix add(const Matrix matrix1, const Matrix matrix2);
Matrix broadcasting(const Matrix matrix1, const Matrix matrix2);
Matrix multiply(const Matrix matrix1, const Matrix matrix2);
int rows(const Matrix matrix);
int cols(const Matrix matrix);
#endif