65 lines
1.1 KiB
C
65 lines
1.1 KiB
C
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include "matrix.h"
|
|
#include <stdio.h>
|
|
|
|
// TODO Matrix-Funktionen implementieren ... ok
|
|
|
|
Matrix createMatrix(unsigned int rows, unsigned int cols)
|
|
{
|
|
Matrix matrix;
|
|
|
|
if (rows == 0 || cols == 0)
|
|
{
|
|
matrix.rows = 0;
|
|
matrix.cols =0;
|
|
matrix.data = NULL;
|
|
return matrix;
|
|
}
|
|
matrix.rows = rows;
|
|
matrix.cols = cols;
|
|
|
|
matrix.data = (MatrixTyype *)malloc(rows * cols * sizeof(MatrixType));
|
|
|
|
if (matrix.data == NULL)
|
|
{
|
|
matrix.rows = 0;
|
|
matrix.cols = 0;
|
|
|
|
return matrix;
|
|
}
|
|
|
|
for (int i = 0; i<rows; i++)
|
|
{
|
|
for (int j = 0; j<cols; j++)
|
|
{
|
|
matrix.data[i * matrix.cols +j] = UNDEFINED_MATRIX_VALUE;
|
|
}
|
|
}
|
|
return matrix;
|
|
}
|
|
|
|
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 multiply(const Matrix matrix1, const Matrix matrix2)
|
|
{
|
|
|
|
} |