generated from freudenreichan/info2Praktikum-NeuronalesNetz
Erste Änderungen und definirung der Matrix struct.
This commit is contained in:
1 parent
ab2d0b198c
commit
1e9579db2b
2 files changed
+33
-21
No files matched your search
+18
-20
@@ -2,34 +2,32 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "matrix.h"
|
#include "matrix.h"
|
||||||
|
|
||||||
// TODO Matrix-Funktionen implementieren
|
|
||||||
|
|
||||||
Matrix createMatrix(unsigned int rows, unsigned int cols)
|
Matrix createMatrix(unsigned int rows, unsigned int cols){
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void clearMatrix(Matrix *matrix)
|
|
||||||
{
|
void clearMatrix(Matrix *matrix){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void setMatrixAt(MatrixType value, Matrix matrix, unsigned int rowIdx, unsigned int colIdx)
|
|
||||||
{
|
void setMatrixAt(MatrixType value, Matrix matrix, unsigned int rowIdx, unsigned int colIdx){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MatrixType getMatrixAt(const 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 add(const Matrix matrix1, const Matrix matrix2){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Matrix multiply(const Matrix matrix1, const Matrix matrix2)
|
|
||||||
{
|
Matrix multiply(const Matrix matrix1, const Matrix matrix2){
|
||||||
|
|
||||||
}
|
}
|
||||||
+15
-1
@@ -5,7 +5,21 @@
|
|||||||
|
|
||||||
typedef float MatrixType;
|
typedef float MatrixType;
|
||||||
|
|
||||||
// TODO Matrixtyp definieren
|
//Strukt für Matrix erstellen (Anzahl Zeilen und Spalten sowie einem Speicherbereich mit den eigentlichen Werten)
|
||||||
|
typedef struct{
|
||||||
|
unsigned int rows; //Zeilen
|
||||||
|
unsigned int cols; //Spalten
|
||||||
|
MatrixType *space; //Speicherbereich
|
||||||
|
|
||||||
|
} Matrix;
|
||||||
|
|
||||||
|
//[*space] |Zeile 1| |Zeile 2| |...
|
||||||
|
// Ich wähle hier eine ein eindimensionales Array (ptr -> |0|1|2|3| |4|5|6|7| |8|9|...) Das ist einfacher zur speicherakolisierung mit malloc, weil ich nur einen Speicher reservieren muss
|
||||||
|
// ! man muss rechnen um auf die richtige Adresse zu kommen!
|
||||||
|
//
|
||||||
|
//[**space]
|
||||||
|
// Würde man das wählen hätte ich ptr -> |ptr|ptr|ptr|, jeder dieser pointer würde dann auf eine Zeile Zeigen
|
||||||
|
// !Ich müsste alle malloc nacheinander löschen (schwieriger)!
|
||||||
|
|
||||||
|
|
||||||
Matrix createMatrix(unsigned int rows, unsigned int cols);
|
Matrix createMatrix(unsigned int rows, unsigned int cols);
|
||||||
|
|||||||
Reference in new issue
Block a user