diff --git a/projects/project2/main.pdf b/projects/project2/main.pdf index 239d2fd..41f6c95 100644 Binary files a/projects/project2/main.pdf and b/projects/project2/main.pdf differ diff --git a/projects/project2/main.tex b/projects/project2/main.tex index 10257dc..f042430 100644 --- a/projects/project2/main.tex +++ b/projects/project2/main.tex @@ -150,8 +150,7 @@ The Jacobi rotation algorithm is implemented as described in the lecture notes. \section*{Problem 5} \subsection*{Subproblem (a)} -The scaling of the number of iterations is tested in \texttt{src/project2/scaling\_tester.cpp}. The results are shown in \autoref{fig:scaling}. On the logarithmic scale, we see a trend that is roughly of the order $\sqrt{\log N}$. - +The scaling of the number of iterations is tested in \texttt{src/project2/scaling\_tester.cpp}. The results are shown in \autoref{fig:scaling}. On the double logarithmic scale, the scaling is approximately linear, indicating a polynomial relation between the number of iterations and the matrix size $N$. \begin{figure} \centering \includegraphics[width=0.7\textwidth]{include/scaling_data_iterations.pdf} diff --git a/src/project2/python/scaling_plotter.py b/src/project2/python/scaling_plotter.py index c6cd2e0..c83e54c 100644 --- a/src/project2/python/scaling_plotter.py +++ b/src/project2/python/scaling_plotter.py @@ -7,6 +7,7 @@ import os parser = argparse.ArgumentParser(description='Plot scaling data.') parser.add_argument('input_file', type=str, help='Path to the input CSV file') parser.add_argument("--times", "-t", action="store_true", help="Plot times instead of iterations") +parser.add_argument("--no-loglog", "-nL", action="store_true", help="Do not use log-log scale") args = parser.parse_args() data = pd.read_csv(args.input_file) @@ -18,16 +19,17 @@ if args.times: ax.plot(x, data["Arma_time"], label='Armadillo Time', color='C1', linestyle='-', marker='o') ax.set_ylabel('Time (s)') ax.set_title('Scaling of Computation Time') - ax.set_yscale('log') ax.legend() ax.grid() else: ax.set_ylabel('Number of Iterations') ax.set_title('Scaling of Jacobi Iterations') - ax.set_yscale('log') ax.plot(x, data["Jacobi_iterations"], label='Jacobi Iterations', color='C0', linestyle='-', marker='o') ax.grid() +if not args.no_loglog: + ax.set_xscale('log') + ax.set_yscale('log') ax.set_xlabel('Matrix Size N') dir = os.path.abspath(os.path.join(os.path.dirname(__file__), "../../../projects/project2/include")) filename = args.input_file.split("/")[-1].replace(".txt", "")