createMatrix
This commit is contained in:
parent
8c99beab54
commit
5f441fbb5e
@ -1,4 +1,5 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <string.h>
|
||||
#include "matrix.h"
|
||||
|
||||
@ -9,9 +10,9 @@ Matrix createMatrix(unsigned int rows, unsigned int cols)
|
||||
Matrix matrix;
|
||||
matrix.rows = rows;
|
||||
matrix.cols = cols;
|
||||
matrix.data = (MatrixType *)malloc(rows * cols * sizeof(MatrixType));
|
||||
matrix.data = (float *)malloc(rows * cols * sizeof(MatrixType));
|
||||
if (matrix.data != NULL) {
|
||||
printf("Matrix can not be created\n");
|
||||
|
||||
}
|
||||
return matrix;
|
||||
}
|
||||
|
||||
@ -6,13 +6,12 @@
|
||||
typedef struct{
|
||||
size_t rows;
|
||||
size_t cols;
|
||||
double* data;
|
||||
float* data;
|
||||
} Matrix;
|
||||
|
||||
|
||||
typedef float MatrixType;
|
||||
|
||||
// TODO Matrixtyp definieren
|
||||
|
||||
|
||||
Matrix createMatrix(unsigned int rows, unsigned int cols);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user