luis e26690d0d0 matrix.h check
matrix.c angefangen
imageInput.c sollte gehen tests gehen nicht bei mi
2025-11-12 19:53:48 +01:00

59 lines
1.1 KiB
C

#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "matrix.h"
// TODO Matrix-Funktionen implementieren
Matrix createMatrix(unsigned int rows, unsigned int cols)
{
Matrix m;
m.rows = rows;
m.cols = cols;
m.buffer = (MatrixType*)malloc(sizeof(MatrixType) * rows * cols);
if (m.buffer == NULL){
fprintf(stderr, "Error: Memory allocation failed in createMatrix!.\n");
m.rows = 0;
m.cols = 0;
return m;
}
for (unsigned int i = 0; i < rows * cols; i++){
m.buffer[i] = 0.0f;
}
return m;
}
void clearMatrix(Matrix *matrix)
{
if (matrix == NULL || matrix->buffer == NULL) {
return;
}
// Alle Elemente auf 0 setzen
for (unsigned int i = 0; i < matrix->rows * matrix->cols; i++) {
matrix->buffer[i] = 0.0f;
}
}
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 multiply(const Matrix matrix1, const Matrix matrix2)
{
}