Start Task 2
This commit is contained in:
parent
8a7aac7c23
commit
de8589e39c
83 changed files with 1474 additions and 175 deletions
|
@ -29,7 +29,7 @@ CFLAGS = -mfpmath=sse \
|
|||
-c
|
||||
|
||||
all: main.o array.o
|
||||
gcc main.o array.o -lssp && del *.o
|
||||
gcc main.o array.o && rm *.o
|
||||
|
||||
main.o: main.c
|
||||
gcc $(CFLAGS) main.c
|
||||
|
|
|
@ -29,7 +29,7 @@ CFLAGS = -mfpmath=sse \
|
|||
-c
|
||||
|
||||
all: main.o array.o
|
||||
gcc main.o array.o -lssp && del *.o
|
||||
gcc main.o array.o && rm *.o
|
||||
|
||||
main.o: main.c
|
||||
gcc $(CFLAGS) main.c
|
||||
|
|
|
@ -29,7 +29,7 @@ CFLAGS = -mfpmath=sse \
|
|||
-c
|
||||
|
||||
all: main.o array.o
|
||||
gcc main.o array.o -lssp && del *.o
|
||||
gcc main.o array.o && rm *.o
|
||||
|
||||
main.o: main.c
|
||||
gcc $(CFLAGS) main.c
|
||||
|
|
|
@ -29,7 +29,7 @@ CFLAGS = -mfpmath=sse \
|
|||
-c
|
||||
|
||||
all: main.o array.o
|
||||
gcc main.o array.o -lssp && del *.o
|
||||
gcc main.o array.o && rm *.o
|
||||
|
||||
main.o: main.c
|
||||
gcc $(CFLAGS) main.c
|
||||
|
|
|
@ -29,7 +29,7 @@ CFLAGS = -mfpmath=sse \
|
|||
-c
|
||||
|
||||
all: main.o array.o
|
||||
gcc main.o array.o -lssp && del *.o
|
||||
gcc main.o array.o && rm *.o
|
||||
|
||||
main.o: main.c
|
||||
gcc $(CFLAGS) main.c
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
FLAGS = -fstack-protector-all -W -Wall -Wextra -Wunused -Wcast-align -Werror -pedantic -pedantic-errors -Wfloat-equal -Wpointer-arith -Wformat-security -Wmissing-format-attribute -Wformat=1 -Wwrite-strings -Wcast-align -Wno-long-long -std=gnu99 -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wold-style-definition -Wdeclaration-after-statement -Wbad-function-cast -Wnested-externs -O3
|
||||
|
||||
a07.exe: main.o solve.o
|
||||
gcc main.o solve.o -o a07.exe -lssp
|
||||
a07.out: main.o solve.o
|
||||
gcc main.o solve.o -o a07.out
|
||||
|
||||
main.o: main.c
|
||||
gcc $(CFLAGS) -c main.c
|
||||
|
@ -10,4 +10,4 @@ solve.o: solve.c
|
|||
gcc $(FLAGS) -c solve.c
|
||||
|
||||
clean:
|
||||
del *.o *.exe
|
||||
rm *.o *.out
|
|
@ -1,7 +1,7 @@
|
|||
FLAGS = -fstack-protector-all -W -Wall -Wextra -Wunused -Wcast-align -Werror -pedantic -pedantic-errors -Wfloat-equal -Wpointer-arith -Wformat-security -Wmissing-format-attribute -Wformat=1 -Wwrite-strings -Wcast-align -Wno-long-long -std=gnu99 -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wold-style-definition -Wdeclaration-after-statement -Wbad-function-cast -Wnested-externs -O3
|
||||
|
||||
a08.exe: main.o solve.o
|
||||
gcc main.o solve.o -o a08.exe -lssp
|
||||
a08.out: main.o solve.o
|
||||
gcc main.o solve.o -o a08.out
|
||||
|
||||
main.o: main.c
|
||||
gcc $(CFLAGS) -c main.c
|
||||
|
@ -10,4 +10,4 @@ solve.o: solve.c
|
|||
gcc $(FLAGS) -c solve.c
|
||||
|
||||
clean:
|
||||
del *.o *.exe
|
||||
rm *.o *.out
|
|
@ -29,7 +29,7 @@ CFLAGS = -mfpmath=sse \
|
|||
-c
|
||||
|
||||
all: main.o array.o
|
||||
gcc main.o array.o -lssp && del *.o
|
||||
gcc main.o array.o && rm *.o
|
||||
|
||||
main.o: main.c
|
||||
gcc $(CFLAGS) main.c
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
FLAGS = -fstack-protector-all -W -Wall -Wextra -Wunused -Wcast-align -Werror -pedantic -pedantic-errors -Wfloat-equal -Wpointer-arith -Wformat-security -Wmissing-format-attribute -Wformat=1 -Wwrite-strings -Wcast-align -Wno-long-long -std=gnu99 -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wold-style-definition -Wdeclaration-after-statement -Wbad-function-cast -Wnested-externs -O3
|
||||
|
||||
a01.exe: main.o array.o solve.o
|
||||
gcc main.o solve.o array.o -o a01.exe -lssp
|
||||
a01.out: main.o array.o solve.o
|
||||
gcc main.o solve.o array.o -o a01.out
|
||||
|
||||
main.o: main.c
|
||||
gcc $(CFLAGS) -c main.c
|
||||
|
@ -13,4 +13,4 @@ array.o: array.c
|
|||
gcc $(CFLAGS) -c array.c
|
||||
|
||||
clean:
|
||||
del *.o *.exe
|
||||
rm *.o *.out
|
|
@ -1,7 +1,7 @@
|
|||
FLAGS = -fstack-protector-all -W -Wall -Wextra -Wunused -Wcast-align -Werror -pedantic -pedantic-errors -Wfloat-equal -Wpointer-arith -Wformat-security -Wmissing-format-attribute -Wformat=1 -Wwrite-strings -Wcast-align -Wno-long-long -std=gnu99 -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wold-style-definition -Wdeclaration-after-statement -Wbad-function-cast -Wnested-externs -O3
|
||||
|
||||
a02.exe: main.o array.o solve.o
|
||||
gcc main.o solve.o array.o -o a02.exe -lssp
|
||||
a02.out: main.o array.o solve.o
|
||||
gcc main.o solve.o array.o -o a02.out
|
||||
|
||||
main.o: main.c
|
||||
gcc $(CFLAGS) -c main.c
|
||||
|
@ -13,4 +13,4 @@ array.o: array.c
|
|||
gcc $(CFLAGS) -c array.c
|
||||
|
||||
clean:
|
||||
del *.o *.exe
|
||||
rm *.o *.out
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
FLAGS = -fstack-protector-all -W -Wall -Wextra -Wunused -Wcast-align -Werror -pedantic -pedantic-errors -Wfloat-equal -Wpointer-arith -Wformat-security -Wmissing-format-attribute -Wformat=1 -Wwrite-strings -Wcast-align -Wno-long-long -std=gnu99 -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wold-style-definition -Wdeclaration-after-statement -Wbad-function-cast -Wnested-externs -O3
|
||||
|
||||
a03.exe: main.o array.o solve.o
|
||||
gcc main.o solve.o array.o -o a03.exe -lssp
|
||||
a03.out: main.o array.o solve.o
|
||||
gcc main.o solve.o array.o -o a03.out
|
||||
|
||||
main.o: main.c
|
||||
gcc $(CFLAGS) -c main.c
|
||||
|
@ -13,4 +13,4 @@ array.o: array.c
|
|||
gcc $(CFLAGS) -c array.c
|
||||
|
||||
clean:
|
||||
del *.o *.exe
|
||||
rm *.o *.out
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
FLAGS = -fstack-protector-all -W -Wall -Wextra -Wunused -Wcast-align -Werror -pedantic -pedantic-errors -Wfloat-equal -Wpointer-arith -Wformat-security -Wmissing-format-attribute -Wformat=1 -Wwrite-strings -Wcast-align -Wno-long-long -std=gnu99 -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wold-style-definition -Wdeclaration-after-statement -Wbad-function-cast -Wnested-externs -O3
|
||||
|
||||
a04.exe: main.o array.o solve.o
|
||||
gcc main.o solve.o array.o -o a04.exe -lssp
|
||||
a04.out: main.o array.o solve.o
|
||||
gcc main.o solve.o array.o -o a04.out
|
||||
|
||||
main.o: main.c
|
||||
gcc $(CFLAGS) -c main.c
|
||||
|
@ -13,4 +13,4 @@ array.o: array.c
|
|||
gcc $(CFLAGS) -c array.c
|
||||
|
||||
clean:
|
||||
del *.o *.exe
|
||||
rm *.o *.out
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
FLAGS = -fstack-protector-all -W -Wall -Wextra -Wunused -Wcast-align -Werror -pedantic -pedantic-errors -Wfloat-equal -Wpointer-arith -Wformat-security -Wmissing-format-attribute -Wformat=1 -Wwrite-strings -Wcast-align -Wno-long-long -std=gnu99 -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wold-style-definition -Wdeclaration-after-statement -Wbad-function-cast -Wnested-externs -O3
|
||||
|
||||
a05.exe: main.o array.o solve.o
|
||||
gcc main.o solve.o array.o -o a05.exe -lssp
|
||||
a05.out: main.o array.o solve.o
|
||||
gcc main.o solve.o array.o -o a05.out
|
||||
|
||||
main.o: main.c
|
||||
gcc $(CFLAGS) -c main.c
|
||||
|
@ -13,4 +13,4 @@ array.o: array.c
|
|||
gcc $(CFLAGS) -c array.c
|
||||
|
||||
clean:
|
||||
del *.o *.exe
|
||||
rm *.o *.out
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
FLAGS = -fstack-protector-all -W -Wall -Wextra -Wunused -Wcast-align -Werror -pedantic -pedantic-errors -Wfloat-equal -Wpointer-arith -Wformat-security -Wmissing-format-attribute -Wformat=1 -Wwrite-strings -Wcast-align -Wno-long-long -std=gnu99 -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wold-style-definition -Wdeclaration-after-statement -Wbad-function-cast -Wnested-externs -O3
|
||||
|
||||
a06.exe: main.o array.o solve.o
|
||||
gcc main.o solve.o array.o -o a06.exe -lssp
|
||||
a06.out: main.o array.o solve.o
|
||||
gcc main.o solve.o array.o -o a06.out
|
||||
|
||||
main.o: main.c
|
||||
gcc $(CFLAGS) -c main.c
|
||||
|
@ -13,4 +13,4 @@ array.o: array.c
|
|||
gcc $(CFLAGS) -c array.c
|
||||
|
||||
clean:
|
||||
del *.o *.exe
|
||||
rm *.o *.out
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
FLAGS = -fstack-protector-all -W -Wall -Wextra -Wunused -Wcast-align -Werror -pedantic -pedantic-errors -Wfloat-equal -Wpointer-arith -Wformat-security -Wmissing-format-attribute -Wformat=1 -Wwrite-strings -Wcast-align -Wno-long-long -std=gnu99 -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wold-style-definition -Wdeclaration-after-statement -Wbad-function-cast -Wnested-externs -O3
|
||||
|
||||
a07.exe: main.o array.o solve.o
|
||||
gcc main.o solve.o array.o -o a07.exe -lssp
|
||||
a07.out: main.o array.o solve.o
|
||||
gcc main.o solve.o array.o -o a07.out
|
||||
|
||||
main.o: main.c
|
||||
gcc $(CFLAGS) -c main.c
|
||||
|
@ -13,4 +13,4 @@ array.o: array.c
|
|||
gcc $(CFLAGS) -c array.c
|
||||
|
||||
clean:
|
||||
del *.o *.exe
|
||||
rm *.o *.out
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
FLAGS = -fstack-protector-all -W -Wall -Wextra -Wunused -Wcast-align -Werror -pedantic -pedantic-errors -Wfloat-equal -Wpointer-arith -Wformat-security -Wmissing-format-attribute -Wformat=1 -Wwrite-strings -Wcast-align -Wno-long-long -std=gnu99 -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wold-style-definition -Wdeclaration-after-statement -Wbad-function-cast -Wnested-externs -O3
|
||||
|
||||
a08.exe: main.o array.o solve.o
|
||||
gcc main.o solve.o array.o -o a08.exe -lssp
|
||||
a08.out: main.o array.o solve.o
|
||||
gcc main.o solve.o array.o -o a08.out
|
||||
|
||||
main.o: main.c
|
||||
gcc $(CFLAGS) -c main.c
|
||||
|
@ -13,4 +13,4 @@ array.o: array.c
|
|||
gcc $(CFLAGS) -c array.c
|
||||
|
||||
clean:
|
||||
del *.o *.exe
|
||||
rm *.o *.out
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
FLAGS = -fstack-protector-all -W -Wall -Wextra -Wunused -Wcast-align -Werror -pedantic -pedantic-errors -Wfloat-equal -Wpointer-arith -Wformat-security -Wmissing-format-attribute -Wformat=1 -Wwrite-strings -Wcast-align -Wno-long-long -std=gnu99 -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wold-style-definition -Wdeclaration-after-statement -Wbad-function-cast -Wnested-externs -O3
|
||||
|
||||
a01.exe: main.o array.o solve.o sort.o
|
||||
gcc main.o solve.o array.o sort.o -o a01.exe -lssp
|
||||
a01.out: main.o array.o solve.o sort.o
|
||||
gcc main.o solve.o array.o sort.o -o a01.out
|
||||
|
||||
main.o: main.c
|
||||
gcc $(CFLAGS) -c main.c
|
||||
|
@ -16,4 +16,4 @@ sort.o: sort.c
|
|||
gcc $(CFLAGS) -c sort.c
|
||||
|
||||
clean:
|
||||
del *.o *.exe
|
||||
rm *.o *.out
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
FLAGS = -fstack-protector-all -W -Wall -Wextra -Wunused -Wcast-align -Werror -pedantic -pedantic-errors -Wfloat-equal -Wpointer-arith -Wformat-security -Wmissing-format-attribute -Wformat=1 -Wwrite-strings -Wcast-align -Wno-long-long -std=gnu99 -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wold-style-definition -Wdeclaration-after-statement -Wbad-function-cast -Wnested-externs -O3
|
||||
|
||||
a02.exe: main.o array.o solve.o sort.o
|
||||
gcc main.o solve.o array.o sort.o -o a02.exe -lssp
|
||||
a02.out: main.o array.o solve.o sort.o
|
||||
gcc main.o solve.o array.o sort.o -o a02.out
|
||||
|
||||
main.o: main.c
|
||||
gcc $(CFLAGS) -c main.c
|
||||
|
@ -16,4 +16,4 @@ sort.o: sort.c
|
|||
gcc $(CFLAGS) -c sort.c
|
||||
|
||||
clean:
|
||||
del *.o *.exe
|
||||
rm *.o *.out
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
FLAGS = -fstack-protector-all -W -Wall -Wextra -Wunused -Wcast-align -Werror -pedantic -pedantic-errors -Wfloat-equal -Wpointer-arith -Wformat-security -Wmissing-format-attribute -Wformat=1 -Wwrite-strings -Wcast-align -Wno-long-long -std=gnu99 -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wold-style-definition -Wdeclaration-after-statement -Wbad-function-cast -Wnested-externs -O3
|
||||
|
||||
a03.exe: main.o array.o solve.o sort.o
|
||||
gcc main.o solve.o array.o sort.o -o a03.exe -lssp
|
||||
a03.out: main.o array.o solve.o sort.o
|
||||
gcc main.o solve.o array.o sort.o -o a03.out
|
||||
|
||||
main.o: main.c
|
||||
gcc $(CFLAGS) -c main.c
|
||||
|
@ -16,4 +16,4 @@ sort.o: sort.c
|
|||
gcc $(CFLAGS) -c sort.c
|
||||
|
||||
clean:
|
||||
del *.o *.exe
|
||||
rm *.o *.out
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
FLAGS = -fstack-protector-all -W -Wall -Wextra -Wunused -Wcast-align -Werror -pedantic -pedantic-errors -Wfloat-equal -Wpointer-arith -Wformat-security -Wmissing-format-attribute -Wformat=1 -Wwrite-strings -Wcast-align -Wno-long-long -std=gnu99 -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wold-style-definition -Wdeclaration-after-statement -Wbad-function-cast -Wnested-externs -O3
|
||||
|
||||
a04.exe: main.o array.o solve.o sort.o
|
||||
gcc main.o solve.o array.o sort.o -o a04.exe -lssp
|
||||
a04.out: main.o array.o solve.o sort.o
|
||||
gcc main.o solve.o array.o sort.o -o a04.out
|
||||
|
||||
main.o: main.c
|
||||
gcc $(CFLAGS) -c main.c
|
||||
|
@ -16,4 +16,4 @@ sort.o: sort.c
|
|||
gcc $(CFLAGS) -c sort.c
|
||||
|
||||
clean:
|
||||
del *.o *.exe
|
||||
rm *.o *.out
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
FLAGS = -fstack-protector-all -W -Wall -Wextra -Wunused -Wcast-align -Werror -pedantic -pedantic-errors -Wfloat-equal -Wpointer-arith -Wformat-security -Wmissing-format-attribute -Wformat=1 -Wwrite-strings -Wcast-align -Wno-long-long -std=gnu99 -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wold-style-definition -Wdeclaration-after-statement -Wbad-function-cast -Wnested-externs -O3
|
||||
|
||||
a05.exe: main.o array.o solve.o sort.o
|
||||
gcc main.o solve.o array.o sort.o -o a05.exe -lssp
|
||||
a05.out: main.o array.o solve.o sort.o
|
||||
gcc main.o solve.o array.o sort.o -o a05.out
|
||||
|
||||
main.o: main.c
|
||||
gcc $(CFLAGS) -c main.c
|
||||
|
@ -16,4 +16,4 @@ sort.o: sort.c
|
|||
gcc $(CFLAGS) -c sort.c
|
||||
|
||||
clean:
|
||||
del *.o *.exe
|
||||
rm *.o *.out
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
FLAGS = -fstack-protector-all -W -Wall -Wextra -Wunused -Wcast-align -Werror -pedantic -pedantic-errors -Wfloat-equal -Wpointer-arith -Wformat-security -Wmissing-format-attribute -Wformat=1 -Wwrite-strings -Wcast-align -Wno-long-long -std=gnu99 -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wold-style-definition -Wdeclaration-after-statement -Wbad-function-cast -Wnested-externs -O3
|
||||
|
||||
a06.exe: main.o array.o solve.o sort.o
|
||||
gcc main.o solve.o array.o sort.o -o a06.exe -lssp
|
||||
a06.out: main.o array.o solve.o sort.o
|
||||
gcc main.o solve.o array.o sort.o -o a06.out
|
||||
|
||||
main.o: main.c
|
||||
gcc $(CFLAGS) -c main.c
|
||||
|
@ -16,4 +16,4 @@ sort.o: sort.c
|
|||
gcc $(CFLAGS) -c sort.c
|
||||
|
||||
clean:
|
||||
del *.o *.exe
|
||||
rm *.o *.out
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
FLAGS = -fstack-protector-all -W -Wall -Wextra -Wunused -Wcast-align -Werror -pedantic -pedantic-errors -Wfloat-equal -Wpointer-arith -Wformat-security -Wmissing-format-attribute -Wformat=1 -Wwrite-strings -Wcast-align -Wno-long-long -std=gnu99 -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wold-style-definition -Wdeclaration-after-statement -Wbad-function-cast -Wnested-externs -O3
|
||||
|
||||
a07.exe: main.o array.o solve.o sort.o
|
||||
gcc main.o solve.o array.o sort.o -o a07.exe -lssp
|
||||
a07.out: main.o array.o solve.o sort.o
|
||||
gcc main.o solve.o array.o sort.o -o a07.out
|
||||
|
||||
main.o: main.c
|
||||
gcc $(CFLAGS) -c main.c
|
||||
|
@ -16,4 +16,4 @@ sort.o: sort.c
|
|||
gcc $(CFLAGS) -c sort.c
|
||||
|
||||
clean:
|
||||
del *.o *.exe
|
||||
rm *.o *.out
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
FLAGS = -fstack-protector-all -W -Wall -Wextra -Wunused -Wcast-align -Werror -pedantic -pedantic-errors -Wfloat-equal -Wpointer-arith -Wformat-security -Wmissing-format-attribute -Wformat=1 -Wwrite-strings -Wcast-align -Wno-long-long -std=gnu99 -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wold-style-definition -Wdeclaration-after-statement -Wbad-function-cast -Wnested-externs -O3
|
||||
|
||||
a08.exe: main.o array.o solve.o sort.o
|
||||
gcc main.o solve.o array.o sort.o -o a08.exe -lssp
|
||||
a08.out: main.o array.o solve.o sort.o
|
||||
gcc main.o solve.o array.o sort.o -o a08.out
|
||||
|
||||
main.o: main.c
|
||||
gcc $(CFLAGS) -c main.c
|
||||
|
@ -16,4 +16,4 @@ sort.o: sort.c
|
|||
gcc $(CFLAGS) -c sort.c
|
||||
|
||||
clean:
|
||||
del *.o *.exe
|
||||
rm *.o *.out
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
FLAGS = -fstack-protector-all -W -Wall -Wextra -Wunused -Wcast-align -Werror -pedantic -pedantic-errors -Wfloat-equal -Wpointer-arith -Wformat-security -Wmissing-format-attribute -Wformat=1 -Wwrite-strings -Wcast-align -Wno-long-long -std=gnu99 -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wold-style-definition -Wdeclaration-after-statement -Wbad-function-cast -Wnested-externs -O3
|
||||
|
||||
a09.exe: main.o array.o solve.o sort.o
|
||||
gcc main.o solve.o array.o sort.o -o a09.exe -lssp
|
||||
a09.out: main.o array.o solve.o sort.o
|
||||
gcc main.o solve.o array.o sort.o -o a09.out
|
||||
|
||||
main.o: main.c
|
||||
gcc $(CFLAGS) -c main.c
|
||||
|
@ -16,4 +16,4 @@ sort.o: sort.c
|
|||
gcc $(CFLAGS) -c sort.c
|
||||
|
||||
clean:
|
||||
del *.o *.exe
|
||||
rm *.o *.out
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
FLAGS = -fstack-protector-all -W -Wall -Wextra -Wunused -Wcast-align -Werror -pedantic -pedantic-errors -Wfloat-equal -Wpointer-arith -Wformat-security -Wmissing-format-attribute -Wformat=1 -Wwrite-strings -Wcast-align -Wno-long-long -std=gnu99 -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wold-style-definition -Wdeclaration-after-statement -Wbad-function-cast -Wnested-externs -O3
|
||||
|
||||
a01.exe: main.o array_io.o solve.o init_f.o
|
||||
gcc main.o solve.o array_io.o init_f.o -o a01.exe -lssp
|
||||
a01.out: main.o array_io.o solve.o init_f.o
|
||||
gcc main.o solve.o array_io.o init_f.o -o a01.out
|
||||
|
||||
main.o: main.c
|
||||
gcc $(CFLAGS) -c main.c
|
||||
|
@ -16,4 +16,4 @@ init_f.o: init_f.c
|
|||
gcc $(CFLAGS) -c init_f.c
|
||||
|
||||
clean:
|
||||
del *.o *.exe
|
||||
rm *.o *.out
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
FLAGS = -fstack-protector-all -W -Wall -Wextra -Wunused -Wcast-align -Werror -pedantic -pedantic-errors -Wfloat-equal -Wpointer-arith -Wformat-security -Wmissing-format-attribute -Wformat=1 -Wwrite-strings -Wcast-align -Wno-long-long -std=gnu99 -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wold-style-definition -Wdeclaration-after-statement -Wbad-function-cast -Wnested-externs -O3
|
||||
|
||||
a02.exe: main.o array_io.o solve.o init_f.o
|
||||
gcc main.o solve.o array_io.o init_f.o -o a02.exe -lssp
|
||||
a02.out: main.o array_io.o solve.o init_f.o
|
||||
gcc main.o solve.o array_io.o init_f.o -o a02.out
|
||||
|
||||
main.o: main.c
|
||||
gcc $(CFLAGS) -c main.c
|
||||
|
@ -16,4 +16,4 @@ init_f.o: init_f.c
|
|||
gcc $(CFLAGS) -c init_f.c
|
||||
|
||||
clean:
|
||||
del *.o *.exe
|
||||
rm *.o *.out
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
FLAGS = -fstack-protector-all -W -Wall -Wextra -Wunused -Wcast-align -Werror -pedantic -pedantic-errors -Wfloat-equal -Wpointer-arith -Wformat-security -Wmissing-format-attribute -Wformat=1 -Wwrite-strings -Wcast-align -Wno-long-long -std=gnu99 -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wold-style-definition -Wdeclaration-after-statement -Wbad-function-cast -Wnested-externs -O3
|
||||
|
||||
a03.exe: main.o array_io.o solve.o init_f.o
|
||||
gcc main.o solve.o array_io.o init_f.o -o a03.exe -lssp
|
||||
a03.out: main.o array_io.o solve.o init_f.o
|
||||
gcc main.o solve.o array_io.o init_f.o -o a03.out
|
||||
|
||||
main.o: main.c
|
||||
gcc $(CFLAGS) -c main.c
|
||||
|
@ -16,4 +16,4 @@ init_f.o: init_f.c
|
|||
gcc $(CFLAGS) -c init_f.c
|
||||
|
||||
clean:
|
||||
del *.o *.exe
|
||||
rm *.o *.out
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
FLAGS = -fstack-protector-all -W -Wall -Wextra -Wunused -Wcast-align -Werror -pedantic -pedantic-errors -Wfloat-equal -Wpointer-arith -Wformat-security -Wmissing-format-attribute -Wformat=1 -Wwrite-strings -Wcast-align -Wno-long-long -std=gnu99 -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wold-style-definition -Wdeclaration-after-statement -Wbad-function-cast -Wnested-externs -O3
|
||||
|
||||
a04.exe: main.o array_io.o solve.o init_f.o
|
||||
gcc main.o solve.o array_io.o init_f.o -o a04.exe -lssp
|
||||
a04.out: main.o array_io.o solve.o init_f.o
|
||||
gcc main.o solve.o array_io.o init_f.o -o a04.out
|
||||
|
||||
main.o: main.c
|
||||
gcc $(CFLAGS) -c main.c
|
||||
|
@ -16,4 +16,4 @@ init_f.o: init_f.c
|
|||
gcc $(CFLAGS) -c init_f.c
|
||||
|
||||
clean:
|
||||
del *.o *.exe
|
||||
rm *.o *.out
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
FLAGS = -fstack-protector-all -W -Wall -Wextra -Wunused -Wcast-align -Werror -pedantic -pedantic-errors -Wfloat-equal -Wpointer-arith -Wformat-security -Wmissing-format-attribute -Wformat=1 -Wwrite-strings -Wcast-align -Wno-long-long -std=gnu99 -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wold-style-definition -Wdeclaration-after-statement -Wbad-function-cast -Wnested-externs -O3
|
||||
|
||||
a05.exe: main.o array_io.o solve.o init_f.o
|
||||
gcc main.o solve.o array_io.o init_f.o -o a05.exe -lssp
|
||||
a05.out: main.o array_io.o solve.o init_f.o
|
||||
gcc main.o solve.o array_io.o init_f.o -o a05.out
|
||||
|
||||
main.o: main.c
|
||||
gcc $(CFLAGS) -c main.c
|
||||
|
@ -16,4 +16,4 @@ init_f.o: init_f.c
|
|||
gcc $(CFLAGS) -c init_f.c
|
||||
|
||||
clean:
|
||||
del *.o *.exe
|
||||
rm *.o *.out
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
FLAGS = -fstack-protector-all -W -Wall -Wextra -Wunused -Wcast-align -Werror -pedantic -pedantic-errors -Wfloat-equal -Wpointer-arith -Wformat-security -Wmissing-format-attribute -Wformat=1 -Wwrite-strings -Wcast-align -Wno-long-long -std=gnu99 -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wold-style-definition -Wdeclaration-after-statement -Wbad-function-cast -Wnested-externs -O3
|
||||
|
||||
a06.exe: main.o array_io.o solve.o init_f.o
|
||||
gcc main.o solve.o array_io.o init_f.o -o a06.exe -lssp
|
||||
a06.out: main.o array_io.o solve.o init_f.o
|
||||
gcc main.o solve.o array_io.o init_f.o -o a06.out
|
||||
|
||||
main.o: main.c
|
||||
gcc $(CFLAGS) -c main.c
|
||||
|
@ -16,4 +16,4 @@ init_f.o: init_f.c
|
|||
gcc $(CFLAGS) -c init_f.c
|
||||
|
||||
clean:
|
||||
del *.o *.exe
|
||||
rm *.o *.out
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
FLAGS = -fstack-protector-all -W -Wall -Wextra -Wunused -Wcast-align -Werror -pedantic -pedantic-errors -Wfloat-equal -Wpointer-arith -Wformat-security -Wmissing-format-attribute -Wformat=1 -Wwrite-strings -Wcast-align -Wno-long-long -std=gnu99 -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wold-style-definition -Wdeclaration-after-statement -Wbad-function-cast -Wnested-externs -O3
|
||||
|
||||
a07.exe: main.o array_io.o solve.o init_f.o
|
||||
gcc main.o solve.o array_io.o init_f.o -o a07.exe -lssp
|
||||
a07.out: main.o array_io.o solve.o init_f.o
|
||||
gcc main.o solve.o array_io.o init_f.o -o a07.out
|
||||
|
||||
main.o: main.c
|
||||
gcc $(CFLAGS) -c main.c
|
||||
|
@ -16,4 +16,4 @@ init_f.o: init_f.c
|
|||
gcc $(CFLAGS) -c init_f.c
|
||||
|
||||
clean:
|
||||
del *.o *.exe
|
||||
rm *.o *.out
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
FLAGS = -fstack-protector-all -W -Wall -Wextra -Wunused -Wcast-align -Werror -pedantic -pedantic-errors -Wfloat-equal -Wpointer-arith -Wformat-security -Wmissing-format-attribute -Wformat=1 -Wwrite-strings -Wcast-align -Wno-long-long -std=gnu99 -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wold-style-definition -Wdeclaration-after-statement -Wbad-function-cast -Wnested-externs -O3
|
||||
|
||||
a08.exe: main.o array_io.o solve.o init_f.o
|
||||
gcc main.o solve.o array_io.o init_f.o -o a08.exe -lssp
|
||||
a08.out: main.o array_io.o solve.o init_f.o
|
||||
gcc main.o solve.o array_io.o init_f.o -o a08.out
|
||||
|
||||
main.o: main.c
|
||||
gcc $(CFLAGS) -c main.c
|
||||
|
@ -16,4 +16,4 @@ init_f.o: init_f.c
|
|||
gcc $(CFLAGS) -c init_f.c
|
||||
|
||||
clean:
|
||||
del *.o *.exe
|
||||
rm *.o *.out
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
FLAGS = -fstack-protector-all -W -Wall -Wextra -Wunused -Wcast-align -Werror -pedantic -pedantic-errors -Wfloat-equal -Wpointer-arith -Wformat-security -Wmissing-format-attribute -Wformat=1 -Wwrite-strings -Wcast-align -Wno-long-long -std=gnu99 -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wold-style-definition -Wdeclaration-after-statement -Wbad-function-cast -Wnested-externs -O3
|
||||
|
||||
a09.exe: main.o array_io.o solve.o init_f.o
|
||||
gcc main.o solve.o array_io.o init_f.o -o a09.exe -lssp
|
||||
a09.out: main.o array_io.o solve.o init_f.o
|
||||
gcc main.o solve.o array_io.o init_f.o -o a09.out
|
||||
|
||||
main.o: main.c
|
||||
gcc $(CFLAGS) -c main.c
|
||||
|
@ -16,4 +16,4 @@ init_f.o: init_f.c
|
|||
gcc $(CFLAGS) -c init_f.c
|
||||
|
||||
clean:
|
||||
del *.o *.exe
|
||||
rm *.o *.out
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
FLAGS = -fstack-protector-all -W -Wall -Wextra -Wunused -Wcast-align -Werror -pedantic -pedantic-errors -Wfloat-equal -Wpointer-arith -Wformat-security -Wmissing-format-attribute -Wformat=1 -Wwrite-strings -Wcast-align -Wno-long-long -std=gnu99 -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wold-style-definition -Wdeclaration-after-statement -Wbad-function-cast -Wnested-externs -O3
|
||||
|
||||
a10.exe: main.o array_io.o solve.o init_f.o
|
||||
gcc main.o solve.o array_io.o init_f.o -o a10.exe -lssp
|
||||
a10.out: main.o array_io.o solve.o init_f.o
|
||||
gcc main.o solve.o array_io.o init_f.o -o a10.out
|
||||
|
||||
main.o: main.c
|
||||
gcc $(CFLAGS) -c main.c
|
||||
|
@ -16,4 +16,4 @@ init_f.o: init_f.c
|
|||
gcc $(CFLAGS) -c init_f.c
|
||||
|
||||
clean:
|
||||
del *.o *.exe
|
||||
rm *.o *.out
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
FLAGS = -fstack-protector-all -W -Wall -Wextra -Wunused -Wcast-align -Werror -pedantic -pedantic-errors -Wfloat-equal -Wpointer-arith -Wformat-security -Wmissing-format-attribute -Wformat=1 -Wwrite-strings -Wcast-align -Wno-long-long -std=gnu99 -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wold-style-definition -Wdeclaration-after-statement -Wbad-function-cast -Wnested-externs -O3
|
||||
|
||||
a08.exe: main.o array.o solve.o sort.o
|
||||
gcc main.o solve.o array.o sort.o -o a08.exe -lssp
|
||||
a08.out: main.o array.o solve.o sort.o
|
||||
gcc main.o solve.o array.o sort.o -o a08.out
|
||||
|
||||
main.o: main.c
|
||||
gcc $(CFLAGS) -c main.c
|
||||
|
@ -16,4 +16,4 @@ sort.o: sort.c
|
|||
gcc $(CFLAGS) -c sort.c
|
||||
|
||||
clean:
|
||||
del *.o *.exe
|
||||
rm *.o *.out
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
FLAGS = -fstack-protector-all -W -Wall -Wextra -Wunused -Wcast-align -Werror -pedantic -pedantic-errors -Wfloat-equal -Wpointer-arith -Wformat-security -Wmissing-format-attribute -Wformat=1 -Wwrite-strings -Wcast-align -Wno-long-long -std=gnu99 -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wold-style-definition -Wdeclaration-after-statement -Wbad-function-cast -Wnested-externs -O3
|
||||
|
||||
a01.exe: main.o array_io.o solve.o init_f.o
|
||||
gcc main.o solve.o array_io.o init_f.o -o a01.exe -lssp
|
||||
a01.out: main.o array_io.o solve.o init_f.o
|
||||
gcc main.o solve.o array_io.o init_f.o -o a01.out
|
||||
|
||||
main.o: main.c
|
||||
gcc $(CFLAGS) -c main.c
|
||||
|
@ -16,4 +16,4 @@ init_f.o: init_f.c
|
|||
gcc $(CFLAGS) -c init_f.c
|
||||
|
||||
clean:
|
||||
del *.o *.exe
|
||||
rm *.o *.out
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
FLAGS = -fstack-protector-all -W -Wall -Wextra -Wunused -Wcast-align -Werror -pedantic -pedantic-errors -Wfloat-equal -Wpointer-arith -Wformat-security -Wmissing-format-attribute -Wformat=1 -Wwrite-strings -Wcast-align -Wno-long-long -std=gnu99 -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wold-style-definition -Wdeclaration-after-statement -Wbad-function-cast -Wnested-externs -O3
|
||||
|
||||
a02.exe: main.o array_io.o solve.o init_f.o
|
||||
gcc main.o solve.o array_io.o init_f.o -o a02.exe -lssp
|
||||
a02.out: main.o array_io.o solve.o init_f.o
|
||||
gcc main.o solve.o array_io.o init_f.o -o a02.out
|
||||
|
||||
main.o: main.c
|
||||
gcc $(CFLAGS) -c main.c
|
||||
|
@ -16,4 +16,4 @@ init_f.o: init_f.c
|
|||
gcc $(CFLAGS) -c init_f.c
|
||||
|
||||
clean:
|
||||
del *.o *.exe
|
||||
rm *.o *.out
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
FLAGS = -fstack-protector-all -W -Wall -Wextra -Wunused -Wcast-align -Werror -pedantic -pedantic-errors -Wfloat-equal -Wpointer-arith -Wformat-security -Wmissing-format-attribute -Wformat=1 -Wwrite-strings -Wcast-align -Wno-long-long -std=gnu99 -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wold-style-definition -Wdeclaration-after-statement -Wbad-function-cast -Wnested-externs -O3
|
||||
|
||||
a03.exe: main.o array_io.o solve.o init_f.o
|
||||
gcc main.o solve.o array_io.o init_f.o -o a03.exe -lssp
|
||||
a03.out: main.o array_io.o solve.o init_f.o
|
||||
gcc main.o solve.o array_io.o init_f.o -o a03.out
|
||||
|
||||
main.o: main.c
|
||||
gcc $(CFLAGS) -c main.c
|
||||
|
@ -16,4 +16,4 @@ init_f.o: init_f.c
|
|||
gcc $(CFLAGS) -c init_f.c
|
||||
|
||||
clean:
|
||||
del *.o *.exe
|
||||
rm *.o *.out
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
FLAGS = -fstack-protector-all -W -Wall -Wextra -Wunused -Wcast-align -Werror -pedantic -pedantic-errors -Wfloat-equal -Wpointer-arith -Wformat-security -Wmissing-format-attribute -Wformat=1 -Wwrite-strings -Wcast-align -Wno-long-long -std=gnu99 -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wold-style-definition -Wdeclaration-after-statement -Wbad-function-cast -Wnested-externs -O3
|
||||
|
||||
a04.exe: main.o array_io.o solve.o init_f.o
|
||||
gcc main.o solve.o array_io.o init_f.o -o a04.exe -lssp
|
||||
a04.out: main.o array_io.o solve.o init_f.o
|
||||
gcc main.o solve.o array_io.o init_f.o -o a04.out
|
||||
|
||||
main.o: main.c
|
||||
gcc $(CFLAGS) -c main.c
|
||||
|
@ -16,4 +16,4 @@ init_f.o: init_f.c
|
|||
gcc $(CFLAGS) -c init_f.c
|
||||
|
||||
clean:
|
||||
del *.o *.exe
|
||||
rm *.o *.out
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
FLAGS = -fstack-protector-all -W -Wall -Wextra -Wunused -Wcast-align -Werror -pedantic -pedantic-errors -Wfloat-equal -Wpointer-arith -Wformat-security -Wmissing-format-attribute -Wformat=1 -Wwrite-strings -Wcast-align -Wno-long-long -std=gnu99 -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wold-style-definition -Wdeclaration-after-statement -Wbad-function-cast -Wnested-externs -O3
|
||||
|
||||
a05.exe: main.o array_io.o solve.o init_f.o
|
||||
gcc main.o solve.o array_io.o init_f.o -o a05.exe -lssp
|
||||
a05.out: main.o array_io.o solve.o init_f.o
|
||||
gcc main.o solve.o array_io.o init_f.o -o a05.out
|
||||
|
||||
main.o: main.c
|
||||
gcc $(CFLAGS) -c main.c
|
||||
|
@ -16,4 +16,4 @@ init_f.o: init_f.c
|
|||
gcc $(CFLAGS) -c init_f.c
|
||||
|
||||
clean:
|
||||
del *.o *.exe
|
||||
rm *.o *.out
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
FLAGS = -fstack-protector-all -W -Wall -Wextra -Wunused -Wcast-align -Werror -pedantic -pedantic-errors -Wfloat-equal -Wpointer-arith -Wformat-security -Wmissing-format-attribute -Wformat=1 -Wwrite-strings -Wcast-align -Wno-long-long -std=gnu99 -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wold-style-definition -Wdeclaration-after-statement -Wbad-function-cast -Wnested-externs -O3
|
||||
|
||||
a05.exe: main.o array_io.o solve.o init_f.o
|
||||
gcc main.o solve.o array_io.o init_f.o -o a05.exe -lssp
|
||||
a05.out: main.o array_io.o solve.o init_f.o
|
||||
gcc main.o solve.o array_io.o init_f.o -o a05.out
|
||||
|
||||
main.o: main.c
|
||||
gcc $(CFLAGS) -c main.c
|
||||
|
@ -16,4 +16,4 @@ init_f.o: init_f.c
|
|||
gcc $(CFLAGS) -c init_f.c
|
||||
|
||||
clean:
|
||||
del *.o *.exe
|
||||
rm *.o *.out
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
FLAGS = -fstack-protector-all -W -Wall -Wextra -Wunused -Wcast-align -Werror -pedantic -pedantic-errors -Wfloat-equal -Wpointer-arith -Wformat-security -Wmissing-format-attribute -Wformat=1 -Wwrite-strings -Wcast-align -Wno-long-long -std=gnu99 -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wold-style-definition -Wdeclaration-after-statement -Wbad-function-cast -Wnested-externs -O3
|
||||
|
||||
a07.exe: main.o array_io.o solve.o init_f.o
|
||||
gcc main.o solve.o array_io.o init_f.o -o a07.exe -lssp
|
||||
a07.out: main.o array_io.o solve.o init_f.o
|
||||
gcc main.o solve.o array_io.o init_f.o -o a07.out
|
||||
|
||||
main.o: main.c
|
||||
gcc $(CFLAGS) -c main.c
|
||||
|
@ -16,4 +16,4 @@ init_f.o: init_f.c
|
|||
gcc $(CFLAGS) -c init_f.c
|
||||
|
||||
clean:
|
||||
del *.o *.exe
|
||||
rm *.o *.out
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
FLAGS = -fstack-protector-all -W -Wall -Wextra -Wunused -Wcast-align -Werror -pedantic -pedantic-errors -Wfloat-equal -Wpointer-arith -Wformat-security -Wmissing-format-attribute -Wformat=1 -Wwrite-strings -Wcast-align -Wno-long-long -std=gnu99 -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wold-style-definition -Wdeclaration-after-statement -Wbad-function-cast -Wnested-externs -O3
|
||||
|
||||
a08.exe: main.o array_io.o solve.o init_f.o
|
||||
gcc main.o solve.o array_io.o init_f.o -o a08.exe -lssp
|
||||
a08.out: main.o array_io.o solve.o init_f.o
|
||||
gcc main.o solve.o array_io.o init_f.o -o a08.out
|
||||
|
||||
main.o: main.c
|
||||
gcc $(CFLAGS) -c main.c
|
||||
|
@ -16,4 +16,4 @@ init_f.o: init_f.c
|
|||
gcc $(CFLAGS) -c init_f.c
|
||||
|
||||
clean:
|
||||
del *.o *.exe
|
||||
rm *.o *.out
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
FLAGS = -fstack-protector-all -W -Wall -Wextra -Wunused -Wcast-align -Werror -pedantic -pedantic-errors -Wfloat-equal -Wpointer-arith -Wformat-security -Wmissing-format-attribute -Wformat=1 -Wwrite-strings -Wcast-align -Wno-long-long -std=gnu99 -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wold-style-definition -Wdeclaration-after-statement -Wbad-function-cast -Wnested-externs -O3
|
||||
|
||||
a09.exe: main.o array_io.o solve.o init_f.o
|
||||
gcc main.o solve.o array_io.o init_f.o -o a09.exe -lssp
|
||||
a09.out: main.o array_io.o solve.o init_f.o
|
||||
gcc main.o solve.o array_io.o init_f.o -o a09.out
|
||||
|
||||
main.o: main.c
|
||||
gcc $(CFLAGS) -c main.c
|
||||
|
@ -16,4 +16,4 @@ init_f.o: init_f.c
|
|||
gcc $(CFLAGS) -c init_f.c
|
||||
|
||||
clean:
|
||||
del *.o *.exe
|
||||
rm *.o *.out
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
FLAGS = -fstack-protector-all -W -Wall -Wextra -Wunused -Wcast-align -Werror -pedantic -pedantic-errors -Wfloat-equal -Wpointer-arith -Wformat-security -Wmissing-format-attribute -Wformat=1 -Wwrite-strings -Wcast-align -Wno-long-long -std=gnu99 -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wold-style-definition -Wdeclaration-after-statement -Wbad-function-cast -Wnested-externs -O3
|
||||
|
||||
a10.exe: main.o array_io.o solve.o init_f.o
|
||||
gcc main.o solve.o array_io.o init_f.o -o a10.exe -lssp
|
||||
a10.out: main.o array_io.o solve.o init_f.o
|
||||
gcc main.o solve.o array_io.o init_f.o -o a10.out
|
||||
|
||||
main.o: main.c
|
||||
gcc $(CFLAGS) -c main.c
|
||||
|
@ -16,4 +16,4 @@ init_f.o: init_f.c
|
|||
gcc $(CFLAGS) -c init_f.c
|
||||
|
||||
clean:
|
||||
del *.o *.exe
|
||||
rm *.o *.out
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
FLAGS = -fstack-protector-all -W -Wall -Wextra -Wunused -Wcast-align -Werror -pedantic -pedantic-errors -Wfloat-equal -Wpointer-arith -Wformat-security -Wmissing-format-attribute -Wformat=1 -Wwrite-strings -Wcast-align -Wno-long-long -std=gnu99 -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wold-style-definition -Wdeclaration-after-statement -Wbad-function-cast -Wnested-externs -O3
|
||||
|
||||
a11.exe: main.o array_io.o solve.o init_f.o
|
||||
gcc main.o solve.o array_io.o init_f.o -o a11.exe -lssp
|
||||
a11.out: main.o array_io.o solve.o init_f.o
|
||||
gcc main.o solve.o array_io.o init_f.o -o a11.out
|
||||
|
||||
main.o: main.c
|
||||
gcc $(CFLAGS) -c main.c
|
||||
|
@ -16,4 +16,4 @@ init_f.o: init_f.c
|
|||
gcc $(CFLAGS) -c init_f.c
|
||||
|
||||
clean:
|
||||
del *.o *.exe
|
||||
rm *.o *.out
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
FLAGS = -fstack-protector-all -W -Wall -Wextra -Wunused -Wcast-align -Werror -pedantic -pedantic-errors -Wfloat-equal -Wpointer-arith -Wformat-security -Wmissing-format-attribute -Wformat=1 -Wwrite-strings -Wcast-align -Wno-long-long -std=gnu99 -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wold-style-definition -Wdeclaration-after-statement -Wbad-function-cast -Wnested-externs -O3
|
||||
|
||||
a01.exe: main.o array_io.o solve.o init_f.o
|
||||
gcc main.o solve.o array_io.o init_f.o -o a01.exe -lssp
|
||||
a01.out: main.o array_io.o solve.o init_f.o
|
||||
gcc main.o solve.o array_io.o init_f.o -o a01.out
|
||||
|
||||
main.o: main.c
|
||||
gcc $(CFLAGS) -c main.c
|
||||
|
@ -16,4 +16,4 @@ init_f.o: init_f.c
|
|||
gcc $(CFLAGS) -c init_f.c
|
||||
|
||||
clean:
|
||||
del *.o *.exe
|
||||
rm *.o *.out
|
||||
|
|
|
@ -8,11 +8,11 @@ CFLAGS = -mfpmath=sse -fstack-protector-all -W -Wall -Wextra -Wunused \
|
|||
-Wwrite-strings -Wno-long-long -std=gnu99 -Wstrict-prototypes \
|
||||
-Wmissing-field-initializers -Wpointer-sign -O3
|
||||
|
||||
TARGET = a01.exe
|
||||
TARGET = a01.out
|
||||
OBJ = main.o array_io.o solve.o init_f.o
|
||||
|
||||
$(TARGET): $(OBJ)
|
||||
gcc $(OBJ) -o $(TARGET) -lssp
|
||||
gcc $(OBJ) -o $(TARGET)
|
||||
|
||||
main.o: main.c
|
||||
gcc $(CFLAGS) -c main.c
|
||||
|
@ -27,4 +27,4 @@ init_f.o: init_f.c
|
|||
gcc $(CFLAGS) -c init_f.c
|
||||
|
||||
clean:
|
||||
del *.o *.exe
|
||||
rm *.o *.out
|
||||
|
|
|
@ -8,11 +8,11 @@ CFLAGS = -mfpmath=sse -fstack-protector-all -W -Wall -Wextra -Wunused \
|
|||
-Wwrite-strings -Wno-long-long -std=gnu99 -Wstrict-prototypes \
|
||||
-Wmissing-field-initializers -Wpointer-sign -O3
|
||||
|
||||
TARGET = a02.exe
|
||||
TARGET = a02.out
|
||||
OBJ = main.o array_io.o solve.o init_f.o
|
||||
|
||||
$(TARGET): $(OBJ)
|
||||
gcc $(OBJ) -o $(TARGET) -lssp
|
||||
gcc $(OBJ) -o $(TARGET)
|
||||
|
||||
main.o: main.c
|
||||
gcc $(CFLAGS) -c main.c
|
||||
|
@ -27,4 +27,4 @@ init_f.o: init_f.c
|
|||
gcc $(CFLAGS) -c init_f.c
|
||||
|
||||
clean:
|
||||
del *.o *.exe
|
||||
rm *.o *.out
|
||||
|
|
|
@ -8,11 +8,11 @@ CFLAGS = -mfpmath=sse -fstack-protector-all -W -Wall -Wextra -Wunused \
|
|||
-Wwrite-strings -Wno-long-long -std=gnu99 -Wstrict-prototypes \
|
||||
-Wmissing-field-initializers -Wpointer-sign -O3
|
||||
|
||||
TARGET = a03.exe
|
||||
TARGET = a03.out
|
||||
OBJ = main.o array_io.o solve.o init_f.o
|
||||
|
||||
$(TARGET): $(OBJ)
|
||||
gcc $(OBJ) -o $(TARGET) -lssp
|
||||
gcc $(OBJ) -o $(TARGET)
|
||||
|
||||
main.o: main.c
|
||||
gcc $(CFLAGS) -c main.c
|
||||
|
@ -27,4 +27,4 @@ init_f.o: init_f.c
|
|||
gcc $(CFLAGS) -c init_f.c
|
||||
|
||||
clean:
|
||||
del *.o *.exe
|
||||
rm *.o *.out
|
||||
|
|
|
@ -8,11 +8,11 @@ CFLAGS = -mfpmath=sse -fstack-protector-all -W -Wall -Wextra -Wunused \
|
|||
-Wwrite-strings -Wno-long-long -std=gnu99 -Wstrict-prototypes \
|
||||
-Wmissing-field-initializers -Wpointer-sign -O3
|
||||
|
||||
TARGET = a04.exe
|
||||
TARGET = a04.out
|
||||
OBJ = main.o array_io.o solve.o init_f.o
|
||||
|
||||
$(TARGET): $(OBJ)
|
||||
gcc $(OBJ) -o $(TARGET) -lssp
|
||||
gcc $(OBJ) -o $(TARGET)
|
||||
|
||||
main.o: main.c
|
||||
gcc $(CFLAGS) -c main.c
|
||||
|
@ -27,4 +27,4 @@ init_f.o: init_f.c
|
|||
gcc $(CFLAGS) -c init_f.c
|
||||
|
||||
clean:
|
||||
del *.o *.exe
|
||||
rm *.o *.out
|
||||
|
|
|
@ -8,11 +8,11 @@ CFLAGS = -mfpmath=sse -fstack-protector-all -W -Wall -Wextra -Wunused \
|
|||
-Wwrite-strings -Wno-long-long -std=gnu99 -Wstrict-prototypes \
|
||||
-Wmissing-field-initializers -Wpointer-sign -O3
|
||||
|
||||
TARGET = a05.exe
|
||||
TARGET = a05.out
|
||||
OBJ = main.o array_io.o solve.o init_f.o
|
||||
|
||||
$(TARGET): $(OBJ)
|
||||
gcc $(OBJ) -o $(TARGET) -lm -lssp
|
||||
gcc $(OBJ) -o $(TARGET) -lm
|
||||
|
||||
|
||||
main.o: main.c
|
||||
|
@ -28,4 +28,4 @@ init_f.o: init_f.c
|
|||
gcc $(CFLAGS) -c init_f.c
|
||||
|
||||
clean:
|
||||
del *.o *.exe
|
||||
rm *.o *.out
|
||||
|
|
|
@ -8,11 +8,11 @@ CFLAGS = -mfpmath=sse -fstack-protector-all -W -Wall -Wextra -Wunused \
|
|||
-Wwrite-strings -Wno-long-long -std=gnu99 -Wstrict-prototypes \
|
||||
-Wmissing-field-initializers -Wpointer-sign -O3
|
||||
|
||||
TARGET = a06.exe
|
||||
TARGET = a06.out
|
||||
OBJ = main.o array_io.o solve.o init_f.o
|
||||
|
||||
$(TARGET): $(OBJ)
|
||||
gcc $(OBJ) -o $(TARGET) -lssp
|
||||
gcc $(OBJ) -o $(TARGET)
|
||||
|
||||
|
||||
main.o: main.c
|
||||
|
@ -28,4 +28,4 @@ init_f.o: init_f.c
|
|||
gcc $(CFLAGS) -c init_f.c
|
||||
|
||||
clean:
|
||||
del *.o *.exe
|
||||
rm *.o *.out
|
||||
|
|
|
@ -8,11 +8,11 @@ CFLAGS = -mfpmath=sse -fstack-protector-all -W -Wall -Wextra -Wunused \
|
|||
-Wwrite-strings -Wno-long-long -std=gnu99 -Wstrict-prototypes \
|
||||
-Wmissing-field-initializers -Wpointer-sign -O3
|
||||
|
||||
TARGET = a07.exe
|
||||
TARGET = a07.out
|
||||
OBJ = main.o array_io.o solve.o init_f.o
|
||||
|
||||
$(TARGET): $(OBJ)
|
||||
gcc $(OBJ) -o $(TARGET) -lssp
|
||||
gcc $(OBJ) -o $(TARGET)
|
||||
|
||||
|
||||
main.o: main.c
|
||||
|
@ -28,4 +28,4 @@ init_f.o: init_f.c
|
|||
gcc $(CFLAGS) -c init_f.c
|
||||
|
||||
clean:
|
||||
del *.o *.exe
|
||||
rm *.o *.out
|
||||
|
|
|
@ -8,12 +8,12 @@ CFLAGS = -mfpmath=sse -fstack-protector-all -W -Wall -Wextra -Wunused \
|
|||
-Wwrite-strings -Wno-long-long -std=gnu99 -Wstrict-prototypes \
|
||||
-Wmissing-field-initializers -Wpointer-sign -O3
|
||||
|
||||
TARGET = a08.exe
|
||||
TARGET = a08.out
|
||||
OBJ = main.o array_io.o init_f.o
|
||||
|
||||
$(TARGET): $(OBJ) solve.o slow.o
|
||||
gcc $(OBJ) solve.o -o $(TARGET) -lssp
|
||||
gcc $(OBJ) slow.o -o sa08.exe -lssp
|
||||
gcc $(OBJ) solve.o -o $(TARGET)
|
||||
gcc $(OBJ) slow.o -o sa08.out
|
||||
|
||||
main.o: main.c
|
||||
gcc $(CFLAGS) -c main.c
|
||||
|
@ -31,4 +31,4 @@ init_f.o: init_f.c
|
|||
gcc $(CFLAGS) -c init_f.c
|
||||
|
||||
clean:
|
||||
del *.o *.exe
|
||||
rm *.o *.out
|
||||
|
|
|
@ -8,11 +8,11 @@ CFLAGS = -mfpmath=sse -fstack-protector-all -W -Wall -Wextra -Wunused \
|
|||
-Wwrite-strings -Wno-long-long -std=gnu99 -Wstrict-prototypes \
|
||||
-Wmissing-field-initializers -Wpointer-sign -O3
|
||||
|
||||
TARGET = a09.exe
|
||||
TARGET = a09.out
|
||||
OBJ = main.o solve.o array_io.o init_f.o
|
||||
|
||||
$(TARGET): $(OBJ)
|
||||
gcc $(OBJ) -o $(TARGET) -lssp
|
||||
gcc $(OBJ) -o $(TARGET)
|
||||
|
||||
main.o: main.c
|
||||
gcc $(CFLAGS) -c main.c
|
||||
|
@ -27,4 +27,4 @@ init_f.o: init_f.c
|
|||
gcc $(CFLAGS) -c init_f.c
|
||||
|
||||
clean:
|
||||
del *.o *.exe
|
||||
rm *.o *.out
|
||||
|
|
|
@ -8,11 +8,11 @@ CFLAGS = -mfpmath=sse -fstack-protector-all -W -Wall -Wextra -Wunused \
|
|||
-Wwrite-strings -Wno-long-long -std=gnu99 -Wstrict-prototypes \
|
||||
-Wmissing-field-initializers -Wpointer-sign -O3
|
||||
|
||||
TARGET = a10.exe
|
||||
TARGET = a10.out
|
||||
OBJ = main.o solve.o array_io.o init_f.o
|
||||
|
||||
$(TARGET): $(OBJ)
|
||||
gcc $^ -o $@ -lm -lssp
|
||||
gcc $^ -o $@ -lm
|
||||
|
||||
main.o: main.c
|
||||
gcc $(CFLAGS) -c $^
|
||||
|
@ -27,4 +27,4 @@ init_f.o: init_f.c
|
|||
gcc $(CFLAGS) -c $^
|
||||
|
||||
clean:
|
||||
del *.o *.exe
|
||||
rm *.o *.out
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
FLAGS = -fstack-protector-all -W -Wall -Wextra -Wunused -Wcast-align -Werror -pedantic -pedantic-errors -Wfloat-equal -Wpointer-arith -Wformat-security -Wmissing-format-attribute -Wformat=1 -Wwrite-strings -Wcast-align -Wno-long-long -std=gnu99 -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wold-style-definition -Wdeclaration-after-statement -Wbad-function-cast -Wnested-externs -O3
|
||||
|
||||
a01.exe: main.o array_io.o solve.o init_f.o
|
||||
gcc main.o solve.o array_io.o init_f.o -o a01.exe -lssp
|
||||
a01.out: main.o array_io.o solve.o init_f.o
|
||||
gcc main.o solve.o array_io.o init_f.o -o a01.out
|
||||
|
||||
main.o: main.c
|
||||
gcc $(CFLAGS) -c main.c
|
||||
|
@ -16,4 +16,4 @@ init_f.o: init_f.c
|
|||
gcc $(CFLAGS) -c init_f.c
|
||||
|
||||
clean:
|
||||
del *.o *.exe
|
||||
rm *.o *.out
|
||||
|
|
|
@ -8,11 +8,11 @@ CFLAGS = -mfpmath=sse -fstack-protector-all -W -Wall -Wextra -Wunused \
|
|||
-Wwrite-strings -Wno-long-long -std=gnu99 -Wstrict-prototypes \
|
||||
-Wmissing-field-initializers -Wpointer-sign -fopenmp -O3
|
||||
|
||||
TARGET = a01.exe
|
||||
TARGET = a01.out
|
||||
OBJ = main.o solve.o array_io.o init_f.o
|
||||
|
||||
$(TARGET): $(OBJ)
|
||||
gcc $^ -o $@ -lm -fopenmp -lssp
|
||||
gcc $^ -o $@ -lm -fopenmp
|
||||
|
||||
main.o: main.c
|
||||
gcc $(CFLAGS) -c $^
|
||||
|
@ -27,4 +27,4 @@ init_f.o: init_f.c
|
|||
gcc $(CFLAGS) -c $^
|
||||
|
||||
clean:
|
||||
del *.o *.exe
|
||||
rm *.o *.out
|
||||
|
|
33
2025.03.28/02Ex/Makefile
Normal file
33
2025.03.28/02Ex/Makefile
Normal file
|
@ -0,0 +1,33 @@
|
|||
CFLAGS = -mfpmath=sse -fstack-protector-all -W -Wall -Wextra -Wunused \
|
||||
-Wempty-body -Wlogical-op -Wold-style-declaration -Wmissing-parameter-type \
|
||||
-Wignored-qualifiers -Winit-self -Wshadow -Wtype-limits \
|
||||
-Wpointer-arith -Wformat-security -Wmissing-format-attribute -Wformat=1 \
|
||||
-Wdeclaration-after-statement -Wbad-function-cast -Wnested-externs \
|
||||
-Wmissing-prototypes -Wmissing-declarations -Wold-style-definition \
|
||||
-Wcast-align -Werror -pedantic -pedantic-errors -Wfloat-equal \
|
||||
-Wwrite-strings -Wno-long-long -std=gnu99 -Wstrict-prototypes \
|
||||
-Wmissing-field-initializers -Wpointer-sign -fopenmp -O3
|
||||
|
||||
TARGET = a02.out
|
||||
OBJ = main.o solve.o array_io.o init_f.o matrix.o
|
||||
|
||||
$(TARGET): $(OBJ)
|
||||
gcc $^ -o $@ -lm -fopenmp
|
||||
|
||||
main.o: main.c
|
||||
gcc $(CFLAGS) -c $^
|
||||
|
||||
solve.o: solve.c
|
||||
gcc $(CFLAGS) -c $^
|
||||
|
||||
array_io.o: array_io.c
|
||||
gcc $(CFLAGS) -c $^
|
||||
|
||||
init_f.o: init_f.c
|
||||
gcc $(CFLAGS) -c $^
|
||||
|
||||
matrix.o: matrix.c
|
||||
gcc $(CFLAGS) -c $^
|
||||
|
||||
clean:
|
||||
rm *.o *.out
|
40
2025.03.28/02Ex/array_io.c
Normal file
40
2025.03.28/02Ex/array_io.c
Normal file
|
@ -0,0 +1,40 @@
|
|||
#include <stdio.h>
|
||||
#include "array_io.h"
|
||||
|
||||
io_status read_matrix(double *a, int m, int n, const char *name)
|
||||
{
|
||||
int i, j;
|
||||
FILE *fp;
|
||||
if (!(fp = fopen(name, "r"))) return ERROR_OPEN;
|
||||
for (i = 0; i < m; i++)
|
||||
for (j = 0; j < n; j++)
|
||||
if (fscanf(fp, "%lf", a + i * n + j) != 1)
|
||||
{fclose(fp); return ERROR_READ;}
|
||||
fclose(fp);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
void print_matrix(const double *a, int m, int n, int p)
|
||||
{
|
||||
int mp = (m > p ? p : m);
|
||||
int np = (n > p ? p : n);
|
||||
int i, j;
|
||||
|
||||
for (i = 0; i < mp; i++)
|
||||
{
|
||||
for (j = 0; j < np; j++)
|
||||
printf(" %10.3e", a[i * n + j]);
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
|
||||
void init_matrix(double *a, int m, int n, int k)
|
||||
{
|
||||
double (*q)(int, int, int, int);
|
||||
double (*f[])(int, int, int, int) = {f1, f2, f3, f4};
|
||||
int i, j;
|
||||
q = f[k-1];
|
||||
for (i = 0; i < m; i++)
|
||||
for (j = 0; j < n; j++)
|
||||
a[i * n + j] = q(m, n, i+1, j+1);
|
||||
}
|
11
2025.03.28/02Ex/array_io.h
Normal file
11
2025.03.28/02Ex/array_io.h
Normal file
|
@ -0,0 +1,11 @@
|
|||
#ifndef ARRAY_IO_H
|
||||
#define ARRAY_IO_H
|
||||
|
||||
#include "io_status.h"
|
||||
#include "init_f.h"
|
||||
|
||||
io_status read_matrix(double *a, int m, int n, const char *name);
|
||||
void print_matrix(const double *a, int m, int n, int p);
|
||||
void init_matrix(double *a, int m, int n, int k);
|
||||
|
||||
#endif
|
30
2025.03.28/02Ex/init_f.c
Normal file
30
2025.03.28/02Ex/init_f.c
Normal file
|
@ -0,0 +1,30 @@
|
|||
#include "init_f.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
#define MAX(n, m) (n < m ? m : n)
|
||||
|
||||
double f1(int m, int n, int i, int j)
|
||||
{
|
||||
return MAX(n, m) - MAX(i, j) + 1;
|
||||
}
|
||||
|
||||
double f2(int m, int n, int i, int j)
|
||||
{
|
||||
(void)n;
|
||||
(void)m;
|
||||
return MAX(i, j);
|
||||
}
|
||||
|
||||
double f3(int m, int n, int i, int j)
|
||||
{
|
||||
(void)n;
|
||||
(void)m;
|
||||
return abs(i - j);
|
||||
}
|
||||
|
||||
double f4(int m, int n, int i, int j)
|
||||
{
|
||||
(void)n;
|
||||
(void)m;
|
||||
return 1./(i+j-1);
|
||||
}
|
9
2025.03.28/02Ex/init_f.h
Normal file
9
2025.03.28/02Ex/init_f.h
Normal file
|
@ -0,0 +1,9 @@
|
|||
#ifndef INIT_F_H
|
||||
#define INIT_F_H
|
||||
|
||||
double f1(int m, int n, int i, int j);
|
||||
double f2(int m, int n, int i, int j);
|
||||
double f3(int m, int n, int i, int j);
|
||||
double f4(int m, int n, int i, int j);
|
||||
|
||||
#endif
|
13
2025.03.28/02Ex/io_status.h
Normal file
13
2025.03.28/02Ex/io_status.h
Normal file
|
@ -0,0 +1,13 @@
|
|||
#ifndef IO_STATUS_H
|
||||
#define IO_STATUS_H
|
||||
|
||||
#define LEN 1234
|
||||
|
||||
typedef enum _io_status
|
||||
{
|
||||
SUCCESS,
|
||||
ERROR_OPEN,
|
||||
ERROR_READ
|
||||
} io_status;
|
||||
|
||||
#endif
|
144
2025.03.28/02Ex/main.c
Normal file
144
2025.03.28/02Ex/main.c
Normal file
|
@ -0,0 +1,144 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include "array_io.h"
|
||||
#include "io_status.h"
|
||||
#include "matrix.h"
|
||||
#include "solve.h"
|
||||
|
||||
/* ./a.out t m n p k_a [filename_a] k_x [filename_x] */
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
double tau, t, r1, r2, *a, *x_0, *b, *x;
|
||||
int n, m, p, k_a, k_x, task = 2;
|
||||
char *name_a = 0, *name_x = 0;
|
||||
if (!((argc == 7 || argc == 8 || argc == 9) &&
|
||||
sscanf(argv[1], "%lf", &tau) == 1 &&
|
||||
sscanf(argv[2], "%d", &m) == 1 &&
|
||||
sscanf(argv[3], "%d", &n) == 1 &&
|
||||
sscanf(argv[4], "%d", &p) == 1 &&
|
||||
sscanf(argv[5], "%d", &k_a) == 1 &&
|
||||
(k_a >= 0 && k_a <= 4) &&
|
||||
(!(k_a == 0 && argc == 7)) &&
|
||||
((k_a == 0 && sscanf(argv[7], "%d", &k_x) == 1) ||
|
||||
(k_a != 0 && sscanf(argv[6], "%d", &k_x) == 1)) &&
|
||||
(k_x >= 0 && k_x <= 4) &&
|
||||
(!(k_x == 0 && argc == 7)) &&
|
||||
(!((k_a == 0 && k_x == 0) && argc != 9))))
|
||||
{
|
||||
printf("Usage: %s t m n p k_a [filename_a] k_x [filename_x]\n", argv[0]);
|
||||
return 1;
|
||||
}
|
||||
if (argc != 7)
|
||||
{
|
||||
int i_x = 7;
|
||||
if (k_a == 0) { name_a = argv[6]; i_x++; }
|
||||
if (k_x == 0) name_x = argv[i_x];
|
||||
}
|
||||
|
||||
a = (double *)malloc((size_t)n * (size_t)n * sizeof(double));
|
||||
if (!a)
|
||||
{
|
||||
printf("Not enough memory\n");
|
||||
return 2;
|
||||
}
|
||||
x_0 = (double *)malloc((size_t)n * sizeof(double));
|
||||
if (!x_0)
|
||||
{
|
||||
free(a);
|
||||
printf("Not enough memory\n");
|
||||
return 2;
|
||||
}
|
||||
b = (double *)malloc((size_t)n * sizeof(double));
|
||||
if (!b)
|
||||
{
|
||||
free(a);
|
||||
free(x_0);
|
||||
printf("Not enough memory\n");
|
||||
return 2;
|
||||
}
|
||||
x = (double *)malloc((size_t)n * sizeof(double));
|
||||
if (!x)
|
||||
{
|
||||
free(a);
|
||||
free(x_0);
|
||||
free(b);
|
||||
printf("Not enough memory\n");
|
||||
return 2;
|
||||
}
|
||||
|
||||
if (name_a)
|
||||
{ /* из файла */
|
||||
io_status ret;
|
||||
ret = read_matrix(a, n, n, name_a);
|
||||
do {
|
||||
switch (ret)
|
||||
{
|
||||
case SUCCESS:
|
||||
continue;
|
||||
case ERROR_OPEN:
|
||||
printf("Cannot open %s\n", name_a);
|
||||
break;
|
||||
case ERROR_READ:
|
||||
printf("Cannot read %s\n", name_a);
|
||||
break;
|
||||
}
|
||||
free(a);
|
||||
free(x_0);
|
||||
free(b);
|
||||
free(x);
|
||||
return 3;
|
||||
} while (0);
|
||||
} else init_matrix(a, n, n, k_a);
|
||||
|
||||
if (name_x)
|
||||
{
|
||||
io_status ret;
|
||||
ret = read_matrix(x_0, n, 1, name_x);
|
||||
do {
|
||||
switch (ret)
|
||||
{
|
||||
case SUCCESS:
|
||||
continue;
|
||||
case ERROR_OPEN:
|
||||
printf("Cannot open %s\n", name_x);
|
||||
break;
|
||||
case ERROR_READ:
|
||||
printf("Cannot read %s\n", name_x);
|
||||
break;
|
||||
}
|
||||
free(a);
|
||||
free(x_0);
|
||||
free(b);
|
||||
free(x);
|
||||
return 3;
|
||||
} while (0);
|
||||
} else init_matrix(x_0, n, 1, k_x);
|
||||
|
||||
init_vec_b(a, b, n);
|
||||
|
||||
printf("Matrix A:\n");
|
||||
print_matrix(a, n, n, p);
|
||||
printf("Vector x_0:\n");
|
||||
print_matrix(x_0, 1, n, p);
|
||||
printf("Vector b:\n");
|
||||
print_matrix(b, 1, n, p);
|
||||
|
||||
t = clock();
|
||||
t2_solve(a, x_0, b, x, n, m, tau);
|
||||
t = (clock() - t) / CLOCKS_PER_SEC;
|
||||
|
||||
r1 = t2_get_r1(a, x, b, n);
|
||||
r2 = t2_get_r2_value(x, n);
|
||||
|
||||
printf("Vector x_m:\n");
|
||||
print_matrix(x, 1, n, p);
|
||||
printf("%s : Task = %d Res1 = %e Res2 = %e Elapsed = %.2f\n", argv[0], task, r1, r2, t);
|
||||
|
||||
free(a);
|
||||
free(x_0);
|
||||
free(b);
|
||||
free(x);
|
||||
|
||||
return 0;
|
||||
}
|
34
2025.03.28/02Ex/matrix.c
Normal file
34
2025.03.28/02Ex/matrix.c
Normal file
|
@ -0,0 +1,34 @@
|
|||
#include "matrix.h"
|
||||
#include <math.h>
|
||||
|
||||
void init_vec_b(const double * restrict a, double * restrict b, int n)
|
||||
{
|
||||
#pragma omp parallel for
|
||||
for (int i = 0; i < n; ++i)
|
||||
{
|
||||
double sum = 0;
|
||||
|
||||
// #pragma omp simd reduction(+:sum)
|
||||
// for (int k = 1; k < n; k+=2)
|
||||
// sum += a[i * n + k];
|
||||
|
||||
for (int k = 0; k < (n-1)/2; ++k)
|
||||
sum += a[i*n + 2*k+1];
|
||||
|
||||
b[i] = sum;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void matvec_mul(int n, const double * restrict A, const double * restrict x, double * restrict x_k)
|
||||
{
|
||||
#pragma omp parallel for
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
double sum = 0;
|
||||
#pragma omp simd reduction(+:sum)
|
||||
for (int j = 0; j < n; j++)
|
||||
sum += A[i * n + j] * x[j];
|
||||
x_k[i] = sum;
|
||||
}
|
||||
}
|
7
2025.03.28/02Ex/matrix.h
Normal file
7
2025.03.28/02Ex/matrix.h
Normal file
|
@ -0,0 +1,7 @@
|
|||
#ifndef MATRIX_H
|
||||
#define MATRIX_H
|
||||
|
||||
void init_vec_b(const double * restrict a, double * restrict b, int n);
|
||||
void matvec_mul(int n, const double * restrict A, const double * restrict x, double * restrict x_k);
|
||||
|
||||
#endif
|
79
2025.03.28/02Ex/solve.c
Normal file
79
2025.03.28/02Ex/solve.c
Normal file
|
@ -0,0 +1,79 @@
|
|||
#include "solve.h"
|
||||
#include "matrix.h"
|
||||
#include <math.h>
|
||||
|
||||
|
||||
void t2_solve(const double * restrict A, double * restrict x_0, const double * restrict b, double * restrict x, int n, int m, double t)
|
||||
{
|
||||
#pragma omp parallel for
|
||||
for (int k = 0; k < m; ++k)
|
||||
{
|
||||
double * swap_temp;
|
||||
matvec_mul(n, A, x_0, x);
|
||||
|
||||
#pragma omp simd
|
||||
for (int i = 0; i < n; ++i)
|
||||
x[i] = (b[i] - x[i]) * t + x_0[i];
|
||||
|
||||
swap_temp = x;
|
||||
x = x_0;
|
||||
x_0 = swap_temp;
|
||||
}
|
||||
|
||||
if (m % 2 == 0)
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
double temp = x[i];
|
||||
x[i] = x_0[i];
|
||||
x_0[i] = temp;
|
||||
}
|
||||
else
|
||||
{
|
||||
double * swap_temp = x;
|
||||
x = x_0;
|
||||
x_0 = swap_temp;
|
||||
}
|
||||
}
|
||||
|
||||
double t2_get_r1(const double * restrict A, const double * restrict x_k, const double * restrict b, int n)
|
||||
{
|
||||
double norm_r1x_1 = 0;
|
||||
double residual_norm_1 = 0;
|
||||
double r1 = 0;
|
||||
|
||||
#pragma omp parallel for reduction(+:residual_norm_1, norm_r1x_1)
|
||||
for (int i = 0; i < n; ++i)
|
||||
{
|
||||
double bi = b[i];
|
||||
double sum = 0;
|
||||
|
||||
#pragma omp simd reduction(+:sum)
|
||||
for (int j = 0; j < n; ++j)
|
||||
sum += A[i*n + j] * x_k[j];
|
||||
|
||||
residual_norm_1 += fabs(sum - bi);
|
||||
norm_r1x_1 += fabs(bi);
|
||||
}
|
||||
|
||||
r1 = residual_norm_1 / norm_r1x_1;
|
||||
|
||||
return r1;
|
||||
}
|
||||
|
||||
double t2_get_r2_value(const double * restrict x_k, int n)
|
||||
{
|
||||
double r2 = 0;
|
||||
double abs_xi = 0;
|
||||
double abs_i = 0;
|
||||
|
||||
#pragma omp parallel for reduction(+:abs_xi, abs_i)
|
||||
for (int i = 0; i < n; ++i)
|
||||
{
|
||||
short int modi = i ^ 1;
|
||||
abs_xi += fabs(x_k[i] - modi);
|
||||
abs_i += modi;
|
||||
}
|
||||
|
||||
r2 = abs_xi / abs_i;
|
||||
return r2;
|
||||
}
|
8
2025.03.28/02Ex/solve.h
Normal file
8
2025.03.28/02Ex/solve.h
Normal file
|
@ -0,0 +1,8 @@
|
|||
#ifndef SOLVE_H
|
||||
#define SOLVE_H
|
||||
|
||||
void t2_solve(const double * restrict A, double * restrict x_0, const double * restrict b, double * restrict x, int n, int m, double t);
|
||||
double t2_get_r1(const double * restrict A, const double * restrict x_k, const double * restrict b, int n);
|
||||
double t2_get_r2_value(const double * restrict x_k, int n);
|
||||
|
||||
#endif
|
|
@ -8,11 +8,11 @@ CFLAGS = -mfpmath=sse -fstack-protector-all -W -Wall -Wextra -Wunused \
|
|||
-Wwrite-strings -Wno-long-long -std=gnu99 -Wstrict-prototypes \
|
||||
-Wmissing-field-initializers -Wpointer-sign -fopenmp -O3
|
||||
|
||||
TARGET = a01.exe
|
||||
TARGET = a01.out
|
||||
OBJ = main.o solve.o array_io.o init_f.o
|
||||
|
||||
$(TARGET): $(OBJ)
|
||||
gcc $^ -o $@ -lm -fopenmp -lssp
|
||||
gcc $^ -o $@ -lm -fopenmp
|
||||
|
||||
main.o: main.c
|
||||
gcc $(CFLAGS) -c $^
|
||||
|
@ -27,4 +27,4 @@ init_f.o: init_f.c
|
|||
gcc $(CFLAGS) -c $^
|
||||
|
||||
clean:
|
||||
del *.o *.exe
|
||||
rm *.o *.out
|
||||
|
|
|
@ -8,11 +8,11 @@ CFLAGS = -mfpmath=sse -fstack-protector-all -W -Wall -Wextra -Wunused \
|
|||
-Wwrite-strings -Wno-long-long -std=gnu99 -Wstrict-prototypes \
|
||||
-Wmissing-field-initializers -Wpointer-sign -fopenmp -O3
|
||||
|
||||
TARGET = a01.exe
|
||||
TARGET = a01.out
|
||||
OBJ = main.o solve.o array_io.o init_f.o
|
||||
|
||||
$(TARGET): $(OBJ)
|
||||
gcc $^ -o $@ -lm -fopenmp -lssp
|
||||
gcc $^ -o $@ -lm -fopenmp
|
||||
|
||||
main.o: main.c
|
||||
gcc $(CFLAGS) -c $^
|
||||
|
@ -27,4 +27,4 @@ init_f.o: init_f.c
|
|||
gcc $(CFLAGS) -c $^
|
||||
|
||||
clean:
|
||||
del *.o *.exe
|
||||
rm *.o *.out
|
||||
|
|
20
2025.03.28/Matvei/Makefile
Normal file
20
2025.03.28/Matvei/Makefile
Normal file
|
@ -0,0 +1,20 @@
|
|||
FLAGS = -mfpmath=sse -fstack-protector-all -W -Wall -Wextra -Wunused -Wcast-align -Werror -pedantic -pedantic-errors -Wfloat-equal -Wpointer-arith -Wformat-security -Wmissing-format-attribute -Wformat=1 -Wwrite-strings -Wcast-align -Wno-long-long -std=gnu99 -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wold-style-definition -Wdeclaration-after-statement -Wbad-function-cast -Wnested-externs -Wmaybe-uninitialized -O3
|
||||
all: a01.out a02.out a03.out
|
||||
a01.out: a01.o array.o matrix.o
|
||||
gcc a01.o array.o matrix.o -lm -o a01.out
|
||||
a02.out: a02.o array.o matrix.o
|
||||
gcc a02.o array.o matrix.o -lm -o a02.out
|
||||
a03.out: a03.o array.o matrix.o
|
||||
gcc a03.o array.o matrix.o -lm -o a03.out
|
||||
array.o:
|
||||
gcc -c $(FLAGS) -o array.o array.c
|
||||
matrix.o:
|
||||
gcc -c $(FLAGS) -o matrix.o matrix.c
|
||||
a01.o:
|
||||
gcc -c $(FLAGS) -o a01.o task01.c
|
||||
a02.o:
|
||||
gcc -c $(FLAGS) -o a02.o task02.c
|
||||
a03.o:
|
||||
gcc -c $(FLAGS) -o a03.o task03.c
|
||||
clean:
|
||||
rm -f *.o *.out
|
74
2025.03.28/Matvei/array.c
Normal file
74
2025.03.28/Matvei/array.c
Normal file
|
@ -0,0 +1,74 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include "io_status.h"
|
||||
#include "array.h"
|
||||
#include "matrix.h"
|
||||
|
||||
io_status read_matrix(double* a, int n, int m, const char* name)
|
||||
{
|
||||
int i, j;
|
||||
FILE* fp;
|
||||
if (!(fp = fopen(name, "r")))
|
||||
return ERROR_OPEN;
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
for (j = 0; j < m; j++)
|
||||
{
|
||||
if (fscanf(fp, "%lf", a + i * m + j) != 1)
|
||||
{
|
||||
fclose(fp);
|
||||
return ERROR_READ;
|
||||
}
|
||||
}
|
||||
}
|
||||
fclose(fp);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
void print_matrix(const double* a, int n, int m, int p)
|
||||
{
|
||||
int np = (n > p ? p : n);
|
||||
int mp = (m > p ? p : m);
|
||||
int i, j;
|
||||
for (i = 0; i < np; i++)
|
||||
{
|
||||
for (j = 0; j < mp; j++)
|
||||
printf(" %10.3e", a[i * m + j]);
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
|
||||
void init_matrix(double* a, int n, int m, int k)
|
||||
{
|
||||
int i, j;
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
for (j = 0; j < m; j++)
|
||||
a[i * m + j] = f(k, n, m, i+1, j+1);
|
||||
}
|
||||
}
|
||||
|
||||
double f(int k, int n, int m, int i, int j)
|
||||
{
|
||||
switch (k)
|
||||
{
|
||||
case 1: return (n >= m ? n : m) - (i >= j ? i : j) + 1;
|
||||
case 2: return (i >= j ? i : j);
|
||||
case 3: return (i - j >= 0 ? i - j : j - i);
|
||||
case 4: return 1./(i + j - 1);
|
||||
}
|
||||
return -1e308;
|
||||
}
|
||||
|
||||
void init_vector(double* b, double* a, int n)
|
||||
{
|
||||
int i, k;
|
||||
double sum;
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
sum = 0;
|
||||
for (k = 1; k < n; k += 2) sum += a[i * n + k];
|
||||
b[i] = sum;
|
||||
}
|
||||
}
|
5
2025.03.28/Matvei/array.h
Normal file
5
2025.03.28/Matvei/array.h
Normal file
|
@ -0,0 +1,5 @@
|
|||
io_status read_matrix(double*, int, int, const char*);
|
||||
void print_matrix(const double*, int, int, int);
|
||||
void init_matrix(double*, int, int, int);
|
||||
double f(int, int, int, int, int);
|
||||
void init_vector(double*, double*, int);
|
6
2025.03.28/Matvei/io_status.h
Normal file
6
2025.03.28/Matvei/io_status.h
Normal file
|
@ -0,0 +1,6 @@
|
|||
typedef enum io_status_
|
||||
{
|
||||
SUCCESS,
|
||||
ERROR_OPEN,
|
||||
ERROR_READ,
|
||||
} io_status;
|
99
2025.03.28/Matvei/matrix.c
Normal file
99
2025.03.28/Matvei/matrix.c
Normal file
|
@ -0,0 +1,99 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include "matrix.h"
|
||||
|
||||
void multmatvec(double* a, double* x1, double* x2, int n)
|
||||
{
|
||||
int i, j;
|
||||
double sum;
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
sum = 0;
|
||||
for (j = 0; j < n; j++)
|
||||
sum += a[i * n+ j] * x1[j];
|
||||
x2[i] = sum;
|
||||
}
|
||||
}
|
||||
|
||||
double scalp(double* a, double* b, int n)
|
||||
{
|
||||
int i;
|
||||
double mult = 0;
|
||||
for (i = 0; i < n; i++) mult += a[i] * b[i];
|
||||
return mult;
|
||||
}
|
||||
|
||||
double count_task1(double* a, double* x, double r1, int n)
|
||||
{
|
||||
int i, j;
|
||||
double mltd_el_x, sum, modsum1 = 0, modsum2 = 0;
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
sum = 0;
|
||||
for (j = 0; j < n; j++) sum += a[i * n + j] * x[j];
|
||||
mltd_el_x = r1 * x[i];
|
||||
modsum1 += fabs(sum - mltd_el_x);
|
||||
modsum2 += fabs(mltd_el_x);
|
||||
}
|
||||
return modsum1 / modsum2;
|
||||
}
|
||||
|
||||
double count_r1(double* a, double* b, double* x, int n)
|
||||
{
|
||||
int i, j;
|
||||
double el_b, sum, modsum1 = 0, modsum2 = 0;
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
sum = 0;
|
||||
for (j = 0; j < n; j++) sum += a[i * n + j] * x[j];
|
||||
el_b = b[i];
|
||||
modsum1 = fabs(sum - el_b);
|
||||
modsum2 = fabs(el_b);
|
||||
}
|
||||
return modsum1 / modsum2;
|
||||
}
|
||||
|
||||
double count_r2(double* x, int n)
|
||||
{
|
||||
int i;
|
||||
double modsum = 0;
|
||||
int ost, sum = 0;
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
ost = (i + 1) % 2;
|
||||
modsum += fabs(x[i] - ost);
|
||||
sum += ost;
|
||||
}
|
||||
return modsum / sum;
|
||||
}
|
||||
|
||||
void vecdiff(double* a, double* b, int n)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < n; i++) a[i] -= b[i];
|
||||
}
|
||||
|
||||
void vecmult(double* a, double lambda, int n)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < n; i++) a[i] = lambda * a[i];
|
||||
}
|
||||
|
||||
void veccpy(double* a, double* b, int n)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < n; i++) a[i] = b[i];
|
||||
}
|
||||
|
||||
void veccomb(double lambda, double* a, double myu, double* b, int n)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < n; i++) a[i] = lambda * a[i] + myu * b[i];
|
||||
}
|
||||
|
||||
int equal(double a, double b)
|
||||
{
|
||||
if (fabs(a - b) <= EPS * fmax(fabs(a), fabs(b))) return 1;
|
||||
return 0;
|
||||
}
|
12
2025.03.28/Matvei/matrix.h
Normal file
12
2025.03.28/Matvei/matrix.h
Normal file
|
@ -0,0 +1,12 @@
|
|||
#define EPS (1e-9)
|
||||
|
||||
void multmatvec(double*, double*, double*, int);
|
||||
double scalp(double*, double*, int);
|
||||
void vecdiff(double*, double*, int);
|
||||
void vecmult(double*, double, int);
|
||||
void veccpy(double*, double*, int);
|
||||
void veccomb(double, double*, double, double*, int);
|
||||
double count_task1(double*, double*, double, int);
|
||||
double count_r1(double*, double*, double*, int);
|
||||
double count_r2(double*, int);
|
||||
int equal(double, double);
|
152
2025.03.28/Matvei/task01.c
Normal file
152
2025.03.28/Matvei/task01.c
Normal file
|
@ -0,0 +1,152 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include <math.h>
|
||||
#include "io_status.h"
|
||||
#include "array.h"
|
||||
#include "matrix.h"
|
||||
|
||||
double solve1(double*, double*, double*, int, int);
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
int task = 1;
|
||||
double* a;
|
||||
double* x0;
|
||||
double* x;
|
||||
int n, m, p, k1, k2;
|
||||
char* name1 = 0;
|
||||
char* name2 = 0;
|
||||
double r1, r2;
|
||||
double t;
|
||||
if (!((argc == 6 || argc == 7 || argc == 8) && sscanf(argv[1], "%d", &m) == 1 && sscanf(argv[2], "%d", &n) == 1 && sscanf(argv[3], "%d", &p) == 1 && sscanf(argv[4], "%d", &k1) == 1 && k1 >= 0 && k1 <= 4))
|
||||
{
|
||||
printf("Usage: %s n m p k1 [file1] k2 [file2]\n", argv[0]);
|
||||
return 1;
|
||||
}
|
||||
if (k1 == 0)
|
||||
{
|
||||
if (!(sscanf(argv[6], "%d", &k2) == 1) && k2 >= 0 && k2 <= 4)
|
||||
{
|
||||
printf("Usage: %s n m p k1 [file1] k2 [file2]\n", argv[0]);
|
||||
return 1;
|
||||
}
|
||||
name1 = argv[5];
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(sscanf(argv[5], "%d", &k2) == 1) && k2 >= 0 && k2 <= 4)
|
||||
{
|
||||
printf("Usage: %s n m p k1 [file1] k2 [file2]\n", argv[0]);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
if (k2 == 0)
|
||||
{
|
||||
if (k1 == 0) name2 = argv[7];
|
||||
else name2 = argv[6];
|
||||
}
|
||||
a = (double*) malloc(n * n * sizeof(double));
|
||||
if (!a)
|
||||
{
|
||||
printf("Not enough memory\n");
|
||||
return 2;
|
||||
}
|
||||
if (name1)
|
||||
{
|
||||
io_status ret;
|
||||
ret = read_matrix(a, n, n, name1);
|
||||
do
|
||||
{
|
||||
switch(ret)
|
||||
{
|
||||
case SUCCESS:
|
||||
continue;
|
||||
case ERROR_OPEN:
|
||||
printf("Can not open file %s\n", name1);
|
||||
break;
|
||||
case ERROR_READ:
|
||||
printf("Can not read file %s\n", name1);
|
||||
break;
|
||||
}
|
||||
free(a);
|
||||
return 3;
|
||||
} while (0);
|
||||
}
|
||||
else
|
||||
init_matrix(a, n, n, k1);
|
||||
x0 = (double*) malloc(n * sizeof(double));
|
||||
if (!x0)
|
||||
{
|
||||
printf("Not enough memory\n");
|
||||
free(a);
|
||||
return 2;
|
||||
}
|
||||
x = (double*) malloc(n * sizeof(double));
|
||||
if (!x)
|
||||
{
|
||||
printf("Not enough memory\n");
|
||||
free(a);
|
||||
free(x0);
|
||||
return 2;
|
||||
}
|
||||
if (name2)
|
||||
{
|
||||
io_status ret;
|
||||
ret = read_matrix(x0, n, 1, name2);
|
||||
do
|
||||
{
|
||||
switch(ret)
|
||||
{
|
||||
case SUCCESS:
|
||||
continue;
|
||||
case ERROR_OPEN:
|
||||
printf("Can not open file %s\n", name2);
|
||||
break;
|
||||
case ERROR_READ:
|
||||
printf("Can not read file %s\n", name2);
|
||||
break;
|
||||
}
|
||||
free(a);
|
||||
free(x0);
|
||||
free(x);
|
||||
return 3;
|
||||
} while (0);
|
||||
}
|
||||
else
|
||||
init_matrix(x0, n, 1, k2);
|
||||
printf("Matrix:\n");
|
||||
print_matrix(a, n, n, p);
|
||||
printf("Vector:\n");
|
||||
print_matrix(x0, n, 1, p);
|
||||
t = clock();
|
||||
r1 = solve1(a, x0, x, n, m);
|
||||
t = (clock() - t) / CLOCKS_PER_SEC;
|
||||
r2 = count_task1(a, x, r1, n);
|
||||
|
||||
printf("Vector x:\n");
|
||||
if (m % 2)
|
||||
print_matrix(x, 1, n, p);
|
||||
else
|
||||
print_matrix(x0, 1, n, p);
|
||||
printf ("%s : Task = %d Res1 = %e Res2 = %e Elapsed = %.2f\n", argv[0], task, r1, r2, t);
|
||||
free(a);
|
||||
free(x0);
|
||||
free(x);
|
||||
return 0;
|
||||
}
|
||||
|
||||
double solve1(double* a, double* x0, double* x, int n, int m)
|
||||
{
|
||||
int k;
|
||||
double lambda;
|
||||
if (m <= 0) return 0;
|
||||
for (k = 0; k <= m; k++)
|
||||
{
|
||||
if (k % 2) multmatvec(a, x, x0, n);
|
||||
else multmatvec(a, x0, x, n);
|
||||
}
|
||||
if (m % 2) lambda = scalp(x0, x, n) / scalp(x, x, n);
|
||||
else lambda = scalp(x, x0, n) / scalp(x0, x0, n);
|
||||
return lambda;
|
||||
}
|
163
2025.03.28/Matvei/task02.c
Normal file
163
2025.03.28/Matvei/task02.c
Normal file
|
@ -0,0 +1,163 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include <math.h>
|
||||
#include "io_status.h"
|
||||
#include "array.h"
|
||||
#include "matrix.h"
|
||||
|
||||
void solve2(double*, double*, double*, double*, int, int, double);
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
int task = 2;
|
||||
double* a;
|
||||
double* x0;
|
||||
double* x;
|
||||
double* b;
|
||||
int n, m, p, k1, k2;
|
||||
char* name1 = 0;
|
||||
char* name2 = 0;
|
||||
double tau;
|
||||
double r1, r2;
|
||||
double t;
|
||||
if (!((argc == 7 || argc == 8 || argc == 9) && sscanf(argv[1], "%lf", &tau) == 1 && sscanf(argv[2], "%d", &m) == 1 && sscanf(argv[3], "%d", &n) == 1 && sscanf(argv[4], "%d", &p) == 1 && sscanf(argv[5], "%d", &k1) == 1 && k1 >= 0 && k1 <= 4))
|
||||
{
|
||||
printf("Usage: %s tau n m p k1 [file1] k2 [file2]\n", argv[0]);
|
||||
return 1;
|
||||
}
|
||||
if (k1 == 0)
|
||||
{
|
||||
if (!(sscanf(argv[7], "%d", &k2) == 1) && k2 >= 0 && k2 <= 4)
|
||||
{
|
||||
printf("Usage: %s tau n m p k1 [file1] k2 [file2]\n", argv[0]);
|
||||
return 1;
|
||||
}
|
||||
name1 = argv[6];
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(sscanf(argv[6], "%d", &k2) == 1) && k2 >= 0 && k2 <= 4)
|
||||
{
|
||||
printf("Usage: %s tau n m p k1 [file1] k2 [file2]\n", argv[0]);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
if (k2 == 0)
|
||||
{
|
||||
if (k1 == 0) name2 = argv[8];
|
||||
else name2 = argv[7];
|
||||
}
|
||||
a = (double*) malloc(n * n * sizeof(double));
|
||||
if (!a)
|
||||
{
|
||||
printf("Not enough memory\n");
|
||||
return 2;
|
||||
}
|
||||
if (name1)
|
||||
{
|
||||
io_status ret;
|
||||
ret = read_matrix(a, n, n, name1);
|
||||
do
|
||||
{
|
||||
switch(ret)
|
||||
{
|
||||
case SUCCESS:
|
||||
continue;
|
||||
case ERROR_OPEN:
|
||||
printf("Can not open file %s\n", name1);
|
||||
break;
|
||||
case ERROR_READ:
|
||||
printf("Can not read file %s\n", name1);
|
||||
break;
|
||||
}
|
||||
free(a);
|
||||
return 3;
|
||||
} while (0);
|
||||
}
|
||||
else
|
||||
init_matrix(a, n, n, k1);
|
||||
x0 = (double*) malloc(n * sizeof(double));
|
||||
if (!x0)
|
||||
{
|
||||
printf("Not enough memory\n");
|
||||
free(a);
|
||||
return 2;
|
||||
}
|
||||
x = (double*) malloc(n * sizeof(double));
|
||||
if (!x)
|
||||
{
|
||||
printf("Not enough memory\n");
|
||||
free(a);
|
||||
free(x0);
|
||||
return 2;
|
||||
}
|
||||
b = (double*) malloc(n * sizeof(double));
|
||||
if (!b)
|
||||
{
|
||||
printf("Not enough memory\n");
|
||||
free(a);
|
||||
free(x0);
|
||||
free(x);
|
||||
return 2;
|
||||
}
|
||||
if (name2)
|
||||
{
|
||||
io_status ret;
|
||||
ret = read_matrix(x0, n, 1, name2);
|
||||
do
|
||||
{
|
||||
switch(ret)
|
||||
{
|
||||
case SUCCESS:
|
||||
continue;
|
||||
case ERROR_OPEN:
|
||||
printf("Can not open file %s\n", name2);
|
||||
break;
|
||||
case ERROR_READ:
|
||||
printf("Can not read file %s\n", name2);
|
||||
break;
|
||||
}
|
||||
free(a);
|
||||
free(x0);
|
||||
free(x);
|
||||
free(b);
|
||||
return 3;
|
||||
} while (0);
|
||||
}
|
||||
else
|
||||
init_matrix(x0, n, 1, k2);
|
||||
init_vector(b, a, n);
|
||||
printf("Matrix:\n");
|
||||
print_matrix(a, n, n, p);
|
||||
printf("Vector:\n");
|
||||
print_matrix(x0, 1, n, p);
|
||||
printf("Vector b:\n");
|
||||
print_matrix(b, 1, n, p);
|
||||
t = clock();
|
||||
solve2(a, x0, x, b, n, m, tau);
|
||||
t = (clock() - t) / CLOCKS_PER_SEC;
|
||||
r1 = count_r1(a, b, x, n);
|
||||
r2 = count_r2(x, n);
|
||||
printf("New vector:\n");
|
||||
print_matrix(x, n, 1, p);
|
||||
printf ("%s : Task = %d Res1 = %e Res2 = %e Elapsed = %.2f\n", argv[0], task, r1, r2, t);
|
||||
free(a);
|
||||
free(x0);
|
||||
free(x);
|
||||
free(b);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void solve2(double* a, double* x0, double* x, double* b, int n, int m, double tau)
|
||||
{
|
||||
int k;
|
||||
veccpy(x, x0, n);
|
||||
for (k = 1; k <= m; k++)
|
||||
{
|
||||
multmatvec(a, x, x0, n);
|
||||
vecdiff(x0, b, n);
|
||||
vecmult(x0, tau, n);
|
||||
vecdiff(x, x0, n);
|
||||
}
|
||||
}
|
180
2025.03.28/Matvei/task03.c
Normal file
180
2025.03.28/Matvei/task03.c
Normal file
|
@ -0,0 +1,180 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include <math.h>
|
||||
#include "io_status.h"
|
||||
#include "array.h"
|
||||
#include "matrix.h"
|
||||
|
||||
void solve3(double*, double*, double*, double*, double*, int, int);
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
int task = 3;
|
||||
double* a;
|
||||
double* x0;
|
||||
double* x;
|
||||
double* b;
|
||||
double* r;
|
||||
int n, m, p, k1, k2;
|
||||
char* name1 = 0;
|
||||
char* name2 = 0;
|
||||
double r1, r2;
|
||||
double t;
|
||||
if (!((argc == 6 || argc == 7 || argc == 8) && sscanf(argv[1], "%d", &m) == 1 && sscanf(argv[2], "%d", &n) == 1 && sscanf(argv[3], "%d", &p) == 1 && sscanf(argv[4], "%d", &k1) == 1 && k1 >= 0 && k1 <= 4))
|
||||
{
|
||||
printf("Usage: %s n m p k1 [file1] k2 [file2]\n", argv[0]);
|
||||
return 1;
|
||||
}
|
||||
if (k1 == 0)
|
||||
{
|
||||
if (!(sscanf(argv[6], "%d", &k2) == 1) && k2 >= 0 && k2 <= 4)
|
||||
{
|
||||
printf("Usage: %s n m p k1 [file1] k2 [file2]\n", argv[0]);
|
||||
return 1;
|
||||
}
|
||||
name1 = argv[5];
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(sscanf(argv[5], "%d", &k2) == 1) && k2 >= 0 && k2 <= 4)
|
||||
{
|
||||
printf("Usage: %s n m p k1 [file1] k2 [file2]\n", argv[0]);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
if (k2 == 0)
|
||||
{
|
||||
if (k1 == 0) name2 = argv[7];
|
||||
else name2 = argv[6];
|
||||
}
|
||||
a = (double*) malloc(n * n * sizeof(double));
|
||||
if (!a)
|
||||
{
|
||||
printf("Not enough memory\n");
|
||||
return 2;
|
||||
}
|
||||
if (name1)
|
||||
{
|
||||
io_status ret;
|
||||
ret = read_matrix(a, n, n, name1);
|
||||
do
|
||||
{
|
||||
switch(ret)
|
||||
{
|
||||
case SUCCESS:
|
||||
continue;
|
||||
case ERROR_OPEN:
|
||||
printf("Can not open file %s\n", name1);
|
||||
break;
|
||||
case ERROR_READ:
|
||||
printf("Can not read file %s\n", name1);
|
||||
break;
|
||||
}
|
||||
free(a);
|
||||
return 3;
|
||||
} while (0);
|
||||
}
|
||||
else
|
||||
init_matrix(a, n, n, k1);
|
||||
x0 = (double*) malloc(n * sizeof(double));
|
||||
if (!x0)
|
||||
{
|
||||
printf("Not enough memory\n");
|
||||
free(a);
|
||||
return 2;
|
||||
}
|
||||
x = (double*) malloc(n * sizeof(double));
|
||||
if (!x)
|
||||
{
|
||||
printf("Not enough memory\n");
|
||||
free(a);
|
||||
free(x0);
|
||||
return 2;
|
||||
}
|
||||
b = (double*) malloc(n * sizeof(double));
|
||||
if (!b)
|
||||
{
|
||||
printf("Not enough memory\n");
|
||||
free(a);
|
||||
free(x0);
|
||||
free(x);
|
||||
return 2;
|
||||
}
|
||||
r = (double*) malloc(n * sizeof(double));
|
||||
if (!r)
|
||||
{
|
||||
printf("Not enough memory\n");
|
||||
free(a);
|
||||
free(x0);
|
||||
free(x);
|
||||
free(b);
|
||||
return 2;
|
||||
}
|
||||
if (name2)
|
||||
{
|
||||
io_status ret;
|
||||
ret = read_matrix(x0, n, 1, name2);
|
||||
do
|
||||
{
|
||||
switch(ret)
|
||||
{
|
||||
case SUCCESS:
|
||||
continue;
|
||||
case ERROR_OPEN:
|
||||
printf("Can not open file %s\n", name2);
|
||||
break;
|
||||
case ERROR_READ:
|
||||
printf("Can not read file %s\n", name2);
|
||||
break;
|
||||
}
|
||||
free(a);
|
||||
free(x0);
|
||||
free(x);
|
||||
free(b);
|
||||
free(r);
|
||||
return 3;
|
||||
} while (0);
|
||||
}
|
||||
else
|
||||
init_matrix(x0, n, 1, k2);
|
||||
init_vector(b, a, n);
|
||||
printf("Matrix:\n");
|
||||
print_matrix(a, n, n, p);
|
||||
printf("Vector:\n");
|
||||
print_matrix(x0, n, 1, p);
|
||||
printf("Vector b:\n");
|
||||
print_matrix(b, n, 1, p);
|
||||
t = clock();
|
||||
solve3(a, x0, x, b, r, n, m);
|
||||
t = (clock() - t) / CLOCKS_PER_SEC;
|
||||
r1 = count_r1(a, b, x, n);
|
||||
r2 = count_r2(x, n);
|
||||
printf("New vector:\n");
|
||||
print_matrix(x, n, 1, p);
|
||||
printf("%s : Task = %d Res1 = %e Res2 = %e Elapsed = %.2f\n", argv[0], task, r1, r2, t);
|
||||
free(a);
|
||||
free(x0);
|
||||
free(x);
|
||||
free(b);
|
||||
free(r);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void solve3(double* a, double* x0, double* x, double* b, double* r, int n, int m)
|
||||
{
|
||||
int k;
|
||||
double tau, scalp2;
|
||||
veccpy(x, x0, n);
|
||||
multmatvec(a, x, r, n);
|
||||
vecdiff(r, b, n);
|
||||
for (k = 1; k <= m; k++)
|
||||
{
|
||||
multmatvec(a, r, x0, n);
|
||||
scalp2 = scalp(x0, r, n);
|
||||
if (!equal(scalp2, 0)) tau = scalp(r, r, n) / scalp2;
|
||||
else break;
|
||||
veccomb(1, x, -tau, r, n);
|
||||
veccomb(1, r, -tau, x0, n);
|
||||
}
|
||||
}
|
180
2025.03.28/Matvei/task04.c
Normal file
180
2025.03.28/Matvei/task04.c
Normal file
|
@ -0,0 +1,180 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include <math.h>
|
||||
#include "io_status.h"
|
||||
#include "array.h"
|
||||
#include "matrix.h"
|
||||
|
||||
void solve4(double*, double*, double*, double*, double*, int, int);
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
int task = 4;
|
||||
double* a;
|
||||
double* x0;
|
||||
double* x;
|
||||
double* b;
|
||||
double* r;
|
||||
int n, m, p, k1, k2;
|
||||
char* name1 = 0;
|
||||
char* name2 = 0;
|
||||
double r1, r2;
|
||||
double t;
|
||||
if (!((argc == 6 || argc == 7 || argc == 8) && sscanf(argv[1], "%d", &m) == 1 && sscanf(argv[2], "%d", &n) == 1 && sscanf(argv[3], "%d", &p) == 1 && sscanf(argv[4], "%d", &k1) == 1 && k1 >= 0 && k1 <= 4))
|
||||
{
|
||||
printf("Usage: %s n m p k1 [file1] k2 [file2]\n", argv[0]);
|
||||
return 1;
|
||||
}
|
||||
if (k1 == 0)
|
||||
{
|
||||
if (!(sscanf(argv[6], "%d", &k2) == 1) && k2 >= 0 && k2 <= 4)
|
||||
{
|
||||
printf("Usage: %s n m p k1 [file1] k2 [file2]\n", argv[0]);
|
||||
return 1;
|
||||
}
|
||||
name1 = argv[5];
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(sscanf(argv[5], "%d", &k2) == 1) && k2 >= 0 && k2 <= 4)
|
||||
{
|
||||
printf("Usage: %s n m p k1 [file1] k2 [file2]\n", argv[0]);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
if (k2 == 0)
|
||||
{
|
||||
if (k1 == 0) name2 = argv[7];
|
||||
else name2 = argv[6];
|
||||
}
|
||||
a = (double*) malloc(n * n * sizeof(double));
|
||||
if (!a)
|
||||
{
|
||||
printf("Not enough memory\n");
|
||||
return 2;
|
||||
}
|
||||
if (name1)
|
||||
{
|
||||
io_status ret;
|
||||
ret = read_matrix(a, n, n, name1);
|
||||
do
|
||||
{
|
||||
switch(ret)
|
||||
{
|
||||
case SUCCESS:
|
||||
continue;
|
||||
case ERROR_OPEN:
|
||||
printf("Can not open file %s\n", name1);
|
||||
break;
|
||||
case ERROR_READ:
|
||||
printf("Can not read file %s\n", name1);
|
||||
break;
|
||||
}
|
||||
free(a);
|
||||
return 3;
|
||||
} while (0);
|
||||
}
|
||||
else
|
||||
init_matrix(a, n, n, k1);
|
||||
x0 = (double*) malloc(n * sizeof(double));
|
||||
if (!x0)
|
||||
{
|
||||
printf("Not enough memory\n");
|
||||
free(a);
|
||||
return 2;
|
||||
}
|
||||
x = (double*) malloc(n * sizeof(double));
|
||||
if (!x)
|
||||
{
|
||||
printf("Not enough memory\n");
|
||||
free(a);
|
||||
free(x0);
|
||||
return 2;
|
||||
}
|
||||
b = (double*) malloc(n * sizeof(double));
|
||||
if (!b)
|
||||
{
|
||||
printf("Not enough memory\n");
|
||||
free(a);
|
||||
free(x0);
|
||||
free(x);
|
||||
return 2;
|
||||
}
|
||||
r = (double*) malloc(n * sizeof(double));
|
||||
if (!r)
|
||||
{
|
||||
printf("Not enough memory\n");
|
||||
free(a);
|
||||
free(x0);
|
||||
free(x);
|
||||
free(b);
|
||||
return 2;
|
||||
}
|
||||
if (name2)
|
||||
{
|
||||
io_status ret;
|
||||
ret = read_matrix(x0, n, 1, name2);
|
||||
do
|
||||
{
|
||||
switch(ret)
|
||||
{
|
||||
case SUCCESS:
|
||||
continue;
|
||||
case ERROR_OPEN:
|
||||
printf("Can not open file %s\n", name2);
|
||||
break;
|
||||
case ERROR_READ:
|
||||
printf("Can not read file %s\n", name2);
|
||||
break;
|
||||
}
|
||||
free(a);
|
||||
free(x0);
|
||||
free(x);
|
||||
free(b);
|
||||
free(r);
|
||||
return 3;
|
||||
} while (0);
|
||||
}
|
||||
else
|
||||
init_matrix(x0, n, 1, k2);
|
||||
init_vector(b, a, n);
|
||||
printf("Matrix:\n");
|
||||
print_matrix(a, n, n, p);
|
||||
printf("Vector:\n");
|
||||
print_matrix(x0, n, 1, p);
|
||||
printf("Vector b:\n");
|
||||
print_matrix(b, n, 1, p);
|
||||
t = clock();
|
||||
solve4(a, x0, x, b, r, n, m);
|
||||
t = (clock() - t) / CLOCKS_PER_SEC;
|
||||
r1 = count_r1(a, b, x, n);
|
||||
r2 = count_r2(x, n);
|
||||
printf("New vector:\n");
|
||||
print_matrix(x, n, 1, p);
|
||||
printf("%s : Task = %d Res1 = %e Res2 = %e Elapsed = %.2f\n", argv[0], task, r1, r2, t);
|
||||
free(a);
|
||||
free(x0);
|
||||
free(x);
|
||||
free(b);
|
||||
free(r);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void solve4(double* a, double* x0, double* x, double* b, double* r, int n, int m)
|
||||
{
|
||||
int k;
|
||||
double tau, scalp2;
|
||||
veccpy(x, x0, n);
|
||||
multmatvec(a, x, r, n);
|
||||
vecdiff(r, b, n);
|
||||
for (k = 1; k <= m; k++)
|
||||
{
|
||||
multmatvec(a, r, x0, n);
|
||||
scalp2 = scalp(x0, r, n);
|
||||
if (!equal(scalp2, 0)) tau = scalp(r, r, n) / scalp2;
|
||||
else break;
|
||||
veccomb(1, x, -tau, r, n);
|
||||
veccomb(1, r, -tau, x0, n);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue