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