Compare commits
4 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
aa58f99045 | ||
|
|
ac35897396 | ||
|
|
746f4cf3bd | ||
|
|
754d170616 |
5 changed files with 6 additions and 29 deletions
|
|
@ -48,7 +48,7 @@ release:
|
|||
|
||||
assets:
|
||||
links:
|
||||
- name: c_net
|
||||
- name: c_net linux download (precompiled)
|
||||
url: '${CI_PROJECT_URL}/-/jobs/${BUILD_JOB_ID}/artifacts/file/c_net'
|
||||
|
||||
script: echo "Define your deployment script!"
|
||||
|
|
|
|||
4
image.c
4
image.c
|
|
@ -26,6 +26,10 @@ void read_until_space_or_newline(char * buff, int maxCount, FILE * fptr){
|
|||
|
||||
Image * load_pgm_image(char * image_file_string){
|
||||
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->label = -1;
|
||||
|
||||
|
|
|
|||
2
main.c
2
main.c
|
|
@ -23,7 +23,7 @@ void parsingErrorTrain(){
|
|||
|
||||
void parsingErrorDetect(){
|
||||
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){
|
||||
|
|
|
|||
25
matrix.c
25
matrix.c
|
|
@ -216,21 +216,6 @@ Matrix* scale(Matrix* matrix, double value) {
|
|||
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) {
|
||||
|
||||
|
|
@ -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){
|
||||
|
||||
// open the file in append mode
|
||||
|
|
|
|||
2
matrix.h
2
matrix.h
|
|
@ -36,6 +36,4 @@ Matrix* subtract(Matrix* matrix1, Matrix* matrix2);
|
|||
Matrix* dot(Matrix* matrix1, Matrix* matrix2);
|
||||
Matrix* apply(double (*function)(double), Matrix* matrix);
|
||||
Matrix* scale(Matrix* matrix, double value);
|
||||
Matrix* addScalar(Matrix* matrix, double value);
|
||||
Matrix* transpose(Matrix* matrix);
|
||||
double matrix_sum(Matrix* matrix);
|
||||
Reference in a new issue