Cleaned up and renamed module

This commit is contained in:
Ziad Arafat committed 2023-03-06 03:26:13 -07:00
1 parent 7d1ca697d0
commit c5213c2a8a
3 files changed
+37 -13

No files matched your search

+13 -10
View File
@@ -1,24 +1,27 @@
FC = gfortran -std=gnu
SRC = gaussian_elimination.f90
EXEC = gaussian_elimination
MODULE = mymodule.mod
MODF = mymodule.f90
MODULE = string_to_real.mod
MODF = string_to_real.f90
RM = rm -f
OBJMAIN = gaussian_elimination.o
OBJMOD = string_to_real.o
# Variables so its easy to make changes if I need to (it ended up being helpful)
all: $(EXEC)
$(EXEC): $(SRC) $(MODULE)
$(FC) -c $(SRC)
gfortran mymodule.o gaussian_elimination.o -o gaussian_elimination
# $(FC) -o $(EXEC) $(SRC)
$(EXEC): $(SRC) $(MODULE) $(OBJMOD) $(OBJMAIN)
$(FC) $(OBJMOD) $(OBJMAIN) -o $(EXEC)
$(OBJMAIN): $(SRC)
$(FC) -c $(SRC)
$(MODULE): $(MODF)
$(FC) -c $(MODF)
clean:
$(RM) *.o *.mod
$(RM) $(OBJMAIN) $(OBJMOD) $(MODULE) $(EXEC)
test: clean gaussian_elimination
# ./gaussian_elimination 3 4 1 2 3 4 5 6 7 8 9 10 11 12
./gaussian_elimination 3 4 "matrix.txt"
test: clean $(EXEC)
./$(EXEC) 3 4 "matrix.txt"
+22 -1
View File
@@ -1,7 +1,28 @@
! Ziad Arafat
! 2023-03-06
! The performance of compiled and interpreted languages has been a topic of
! interest in programming languages research for decades. While compiled languages
! are generally known for their faster runtime performance, interpreted languages
! offer advantages in terms of ease of use and portability. In this experiment,
! we aimed to explore the practical performance of compiled and interpreted
! languages in implementing Gaussian elimination with back substitution, a widely
! used numerical algorithm. We implemented the algorithm in Python and FORTRAN,
! and tested their runtime performance on matrices of varying size, with and
! without the use of numpy. The experiment provides insights into the practical
! trade-offs between compiled and interpreted languages in the context of
! numerical algorithms.
! This program takes the height and width of the matrix as input.
! It also takes a filename for a file containing the items in the matrix on one
! line separated by spaces. They must be floats.
! Usage: ./gaussian_elimination height width filename
program gaussian_elimination
! Module with a function for reading a string of floats
use mymodule
use string_to_real
implicit none
integer :: i, j, n, m, index_of_input, s
@@ -1,4 +1,4 @@
module mymodule
module string_to_real
implicit none
! Define the string_to_real_array function
@@ -37,5 +37,5 @@ pure function string_to_real_array(str, n) result(arr)
end function string_to_real_array
end module mymodule
end module string_to_real