HolyFuckItsAlive #13

Merged
jastornig merged 105 commits from Delta-Error-Test into main 2023-09-23 22:27:54 +02:00
4 changed files with 18 additions and 8 deletions
Showing only changes of commit 7a57c0af16 - Show all commits

View file

@ -3,4 +3,4 @@ project(c_net C)
set(CMAKE_C_STANDARD 11)
add_executable(c_net main.c)
add_executable(c_net main.c matrix.c)

10
image.c
View file

@ -1,5 +1,7 @@
#pragma once
#include <stdio.h>
#include "image.h"
#include "matrix.h"
@ -8,4 +10,10 @@ typedef struct {
int image_label;
} Image;
void img_print (Img* img){
//print the image
matrix_print(img->pixel_values);
//print the number of the image
printf("%d", img->image_label);
}
void img_free (Img* img)

6
main.c
View file

@ -1,5 +1,7 @@
#include <stdio.h>
#include "matrix.h"
#include <stdio.h>
int main() {
printf("Hello World");
return 0;
}

View file

@ -49,7 +49,7 @@ void matrix_free(Matrix* matrix) {
void matrix_print(Matrix *matrix) {
// print the dimensions of the matrix
printf("Rows: %d, Columns: %d", matrix->rows, matrix->columns);
printf("Rows: %d, Columns: %d\n", matrix->rows, matrix->columns);
// loop through all values and format them into the correct matrix representation
for (int i = 0; i < matrix->rows; i++) {
@ -92,12 +92,12 @@ Matrix* multiply(Matrix* matrix1, Matrix* matrix2) {
exit(1);
}
// crate result matrix
// create result matrix
Matrix* result_matrix = matrix_create(matrix1->rows, matrix1->columns);
// multiply the values and save them into the result matrix
for (int i = 0; i < matrix1->rows; i++) {
for (int j = 0; j < ; j++) {
for (int j = 0; j < matrix1->columns; j++) {
result_matrix->numbers[i][j] = matrix1->numbers[i][j] * matrix2->numbers[i][j];
}
}
@ -170,7 +170,7 @@ Matrix* dot(Matrix* matrix1, Matrix* matrix2) {
// sum up the products and save them into the result matrix
result_matrix->numbers[i][j] = 0;
for (int k = 0; k < matrix2->rows; k++) {
result_matrix->numbers[i][j] += matrix1[i][k] * matrix2[k][j];
result_matrix->numbers[i][j] += matrix1->numbers[i][k] * matrix2->numbers[k][j];
}
}
}