Compare commits

...

4 commits

Author SHA1 Message Date
Jakob Stornig
aa58f99045 minor changes 2023-09-25 11:11:07 +02:00
Jakob Stornig
ac35897396 Merge remote-tracking branch 'origin/main' 2023-09-24 22:36:51 +02:00
Jakob Stornig
746f4cf3bd deleted unused functions 2023-09-24 22:36:40 +02:00
jastornig
754d170616 Update .gitlab-ci.yml file 2023-09-24 20:36:11 +00:00
5 changed files with 6 additions and 29 deletions

View file

@ -48,7 +48,7 @@ release:
assets: assets:
links: links:
- name: c_net - name: c_net linux download (precompiled)
url: '${CI_PROJECT_URL}/-/jobs/${BUILD_JOB_ID}/artifacts/file/c_net' url: '${CI_PROJECT_URL}/-/jobs/${BUILD_JOB_ID}/artifacts/file/c_net'
script: echo "Define your deployment script!" script: echo "Define your deployment script!"

View file

@ -26,6 +26,10 @@ void read_until_space_or_newline(char * buff, int maxCount, FILE * fptr){
Image * load_pgm_image(char * image_file_string){ Image * load_pgm_image(char * image_file_string){
FILE * fptr = fopen(image_file_string, "r"); FILE * fptr = fopen(image_file_string, "r");
if(!fptr){
printf("could not open image file. exit\n");
exit(1);
}
Image *image = malloc(sizeof(Image)); Image *image = malloc(sizeof(Image));
image->label = -1; image->label = -1;

2
main.c
View file

@ -23,7 +23,7 @@ void parsingErrorTrain(){
void parsingErrorDetect(){ void parsingErrorDetect(){
printf("invalid syntax\n"); printf("invalid syntax\n");
printf("Syntax: c_net predict_demo [path_to_network] [image_file]"); printf("Syntax: c_net predict_demo [path_to_network] [image_file]\n");
} }
void predict_demo(int argc, char** arguments){ void predict_demo(int argc, char** arguments){

View file

@ -216,21 +216,6 @@ Matrix* scale(Matrix* matrix, double value) {
return result_matrix; return result_matrix;
} }
Matrix* addScalar(Matrix* matrix, double value) {
// create a copy of the original matrix
Matrix* result_matrix = matrix_copy(matrix);
// iterate over all numbers in the matrix and add the scalar value
for (int i = 0; i < result_matrix->rows; i++) {
for (int j = 0; j < result_matrix->columns; j++) {
result_matrix->numbers[i][j] += value;
}
}
// return the copy
return result_matrix;
}
Matrix* transpose(Matrix* matrix) { Matrix* transpose(Matrix* matrix) {
@ -249,16 +234,6 @@ Matrix* transpose(Matrix* matrix) {
} }
double matrix_sum(Matrix* matrix) {
double sum = 0;
for (int i = 0; i < matrix->rows; i++) {
for (int j = 0; j < matrix->columns; j++) {
sum += matrix->numbers[i][j];
}
}
return sum;
}
void matrix_save(Matrix* matrix, char* file_string){ void matrix_save(Matrix* matrix, char* file_string){
// open the file in append mode // open the file in append mode

View file

@ -36,6 +36,4 @@ Matrix* subtract(Matrix* matrix1, Matrix* matrix2);
Matrix* dot(Matrix* matrix1, Matrix* matrix2); Matrix* dot(Matrix* matrix1, Matrix* matrix2);
Matrix* apply(double (*function)(double), Matrix* matrix); Matrix* apply(double (*function)(double), Matrix* matrix);
Matrix* scale(Matrix* matrix, double value); Matrix* scale(Matrix* matrix, double value);
Matrix* addScalar(Matrix* matrix, double value);
Matrix* transpose(Matrix* matrix); Matrix* transpose(Matrix* matrix);
double matrix_sum(Matrix* matrix);