Commit f456b83c authored by EdwinMindcraft's avatar EdwinMindcraft
Browse files

main + Makefile

parent 09cf7b9d
.idea/** .idea/**
cmake-build-debug/** cmake-build-debug/**
\ No newline at end of file *.o
\ No newline at end of file
FC = gfortran
OPT = -g
main: main.f gauss_seidel.o
$(FC) $(OPT) main.f gauss_seidel.o -o main
gauss_seidel.o: gauss_seidel.f
$(FC) $(OPT) gauss_seidel.f -c
\ No newline at end of file
3 1 2 4
3 3
1 1
\ No newline at end of file
program main program main
use gauss_seidel use gauss_seidel
implicit none implicit none
integer i integer i, n
real :: A(2,2), b(2), x(2) real, allocatable :: A(:,:), b(:), x(:)
real :: prec
A = reshape((/1, 0, 1, 2/), shape(A))
b = (/13, 11/) read (*,*) n
x = (/1, 2/) read (*,*) prec
read (*,*) A
read (*,*) b
read (*,*) x
do i=1,3000000 do i=1,3000000
call solve_system(A, b, x) call solve_system(A, b, x)
if (norm2(matmul(A, x) - b) < 0.0001) then if (norm2(matmul(A, x) - b) < prec) then
exit exit
endif endif
enddo enddo
write(*,*) x, matmul(A, x)
end write(*,*) x
write(*,*) matmul(A, x)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment