generated from freudenreichan/info2Praktikum-NeuronalesNetz
55 lines
1.2 KiB
C
55 lines
1.2 KiB
C
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include "matrix.h"
|
|
|
|
// TODO Matrix-Funktionen implementieren
|
|
|
|
typedef struct Matrix {
|
|
unsigned int rows;
|
|
unsigned int cols;
|
|
MatrixType* buffer;
|
|
} 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)
|
|
{
|
|
if (rowIdx >= matrix.rows || colIdx >= matrix.cols){
|
|
printf("Index out of bounds\n"); //Error Message because Index Input exceeds Matrix
|
|
}
|
|
else{
|
|
matrix.buffer[rowIdx * matrix.cols + colIdx] = value; //Writes Value of value variable in the selected place in Matrix
|
|
}
|
|
}
|
|
|
|
MatrixType getMatrixAt(const Matrix matrix, unsigned int rowIdx, unsigned int colIdx)
|
|
{
|
|
if (rowIdx >= matrix.rows || colIdx >= matrix.cols){
|
|
printf("Index out of bounds\n");
|
|
return 0;
|
|
}
|
|
else{
|
|
|
|
MatrixType value = matrix.buffer[rowIdx * matrix.cols + colIdx]; //Stores value of selected place of Matrix in value variable
|
|
return value;
|
|
}
|
|
}
|
|
|
|
Matrix add(const Matrix matrix1, const Matrix matrix2)
|
|
{
|
|
|
|
}
|
|
|
|
Matrix multiply(const Matrix matrix1, const Matrix matrix2)
|
|
{
|
|
|
|
} |