Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible changes #1

Open
wants to merge 28 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
0a56448
automatic indent
ykaliuta Sep 4, 2019
b38c9aa
main: add error checking
ykaliuta Sep 4, 2019
e413803
read.c: minor style changes
ykaliuta Sep 4, 2019
fccc61d
read.c: remove rudiment p and fix comment
ykaliuta Sep 4, 2019
6df6378
inverse: fix memory leak
ykaliuta Sep 4, 2019
8928d36
Reorganize files
ykaliuta Sep 4, 2019
05f70c8
declare local functions static
ykaliuta Sep 4, 2019
65a8d7f
matrix: add manipulation methods
ykaliuta Sep 4, 2019
3fe7cb3
matrix: refactor inverse() to use new interface
ykaliuta Sep 4, 2019
02b8727
matrix: refactor determinant
ykaliuta Sep 4, 2019
ddf980f
matrix: refactor multiply and add const to wrappers
ykaliuta Sep 5, 2019
bd4ce30
matrix: add matrix_is_same_size predicate.
ykaliuta Sep 5, 2019
9297411
matrix: refactor add
ykaliuta Sep 5, 2019
5d7c837
matrix: refactor print_matrix
ykaliuta Sep 5, 2019
29a0666
matrix: refactor scalar_product
ykaliuta Sep 5, 2019
5ed93bb
matrix: refactor transpose
ykaliuta Sep 5, 2019
e770805
matrix: unify API
ykaliuta Sep 5, 2019
9dfefe9
processing: move freeing array to read_file
ykaliuta Sep 5, 2019
ffdfd72
processing: do not allocate matrix array dynamically
ykaliuta Sep 5, 2019
9edb957
processing: fix memory leak on mult and sum
ykaliuta Sep 5, 2019
1b88733
processing: factor out matrix parsing logic
ykaliuta Sep 5, 2019
5b5c5ed
processing: fix lookup of -1 index of op array
ykaliuta Sep 5, 2019
1253804
processing: use variadic macro for IN_PLACE
ykaliuta Sep 5, 2019
a2d35d0
processing: use wrappers
ykaliuta Sep 5, 2019
de20232
switch to array of pointers
ykaliuta Sep 5, 2019
7a07e32
unify determinant API
ykaliuta Sep 5, 2019
87bd247
processing: factor out summary printing
ykaliuta Sep 5, 2019
cfc101e
matrix: determinant: fixing lookup of element
ykaliuta Sep 6, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
CC = gcc
CFLAGS = -Wall -g -Wshadow -pedantic
LDFLAGS = -lm
OBJFILES = main.o functions.o determinant.o inverse.o read.o calculate.o
OBJFILES = main.o processing.o matrix.o
TARGET = freelab
all: $(TARGET)

Expand Down
97 changes: 0 additions & 97 deletions calculate.c

This file was deleted.

51 changes: 0 additions & 51 deletions determinant.c

This file was deleted.

Binary file removed freelab
Binary file not shown.
98 changes: 0 additions & 98 deletions functions.c

This file was deleted.

21 changes: 0 additions & 21 deletions functions.h

This file was deleted.

38 changes: 0 additions & 38 deletions inverse.c

This file was deleted.

50 changes: 37 additions & 13 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,44 @@
* USA
*/

#include "processing.h"

#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <math.h>
#include "functions.h"

int main(int argc, char *argv[]){

FILE *file = argc > 1 ? fopen(argv[1], "rb") : stdin;

/*define max dimension of a matrix */
int maxc = argc>2?atoi(argv[2])*atoi(argv[2]):100;

read_file(maxc, file);

#include <string.h>

#define DEFAULT_FILE stdin
#define DEFAULT_DIMENSION 100

int main(int argc, char *argv[])
{

FILE *file = DEFAULT_FILE;
int maxc = DEFAULT_DIMENSION;

if (argc > 1) {
file = fopen(argv[1], "rb");
if (file == NULL) {
fprintf(stderr, "Could not open input file %s: %s\n",
argv[1], strerror(errno));
return 1;
}
}

if (argc > 2) {
int tmp;

tmp = atoi(argv[2]);
if (tmp == 0) {
fprintf(stderr, "Wrong dimension %s\n", argv[2]);
fclose(file);
return 1;
}
maxc = tmp;
}

read_file(maxc, file);

return 0;
}
Loading