Commit c69445d0 authored by EdwinMindcraft's avatar EdwinMindcraft
Browse files

Obsoleted the code

That's not a word but I don't care.
parent d2995e69
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 3.15
FC = gfortran
OPT = -g
# Default target executed when no arguments are given to make.
default_target: all
gs: main.o matop.o
$(FC) $(OPT) main.o matop.o -o gs
matop.o: matop.mod
.PHONY : default_target
# Allow only one "make -f Makefile2" at a time, but pass parallelism.
.NOTPARALLEL:
#=============================================================================
# Special targets provided by cmake.
# Disable implicit rules so canonical targets will work.
.SUFFIXES:
# Remove some rules from gmake that .SUFFIXES does not remove.
SUFFIXES =
.SUFFIXES: .hpux_make_needs_suffix_list
# Suppress display of executed commands.
$(VERBOSE).SILENT:
# A target that is always out of date.
cmake_force:
.PHONY : cmake_force
#=============================================================================
# Set environment variables for the build.
# The shell in which to execute make rules.
SHELL = /bin/sh
# The CMake executable.
CMAKE_COMMAND = /home/epierre01/Documents/Programs/clion-2019.2.3/bin/cmake/linux/bin/cmake
# The command to remove a file.
RM = /home/epierre01/Documents/Programs/clion-2019.2.3/bin/cmake/linux/bin/cmake -E remove -f
# Escaping for special characters.
EQUALS = =
# The top-level source directory on which CMake was run.
CMAKE_SOURCE_DIR = /home/epierre01/Documents/GM3/Projet/gauss-seidel
# The top-level build directory on which CMake was run.
CMAKE_BINARY_DIR = /home/epierre01/Documents/GM3/Projet/gauss-seidel
#=============================================================================
# Targets provided globally by CMake.
# Special rule for the target rebuild_cache
rebuild_cache:
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..."
/home/epierre01/Documents/Programs/clion-2019.2.3/bin/cmake/linux/bin/cmake -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
.PHONY : rebuild_cache
# Special rule for the target rebuild_cache
rebuild_cache/fast: rebuild_cache
.PHONY : rebuild_cache/fast
# Special rule for the target edit_cache
edit_cache:
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "No interactive CMake dialog available..."
/home/epierre01/Documents/Programs/clion-2019.2.3/bin/cmake/linux/bin/cmake -E echo No\ interactive\ CMake\ dialog\ available.
.PHONY : edit_cache
# Special rule for the target edit_cache
edit_cache/fast: edit_cache
.PHONY : edit_cache/fast
# The main all target
all: cmake_check_build_system
$(CMAKE_COMMAND) -E cmake_progress_start /home/epierre01/Documents/GM3/Projet/gauss-seidel/CMakeFiles /home/epierre01/Documents/GM3/Projet/gauss-seidel/CMakeFiles/progress.marks
$(MAKE) -f CMakeFiles/Makefile2 all
$(CMAKE_COMMAND) -E cmake_progress_start /home/epierre01/Documents/GM3/Projet/gauss-seidel/CMakeFiles 0
.PHONY : all
# The main clean target
clean:
$(MAKE) -f CMakeFiles/Makefile2 clean
.PHONY : clean
# The main clean target
clean/fast: clean
.PHONY : clean/fast
# Prepare targets for installation.
preinstall: all
$(MAKE) -f CMakeFiles/Makefile2 preinstall
.PHONY : preinstall
# Prepare targets for installation.
preinstall/fast:
$(MAKE) -f CMakeFiles/Makefile2 preinstall
.PHONY : preinstall/fast
# clear depends
depend:
$(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1
.PHONY : depend
#=============================================================================
# Target rules for targets named GaussSeidel
# Build rule for target.
GaussSeidel: cmake_check_build_system
$(MAKE) -f CMakeFiles/Makefile2 GaussSeidel
.PHONY : GaussSeidel
# fast build rule for target.
GaussSeidel/fast:
$(MAKE) -f CMakeFiles/GaussSeidel.dir/build.make CMakeFiles/GaussSeidel.dir/build
.PHONY : GaussSeidel/fast
main.o: main.f90.o
.PHONY : main.o
# target to build an object file
main.f90.o:
$(MAKE) -f CMakeFiles/GaussSeidel.dir/build.make CMakeFiles/GaussSeidel.dir/main.f90.o
.PHONY : main.f90.o
main.i: main.f90.i
.PHONY : main.i
# target to preprocess a source file
main.f90.i:
$(MAKE) -f CMakeFiles/GaussSeidel.dir/build.make CMakeFiles/GaussSeidel.dir/main.f90.i
.PHONY : main.f90.i
main.s: main.f90.s
.PHONY : main.s
# target to generate assembly for a file
main.f90.s:
$(MAKE) -f CMakeFiles/GaussSeidel.dir/build.make CMakeFiles/GaussSeidel.dir/main.f90.s
.PHONY : main.f90.s
matop.o: matop.f90.o
.PHONY : matop.o
# target to build an object file
matop.f90.o:
$(MAKE) -f CMakeFiles/GaussSeidel.dir/build.make CMakeFiles/GaussSeidel.dir/matop.f90.o
.PHONY : matop.f90.o
matop.i: matop.f90.i
.PHONY : matop.i
# target to preprocess a source file
matop.f90.i:
$(MAKE) -f CMakeFiles/GaussSeidel.dir/build.make CMakeFiles/GaussSeidel.dir/matop.f90.i
.PHONY : matop.f90.i
matop.s: matop.f90.s
.PHONY : matop.s
# target to generate assembly for a file
matop.f90.s:
$(MAKE) -f CMakeFiles/GaussSeidel.dir/build.make CMakeFiles/GaussSeidel.dir/matop.f90.s
.PHONY : matop.f90.s
# Help Target
help:
@echo "The following are some of the valid targets for this Makefile:"
@echo "... all (the default if no target is provided)"
@echo "... clean"
@echo "... depend"
@echo "... rebuild_cache"
@echo "... GaussSeidel"
@echo "... edit_cache"
@echo "... main.o"
@echo "... main.i"
@echo "... main.s"
@echo "... matop.o"
@echo "... matop.i"
@echo "... matop.s"
.PHONY : help
#=============================================================================
# Special targets to cleanup operation of make.
# Special rule to run CMake to check the build system integrity.
# No rule that depends on this can have commands that come from listfiles
# because they might be regenerated.
cmake_check_build_system:
$(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0
.PHONY : cmake_check_build_system
matop.mod: matop.f
$(FC) $(OPT) matop.f -c
main.o: main.f matop.mod
$(FC) $(OPT) main.f -c
program main
use matop
implicit none
integer i, j, n, nmax
real, allocatable, dimension(:,:) :: A,F,D1,L,LI,U,Eye,tmp
real, allocatable, dimension(:) :: b, x, G
real :: prec, res
read (*, *) n, prec, nmax
allocate(A(n,n))
allocate(F(n,n))
allocate(D1(n,n))
allocate(L(n,n))
allocate(LI(n,n))
allocate(U(n,n))
allocate(Eye(n,n))
allocate(tmp(n,n))
allocate(b(n))
allocate(x(n))
allocate(G(n))
read (*, *) A
read (*, *) b
read (*, *) x
D1 = 0
Eye = 0
do i = 1, n
D1(i, i) = 1.0 / A(i, i)
Eye(i, i) = 1
enddo
tmp = matmul(D1, A)
call tril(tmp, L)
call triu(tmp, U)
U = U - Eye
call inv_trig_inf(L, LI)
F = -matmul(LI, U)
G = matmul(matmul(LI, D1), b)
deallocate(D1)
deallocate(L)
deallocate(LI)
deallocate(U)
deallocate(Eye)
deallocate(tmp)
do i = 1, nmax
x = matmul(F, x) + G
res = norm2(matmul(A, x) - b)
write(*, *) i, res
if (res < prec) then
exit
endif
enddo
write (*,*) x, matmul(A, x)
deallocate(F)
deallocate(G)
deallocate(x)
deallocate(A)
deallocate(b)
end
\ No newline at end of file
program main
use matop
implicit none
integer i, j, n, nmax
real, allocatable, dimension(:,:) :: A, F, D1, L, LI, U, Eye, tmp
real, allocatable, dimension(:) :: b, x, G
real :: prec, res
read (*, *) n, prec, nmax
allocate(A(n,n))
allocate(F(n,n))
allocate(D1(n,n))
allocate(L(n,n))
allocate(LI(n,n))
allocate(U(n,n))
allocate(Eye(n,n))
allocate(tmp(n,n))
allocate(b(n))
allocate(x(n))
allocate(G(n))
read (*, *) A
read (*, *) b
read (*, *) x
D1 = 0
Eye = 0
do i = 1, n
D1(i, i) = 1.0 / A(i, i)
Eye(i, i) = 1
enddo
tmp = matmul(D1, A)
call tril(tmp, L)
call triu(tmp, U)
U = U - Eye
call inv_trig_inf(L, LI)
F = -matmul(LI, U)
G = matmul(matmul(LI, D1), b)
deallocate(D1)
deallocate(L)
deallocate(LI)
deallocate(U)
deallocate(Eye)
deallocate(tmp)
do i = 1, nmax
x = matmul(F, x) + G
res = norm2(matmul(A, x) - b)
write(*, *) i, res
if (res < prec) then
exit
endif
enddo
write (*,*) x, matmul(A, x)
deallocate(F)
deallocate(G)
deallocate(x)
deallocate(A)
deallocate(b)
end
\ No newline at end of file
module matop
implicit none
contains
subroutine tril(M, L)
implicit none
integer :: n, i
real, dimension(:,:) :: M, L
n = size(M, 1)
L = 0
do i=1,n
L(i,1:i) = M(i,1:i)
end do
end subroutine tril
subroutine triu(M, U)
implicit none
integer :: n, p, i
real :: M(:,:), U(:,:)
n = size(M, 1)
p = size(M, 2)
U = 0
do i=1,n
U(i,i:p) = M(i,i:p)
end do
end subroutine triu
subroutine inv_trig_inf(L, inv)
implicit none
integer :: i, j, n
real, allocatable, dimension(:,:) :: L(:,:), inv
real, dimension(size(L,1),size(L,2)) :: Eye
n = size(L, 1)
inv = 0;
Eye = 0
do i=1,n
Eye(i,i) = 1
enddo
do i=1,n
inv(i,:) =(Eye(i,:)-matmul(L(i,1:i-1),inv(1:i-1,:)))/L(i,i)
enddo
return
end subroutine inv_trig_inf
end module matop
\ No newline at end of file
module matop
implicit none
contains
subroutine tril(M, L)
implicit none
integer :: n, i
real, dimension(:,:) :: M, L
n = size(M, 1)
L = 0
do i=1,n
L(i,1:i) = M(i,1:i)
end do
end subroutine tril
subroutine triu(M, U)
implicit none
integer :: n, p, i
real :: M(:,:), U(:,:)
n = size(M, 1)
p = size(M, 2)
U = 0
do i=1,n
U(i,i:p) = M(i,i:p)
end do
end subroutine triu
subroutine inv_trig_inf(L, inv)
implicit none
integer :: i, j, n
real, allocatable, dimension(:,:) :: L(:,:), inv
real, dimension(size(L,1),size(L,2)) :: Eye
n = size(L, 1)
inv = 0;
Eye = 0
do i=1,n
Eye(i,i) = 1
enddo
do i=1,n
inv(i,:) = (Eye(i,:) - matmul(L(i,1:i-1),inv(1:i-1,:))) / L(i,i)
enddo
return
end subroutine inv_trig_inf
end module matop
\ No newline at end of file
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