HolyFuckItsAlive #13

Merged
jastornig merged 105 commits from Delta-Error-Test into main 2023-09-23 22:27:54 +02:00
Showing only changes of commit 4d4e9a38e1 - Show all commits

View file

@ -244,6 +244,21 @@ Matrix* transpose(Matrix* matrix) {
}
//file operations
void matrix_save(Matrix* matrix, char* file_string){
FILE *fptr = fopen(file_string, "w+");
if(!fptr){
printf("Unable to get handle for \"%s\"", file_string);
exit(1);
}
for(int i = 0; i < matrix->rows; i++){
for(int j = 0; j < matrix->columns; j++){
fprintf(fptr, "%f.12 ", matrix->numbers[i][j]);
}
fputc('\n', fptr);
}
}
Matrix* matrix_flatten(Matrix* matrix, int axis) {
// Axis = 0 -> Column Vector, Axis = 1 -> Row Vector
@ -265,5 +280,5 @@ Matrix* matrix_flatten(Matrix* matrix, int axis) {
else if (axis == 1) result_matrix->numbers[0][i * matrix->columns + j] = matrix->numbers[i][j];
}
}
return mat;
return result_matrix;
}