From 3b535f0ecba834ba2b189e68b13316ec0d5f8fa6 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Tue, 1 Aug 2023 15:24:27 +0200 Subject: A4: WIP --- a4/exercise.tex | 52 +++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 47 insertions(+), 5 deletions(-) (limited to 'a4/exercise.tex') diff --git a/a4/exercise.tex b/a4/exercise.tex index 11def5d..af53ea5 100644 --- a/a4/exercise.tex +++ b/a4/exercise.tex @@ -2,24 +2,66 @@ \input{preamble.tex} I wanted to experiment with co-routine generator for the random -numbers but discovered the \texttt{std::generator} is not supported -for my compiler. +numbers but discovered the \texttt{std::generator} is not supplied +with my compiler. Instead I found what seemed like a similar implementation here: \texttt{https://en.cppreference.com/w/cpp/language/coroutines}, which I have copied to the \texttt{generator.h} file for use in my program. -I am aware that the random number generator already kind-of works like -a co-routine generator seen from the outside, so the whole experiment -is a bit pointless from a software design perspective. +I am aware that the random number generator already kind-of works +similarly to a co-routine generator seen from the outside, so the +whole experiment is a bit pointless from a software design perspective. + +For this exercise I also re-designed my measurement tool from the +previous assignments to better support re-use of data across +measurements. + +And, finally, I made a class for storing and outputting measurement +points as octave/matlab programs for easier inclusion into the report. +This I put in its own file \texttt{octave.cc} with corresponding +header \texttt{octave.h}. It is by no means very clever, but made to +suit my needs for this assignment. \bigskip +The random number generation for use in insertion I used the +co-routine as described above, inserting, while checking if the number +already exists. +For the ditto for removal indices, I used +a \texttt{uniform\_distribution} thereby being able to gradually +reduce the span as the container would be expected to shrink 1 in size +for each iteration. +Both random number generators were seeded with the iterator number +(each size is being tested three times) to make sure the three +iterations use unique sets of numbers. + +For the smaller sizes of \texttt{N} (the number of items to be +inserted/removed) i print out the numbers to verify their correctness. + + + \begin{figure} \includegraphics[scale=0.95]{a4/insert.pdf} + \caption{Insert of int} + \label{insert} \end{figure} \begin{figure} \includegraphics[scale=.95]{a4/remove.pdf} + \caption{Removal of int} + \label{remove} +\end{figure} + +\begin{figure} + \includegraphics[scale=0.95]{a4/insert-padded.pdf} + \caption{Insert of padded-int (1024 bytes pr. value)} + \label{insert-padded} +\end{figure} + +\begin{figure} + \includegraphics[scale=.95]{a4/remove-padded.pdf} + \caption{Removal of padded-int (1024 bytes pr. value)} + \label{remove-padded} \end{figure} \end{document} -- cgit v1.2.3