mirror of
https://github.com/Wessel/nhl-levenshtein.git
synced 2026-06-05 23:55:45 +02:00
fix: Replace microseconds with u to allow LaTeX to compile
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
\documentclass[9pt]{IEEEconf}
|
||||
\documentclass{IEEEconf}
|
||||
|
||||
\input{packages.tex}
|
||||
\input{variables.tex}
|
||||
@@ -8,7 +8,7 @@
|
||||
% \sffamily
|
||||
% Front page containing title, author and date
|
||||
\pagenumbering{gobble}
|
||||
\input{sec/0 frontpage.tex}
|
||||
\input{sec/0-frontpage.tex}
|
||||
\newpage
|
||||
|
||||
% Set page numbering to arabic and show the table of contents, toc should not contain page number
|
||||
@@ -21,18 +21,19 @@
|
||||
\twocolumn
|
||||
|
||||
% Dictionary containing all the terms used in the document
|
||||
\input{sec/0 dictionairy.tex}
|
||||
\input{sec/0-dictionairy.tex}
|
||||
\newpage
|
||||
|
||||
% Abstract of the document
|
||||
\input{sec/0 abstract.tex}
|
||||
|
||||
\input{sec/0-abstract.tex}
|
||||
% Sections of the document
|
||||
\input{sec/1 introduction.tex}
|
||||
\input{sec/2 theoretical framework.tex}
|
||||
\input{sec/3 methodology.tex}
|
||||
\input{sec/4 results.tex}
|
||||
\input{sec/5 conclusion.tex}
|
||||
\input{sec/1-introduction.tex}
|
||||
% \cite{ebert2016cyclomatic}
|
||||
|
||||
\input{sec/2-theoretical-framework.tex}
|
||||
\input{sec/3-methodology.tex}
|
||||
\input{sec/4-results.tex}
|
||||
\input{sec/5-conclusion.tex}
|
||||
|
||||
\section*{Acknowledgements}
|
||||
\label{sec:acknowledgements}
|
||||
@@ -45,8 +46,8 @@ The author would like to thank the following people for their contribution to th
|
||||
\end{itemize}
|
||||
|
||||
\label{sec:referenties}
|
||||
\bibliographystyle{IEEEtran}
|
||||
\bibliography{references}
|
||||
\nocite{*}
|
||||
|
||||
\input{sec/0 appendice.tex}
|
||||
\input{sec/0-appendice.tex}
|
||||
\end{document}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
\usepackage{sectsty}
|
||||
%/ Use case: text formatting
|
||||
\usepackage{url}
|
||||
\usepackage[newfloat,outputdir=tmp]{minted}
|
||||
\usepackage[newfloat]{minted}
|
||||
\usepackage[colorlinks=true, allcolors=teal]{hyperref}
|
||||
\usepackage{textcomp}
|
||||
\usepackage{amsmath}
|
||||
@@ -30,3 +30,4 @@
|
||||
\usepackage{algorithm}
|
||||
\usepackage{algpseudocode}
|
||||
\usepackage{amsmath}
|
||||
\usepackage{cite}
|
||||
|
||||
BIN
Report/report-v1.pdf
Normal file
BIN
Report/report-v1.pdf
Normal file
Binary file not shown.
@@ -1,23 +0,0 @@
|
||||
\onecolumn
|
||||
% todo(wessel)
|
||||
\section*{Dictionairy}
|
||||
\begin{table}[ht]
|
||||
\raggedright
|
||||
\begin{threeparttable}
|
||||
\begin{tabular}{p{4cm}|p{11.5cm}}
|
||||
\toprule
|
||||
\textbf{Term} & \textbf{Meaning} \\
|
||||
\hline
|
||||
ns & Nanoseconds, a unit of time equal to one billionth of a second. \\
|
||||
ms & Milliseconds, a unit of time equal to one thousandth of a second. \\
|
||||
Programming Paradigm & A style of programming, such as imperative, declarative, or functional. \\
|
||||
Imperative & A programming paradigm that uses statements to change a program's state. \\
|
||||
Functional & A programming paradigm that treats computation as the evaluation of mathematical functions. \\
|
||||
Semi-Functional & A programming paradigm that uses functional programming concepts in an imperative language. \\
|
||||
Mutable & A variable that can be changed after it has been declared. \\
|
||||
Immutable & A variable that cannot be changed after it has been declared. \\
|
||||
\bottomrule
|
||||
\end{tabular}
|
||||
\end{threeparttable}
|
||||
\end{table}
|
||||
\twocolumn
|
||||
@@ -89,19 +89,19 @@
|
||||
benchmarking levenshteinRatio - short different strings
|
||||
time 966.6 ns (953.2 ns .. 985.3 ns)
|
||||
0.996 R² (0.991 R² .. 0.999 R²)
|
||||
mean 992.3 ns (970.7 ns .. 1.036 μs)
|
||||
mean 992.3 ns (970.7 ns .. 1.036 us)
|
||||
std dev 97.98 ns (50.78 ns .. 187.7 ns)
|
||||
|
||||
benchmarking levenshteinRatio - short similar strings
|
||||
time 2.410 μs (2.386 μs .. 2.436 μs)
|
||||
time 2.410 us (2.386 us .. 2.436 us)
|
||||
0.999 R² (0.999 R² .. 1.000 R²)
|
||||
mean 2.391 μs (2.374 μs .. 2.417 μs)
|
||||
mean 2.391 us (2.374 us .. 2.417 us)
|
||||
std dev 69.63 ns (50.30 ns .. 104.4 ns)
|
||||
|
||||
benchmarking levenshteinRatio - long identical strings
|
||||
time 3.786 μs (3.765 μs .. 3.815 μs)
|
||||
time 3.786 us (3.765 us .. 3.815 us)
|
||||
1.000 R² (0.999 R² .. 1.000 R²)
|
||||
mean 3.815 μs (3.795 μs .. 3.842 μs)
|
||||
mean 3.815 us (3.795 us .. 3.842 us)
|
||||
std dev 79.62 ns (63.85 ns .. 103.2 ns)
|
||||
|
||||
benchmarking levenshteinRatio - long different strings
|
||||
24
Report/sec/0-dictionairy.tex
Normal file
24
Report/sec/0-dictionairy.tex
Normal file
@@ -0,0 +1,24 @@
|
||||
\onecolumn
|
||||
% todo(wessel)
|
||||
\section*{Dictionairy}
|
||||
\begin{table}[ht]
|
||||
\raggedright
|
||||
\begin{threeparttable}
|
||||
\begin{tabular}{p{4cm}|p{11.5cm}}
|
||||
\toprule
|
||||
\textbf{Term} & \textbf{Meaning} \\
|
||||
\hline
|
||||
ms & Milliseconds, one thousandth of a second. \\
|
||||
us & Microseconds, one millionth of a second. \\
|
||||
ns & Nanoseconds, one billionth of a second. \\
|
||||
Programming Paradigm & A style of programming. \\
|
||||
Imperative & A programming paradigm that uses statements to change a program's state. \\
|
||||
Functional & A programming paradigm that treats programming as mathematical functions. \\
|
||||
Semi-Functional & A mix between functional and imperative programming. \\
|
||||
Mutable & A variable that can be changed. \\
|
||||
Immutable & A variable that cannot be changed. \\
|
||||
\bottomrule
|
||||
\end{tabular}
|
||||
\end{threeparttable}
|
||||
\end{table}
|
||||
\twocolumn
|
||||
@@ -1,91 +0,0 @@
|
||||
\section{Theoretical Framework}
|
||||
|
||||
\subsection{Functional Programming}
|
||||
\label{ssec:fp}
|
||||
Functional programming is one of four programming paradigms that treats computation as mathematical
|
||||
functions where all data is immmutable.\cite{hudak1989conception} This makes functional programming
|
||||
declarative. The program specifies what it should do, rather than how it should do it.
|
||||
|
||||
Functional programming is based on the concept of pure functions, which are functions
|
||||
that have no side effects and always return the same output for the same input.
|
||||
|
||||
\subsubsection*{Haskell}
|
||||
Haskell (or HS) is a functional programming language that is based on the lambda calculus.\cite{hutton2016programming}
|
||||
Haskell is a pure functional language, which means that all functions in Haskell are pure functions.
|
||||
It is also a lazy language, meaning that expressions are only ran when their values are needed.
|
||||
|
||||
\subsection{Imperative Programming}
|
||||
|
||||
Imperative programming is one of the four programming paradigms that uses statements to change
|
||||
the state of a program. In imperative programming, the program is a sequence of statements that
|
||||
are executed in order.\cite{syme2007introducing}
|
||||
|
||||
The state of the program is determined by mutable variables. Imperative programming is the
|
||||
complete opposite of functional programming mentioned in \autoref{ssec:fp},
|
||||
promoting the use of mutable variables.
|
||||
|
||||
The mutable nature of imperaetive programming makes it difficult to reason the behavior of
|
||||
a function, as the state of the program can change at any time.
|
||||
|
||||
\subsubsection*{CSharp}
|
||||
C\# (or CSharp) is an object-oriented programming language that supports imperative programming.
|
||||
C\# is widely used for developing Windows applications, web applications, and games.
|
||||
|
||||
\subsection{The Levenshtein Distance Algorithm}
|
||||
\label{ssec:t-levenshtein}
|
||||
|
||||
The Levenshtein Distance algorithm is an algorithm used to calculate the similarity between two
|
||||
pieces of text. This is done by calculating the minimum number of single-character edits
|
||||
(insertions, deletions, or substitutions) required to change one string into another.\cite{po2020similarity}
|
||||
|
||||
The result of the Levenshtein Distance algorithm is a value between zero and one
|
||||
that represents the number of edits required to change one string into another.
|
||||
This number is called the \textit{Levenshtein Ratio}.
|
||||
|
||||
The pseudocode for the Levenshtein Distance algorithm with a complexity of $O(m \times n)$
|
||||
is shown in \autoref{alg:levenshtein}.
|
||||
|
||||
\begin{algorithm}
|
||||
\small
|
||||
\caption{Levenshtein Distance Algorithm\cite{po2020similarity}}
|
||||
\label{alg:levenshtein}
|
||||
\begin{algorithmic}[1]
|
||||
\Function{LevenshteinDistance}{$s, t$}
|
||||
\State $n \gets$ length of $s$.
|
||||
\State $m \gets$ length of $t$.
|
||||
|
||||
\If{$n = 0$}
|
||||
\State \Return $m$
|
||||
\EndIf
|
||||
\If{$m = 0$}
|
||||
\State \Return $n$
|
||||
\EndIf
|
||||
|
||||
\State Create matrix $d$ of size $0..m \times 0..n$.
|
||||
|
||||
\State Initialize first row to $0..n$.
|
||||
\State Initialize first column to $0..m$.
|
||||
|
||||
\State Examine each character of $s$ (i from $1$ to $n$).
|
||||
|
||||
\State Examine each character of $t$ (j from $1$ to $m$).
|
||||
|
||||
\If{$s[i] = t[j]$}
|
||||
\State $c \gets 0$
|
||||
\Else
|
||||
\State $c \gets 1$
|
||||
\EndIf
|
||||
|
||||
\State $d[i,j] \gets \min(
|
||||
\begin{cases}
|
||||
\text{Cell above} = [i,j-1] + 1 \\
|
||||
\text{Cell left} = [di,j-1] + 1 \\
|
||||
\text{Cell diagonal} = d[i-1,j-1] + c
|
||||
\end{cases}
|
||||
)$
|
||||
|
||||
\State \Return $d[n,m]$.
|
||||
|
||||
\EndFunction
|
||||
\end{algorithmic}
|
||||
\end{algorithm}
|
||||
91
Report/sec/2-theoretical-framework.tex
Normal file
91
Report/sec/2-theoretical-framework.tex
Normal file
@@ -0,0 +1,91 @@
|
||||
\section{Theoretical Framework}
|
||||
|
||||
\subsection{Functional Programming}
|
||||
\label{ssec:fp}
|
||||
Functional programming is one of four programming paradigms that treats computation as mathematical
|
||||
functions where all data is immmutable.\cite{hudak1989conception} This makes functional programming
|
||||
declarative. The program specifies what it should do, rather than how it should do it.
|
||||
|
||||
Functional programming is based on the concept of pure functions, which are functions
|
||||
that have no side effects and always return the same output for the same input.
|
||||
|
||||
\subsubsection*{Haskell}
|
||||
Haskell (or HS) is a functional programming language that is based on the lambda calculus.\cite{hutton2016programming}
|
||||
Haskell is a pure functional language, which means that all functions in Haskell are pure functions.
|
||||
It is also a lazy language, meaning that expressions are only ran when their values are needed.
|
||||
|
||||
\subsection{Imperative Programming}
|
||||
|
||||
Imperative programming is one of the four programming paradigms that uses statements to change
|
||||
the state of a program. In imperative programming, the program is a sequence of statements that
|
||||
are executed in order.\cite{syme2007introducing}
|
||||
|
||||
The state of the program is determined by mutable variables. Imperative programming is the
|
||||
complete opposite of functional programming mentioned in \autoref{ssec:fp},
|
||||
promoting the use of mutable variables.
|
||||
|
||||
The mutable nature of imperaetive programming makes it difficult to reason the behavior of
|
||||
a function, as the state of the program can change at any time.
|
||||
|
||||
\subsubsection*{CSharp}
|
||||
C\# (or CSharp) is an object-oriented programming language that supports imperative programming.
|
||||
C\# is widely used for developing Windows applications, web applications, and games.
|
||||
|
||||
\subsection{The Levenshtein Distance Algorithm}
|
||||
\label{ssec:t-levenshtein}
|
||||
|
||||
The Levenshtein Distance algorithm is an algorithm used to calculate the similarity between two
|
||||
pieces of text. This is done by calculating the minimum number of single-character edits
|
||||
(insertions, deletions, or substitutions) required to change one string into another.\cite{po2020similarity}
|
||||
|
||||
The result of the Levenshtein Distance algorithm is a value between zero and one
|
||||
that represents the number of edits required to change one string into another.
|
||||
This number is called the \textit{Levenshtein Ratio}.
|
||||
|
||||
The pseudocode for the Levenshtein Distance algorithm with a complexity of $O(m \times n)$
|
||||
is shown in \autoref{alg:levenshtein}.
|
||||
|
||||
\begin{algorithm}
|
||||
\small
|
||||
\caption{Levenshtein Distance Algorithm\cite{po2020similarity}}
|
||||
\label{alg:levenshtein}
|
||||
\begin{algorithmic}[1]
|
||||
\Function{LevenshteinDistance}{$s, t$}
|
||||
\State $n \gets$ length of $s$.
|
||||
\State $m \gets$ length of $t$.
|
||||
|
||||
\If{$n = 0$}
|
||||
\State \Return $m$
|
||||
\EndIf
|
||||
\If{$m = 0$}
|
||||
\State \Return $n$
|
||||
\EndIf
|
||||
|
||||
\State Create matrix $d$ of size $0..m \times 0..n$.
|
||||
|
||||
\State Initialize first row to $0..n$.
|
||||
\State Initialize first column to $0..m$.
|
||||
|
||||
\State Examine each character of $s$ (i from $1$ to $n$).
|
||||
|
||||
\State Examine each character of $t$ (j from $1$ to $m$).
|
||||
|
||||
\If{$s[i] = t[j]$}
|
||||
\State $c \gets 0$
|
||||
\Else
|
||||
\State $c \gets 1$
|
||||
\EndIf
|
||||
|
||||
\State $d[i,j] \gets \min(
|
||||
\begin{cases}
|
||||
\text{Cell above} = [i,j-1] + 1 \\
|
||||
\text{Cell left} = [di,j-1] + 1 \\
|
||||
\text{Cell diagonal} = d[i-1,j-1] + c
|
||||
\end{cases}
|
||||
)$
|
||||
|
||||
\State \Return $d[n,m]$.
|
||||
|
||||
\EndFunction
|
||||
\end{algorithmic}
|
||||
\end{algorithm}
|
||||
@@ -20,7 +20,7 @@ Year 3, Semester 2 (Jan. 2025 - Jun. 2025)}
|
||||
\oldstylenums{\arabic{FancyVerbLine}}}}
|
||||
|
||||
% Sets the bibliography style to IEEE
|
||||
\bibliographystyle{IEEEtran}
|
||||
% \bibliographystyle{IEEEtran}
|
||||
|
||||
% Disables the no citations error
|
||||
\nocite{*}
|
||||
% \nocite{*}
|
||||
|
||||
38
process-track-name.sh
Executable file
38
process-track-name.sh
Executable file
@@ -0,0 +1,38 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
echo "Usage: $0 <program_name>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
PROGRAM_NAME=$1
|
||||
OUTPUT_FILE="process_stats.log"
|
||||
|
||||
touch $OUTPUT_FILE
|
||||
|
||||
echo "DATE TIME %CPU %MEM CMD" >> $OUTPUT_FILE
|
||||
|
||||
while true; do
|
||||
PIDS=$(pgrep -x $PROGRAM_NAME | grep -v $$ | grep -v $(pgrep -x pgrep))
|
||||
|
||||
if [ -n "$PIDS" ]; then
|
||||
# Get the first PID found
|
||||
PID=$(echo $PIDS | awk '{print $1}')
|
||||
echo "Found process $PROGRAM_NAME with PID $PID"
|
||||
|
||||
# Track the found process
|
||||
while kill -0 $PID 2>/dev/null; do
|
||||
TIMESTAMP=$(date "+%Y-%m-%d %H:%M:%S")
|
||||
|
||||
echo -n "$TIMESTAMP " >> $OUTPUT_FILE
|
||||
ps -p $PID -o %cpu,%mem,cmd --no-headers >> $OUTPUT_FILE
|
||||
|
||||
sleep 0.1
|
||||
done
|
||||
|
||||
echo "Process $PROGRAM_NAME with PID $PID has terminated"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
sleep 0.1
|
||||
done
|
||||
Reference in New Issue
Block a user