handouts/pep-ho.tex
changeset 187 4d300409f2fe
parent 186 f211d9cb856e
child 188 937c995b047a
--- a/handouts/pep-ho.tex	Fri Jun 22 13:34:05 2018 +0100
+++ b/handouts/pep-ho.tex	Tue Jun 26 01:49:32 2018 +0100
@@ -214,21 +214,23 @@
 
 \begin{figure}[p]
 \begin{boxedminipage}{\textwidth}
+
+A Scala programm for generating pretty pictures of the Mandelbrot Set 
+(\url{https://en.wikipedia.org/wiki/Mandelbrot_set}):
 \begin{center}    
 \begin{tabular}{c}  
-\includegraphics[scale=0.15]{../pics/mand1.png}\\
+\includegraphics[scale=0.12]{../pics/mand1.png}
 \end{tabular}
-
-Wellknown Mandelbrot program for generating pretty pictures due to
-Benoit Mandelbrot. (\url{https://en.wikipedia.org/wiki/Mandelbrot_set})
-\bigskip
+\end{center}
 
+\begin{center}
+\begin{tabular}{@{}p{0.45\textwidth}|p{0.45\textwidth}@{}}
+  \bf sequential version: & \bf parallel version: (on 4 cores)\smallskip\\
 
-\begin{tabular}{@{}p{6cm}|p{6cm}@{}}
-  \includegraphics[scale=0.15]{../pics/mand4.png} &
-  \includegraphics[scale=0.15]{../pics/mand3.png} \\
-\footnotesize
-{\begin{lstlisting}
+  {\hfill\includegraphics[scale=0.12]{../pics/mand4.png}\hfill} &
+  {\hfill\includegraphics[scale=0.12]{../pics/mand3.png}\hfill} \\
+
+{\footnotesize\begin{lstlisting}[xleftmargin=-1mm]
 for (y <- (0 until H)) {
   for (x <- (0 until W)) {
     
@@ -243,11 +245,32 @@
   }
   viewer.updateUI()
 }   
-\end{lstlisting}}
-& \\
+\end{lstlisting}}   
+& 
+{\footnotesize\begin{lstlisting}[xleftmargin=0mm]
+for (y <- (0 until H).par) {
+  for (x <- (0 until W).par) {
+      
+    val c = start + 
+      (x * d_x + y * d_y * i)
+    val iters = iterations(c, max) 
+    val col = 
+      if (iters == max) black 
+      else colours(iters % 16)
+  
+    pixel(x, y, col)
+  }
+  viewer.updateUI()
+}   
+\end{lstlisting}}\\
+
+\centering\includegraphics[scale=0.5]{../pics/cpu2.png} &
+\centering\includegraphics[scale=0.5]{../pics/cpu1.png}\\ 
+
+
 \end{tabular}
 \end{center}
-\caption{Test \label{mand}}
+\caption{Test \label{mand}} 
 \end{boxedminipage}
 \end{figure}