Skip to content

Commit 45e21b7

Browse files
committed
Make it fit.
1 parent 38bd3d9 commit 45e21b7

10 files changed

+30
-34
lines changed

bench.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ \subsection{Comparing Algorithms in the \haskell Implementation}
8383
The resulting graph plots the time (x-axis) against the number of words (y-axis) produced so far. The slope of the graph indicates the generation speed of the plotted algorithm, high slope is correlated to high generation speed. \cref{bench:haskell:all} contains the results for the Haskell implementations.
8484

8585
Most algorithms generate between $1.3\cdot10^3$ and $1.4\cdot10^6$ words in the first
86-
second, which seems more than sufficient for testing purposes.
86+
second, which seems sufficient for testing purposes.
8787
The \textbf{refConv} implementation
8888
which uses symbolic segments and convolutions is consistently in the
8989
leading group.

improvements.tex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ \subsection{Faster Concatenation by Convolution}
2525
$ zipWith (liftA2 T.append) lx rly')
2626
: collect ysegs rly'
2727
\end{lstlisting}
28+
\vspace{-\baselineskip}
2829
\caption{Concatenation with convolution}
2930
\label{fig:concatenation-with-convolution}
3031
\end{figure}

measure/haskell_all.gnuplot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# set terminal x11 size 1500,500 font 'Deja Vu Sans Mono,14' persist
44

5-
set terminal pngcairo transparent size 1000,2000 rounded font 'Deja Vu Sans,19'
5+
set terminal pngcairo transparent size 1000,1900 rounded font 'Deja Vu Sans,19'
66
set output 'haskell_all.png'
77

88
# set terminal tikz standalone size 15,6 textscale 0.5

measure/haskell_all.png

-4.19 KB
Loading

measure/langs.gnuplot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# set terminal x11 size 700,700 font 'Deja Vu Sans Mono,14' persist
44

5-
set terminal pngcairo transparent size 2000,700 rounded font 'Deja Vu Sans,18'
5+
set terminal pngcairo transparent size 2000,650 rounded font 'Deja Vu Sans,18'
66
set output 'langs.png'
77

88
# set terminal tikz standalone size 15,6 textscale 0.5

measure/langs.png

-7.03 KB
Loading

measure/ocaml_all.gnuplot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# set terminal x11 size 1500,500 font 'Deja Vu Sans Mono,14' persist
44

5-
set terminal pngcairo transparent size 1000,2000 rounded font 'Deja Vu Sans,19'
5+
set terminal pngcairo transparent size 1000,1900 rounded font 'Deja Vu Sans,19'
66
set output 'ocaml_all.png'
77

88
# set terminal tikz standalone size 15,6 textscale 0.5

measure/ocaml_all.png

-5.26 KB
Loading

motivation.tex

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ \subsection{McIlroy's Approach}
241241
then star xt
242242
else T.empty : concatenate lx (star lx)
243243
\end{lstlisting}
244+
\vspace{-\baselineskip}
244245
\caption{McIlroy's implementation of regular operators}
245246
\label{fig:regular-operators-0}
246247
\end{figure}
@@ -298,6 +299,7 @@ \subsection{Extending McIlroy}
298299
where
299300
lsigmastar = star (map T.singleton sigma)
300301
\end{lstlisting}
302+
\vspace{-\baselineskip}
301303
\caption{Additional operations in McIlroy's framework}
302304
\label{fig:more-regular-operators}
303305
\end{figure}
@@ -398,6 +400,7 @@ \section{Generation by Cross Section}
398400
combine n i =
399401
liftA2 T.append (lx !! i) (ly !! (n - i))
400402
\end{lstlisting}
403+
\vspace{-\baselineskip}
401404
% [T.append x y
402405
% | x <- lx !! i, y <- ]
403406
\caption{Concatenation for segment representation}
@@ -445,6 +448,7 @@ \section{Generation by Cross Section}
445448
combine n i =
446449
liftA2 T.append (lx !! i) (lstar !! (n - i))
447450
\end{lstlisting}
451+
\vspace{-\baselineskip}
448452
% combine n i =
449453
% [T.append x y
450454
% | x <- lx !! i, y <- lstar !! (n - i)]
@@ -467,6 +471,7 @@ \section{Generation by Cross Section}
467471
extend lsigmai =
468472
[T.cons a w | a <- sigma, w <- lsigmai]
469473
\end{lstlisting}
474+
\vspace{-\baselineskip}
470475
\caption{Complementation for the segment representation}
471476
\label{fig:llo-complement}
472477
\end{figure}

ocaml.tex

Lines changed: 20 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ \section{\ocaml Implementation}
33

44
\lstset{language=[Objective]Caml}
55

6-
We also implemented the complete
6+
We also implemented our
77
language generation algorithm in \ocaml.
88
% The \ocaml version only implements the ``latest'' version of the
99
% algorithm with a segmented representation, fast backward lookup and convolutions
@@ -91,12 +91,12 @@ \section{\ocaml Implementation}
9191
\autoref{code:sigs:word} contains the signature for words.
9292
It provides
9393
the empty word (for \code{One}),
94-
singleton words (for \code{Atom}), and to append two words.
94+
singleton words (for \code{Atom}), and append.
9595
Neither an ordering nor a length operation is needed:
9696
Comparison is encapsulated in the segment
9797
data structure and the length of a word is the index of the segment in
9898
which it appears.
99-
99+
%
100100
This signature is satisfied by the \ocaml \code{string}
101101
type (\ie arrays of bytes), arrays, lists of characters, or ropes. The
102102
type of individual characters is unrestricted.
@@ -106,8 +106,7 @@ \section{\ocaml Implementation}
106106
\autoref{code:sigs:segment} contains the signature for segments.
107107
% The first group of operations creates and tests for empty segments and
108108
% singleton segments.
109-
The main requirement is to support the operations on power series as described in \autoref{sec:gener-cross-sect}.
110-
We also requires the set operations
109+
The main requirement is to support the operations on power series as described in \autoref{sec:gener-cross-sect} and the set operations
111110
\code{union}, \code{inter} and \code{inter}.
112111
%
113112
The product described in \autoref{eq:1} is decomposed in two parts:
@@ -119,7 +118,7 @@ \section{\ocaml Implementation}
119118
by invocations of \code{append}.
120119
\end{itemize}
121120
%
122-
Experimentation with transient data-structures require s
121+
Experimentation with transient data-structures requires
123122
an explicit \code{memoize} function that avoids recomputing segments accessed
124123
multiple times.
125124
%
@@ -317,7 +316,7 @@ \subsection{Data Structures}
317316
%
318317
Such a memoization function incurs a linear cost on enumerations. To test
319318
if this operation is worthwhile we implemented two modules:
320-
\code{ThunkList} where memoization is the identity and \code{ThunkListMemo}
319+
\code{ThunkList} without memoization and \code{ThunkListMemo}
321320
with the implementation described above.
322321

323322
\paragraph{Lazy Lists}
@@ -338,8 +337,8 @@ \subsection{Data Structures}
338337

339338
As the main operations on segments are set operations, one might
340339
expect a set implementation to perform well. We implemented segments as sets
341-
of words using \ocaml's built-in \code{Set} module. \ocaml sets are implemented
342-
using balanced binary trees.
340+
of words using \ocaml's built-in \code{Set} module which relies on
341+
balanced binary trees.
343342
The only operations not implemented by \ocaml's standard library are
344343
the n-way merge and the product.
345344
%, which can be implemented using folds and unions.
@@ -351,38 +350,29 @@ \subsection{Data Structures}
351350
as maps from words to values where a word belongs to its domain if there is a
352351
path reaching a value labeled with the characters in the word.
353352
Tries seem well adapted to our problem:
354-
\begin{itemize}[leftmargin=*]
355-
\item As all words in a segment have the same length, we only need values at the leaves.
356-
% As no prefixes need to be represented.
357-
\item The \code{append} operation on tries can be implemented by
358-
grafting the second trie to all the leaves of the first one.
359-
\end{itemize}
360-
353+
since all words in a segment have the same length, we only need values at the leaves.
354+
% % As no prefixes need to be represented.
355+
% \item The \code{append} operation on tries can be implemented by
356+
% grafting the second trie to all the leaves of the first one.
357+
% \end{itemize}
358+
%
361359
Hence, we can implement tries like tries of integers \cite{Okasaki98fastmergeable}.
362360
For simplicity, we do not use path compression, which means
363361
that branches are always labeled with one character.
364-
A trie is either \code{Empty}, a \code{Leaf} containing a value, or a \code{Node} containing a map from characters
362+
A trie is either \code{Empty}, a \code{Leaf} or a \code{Node} containing a map from characters
365363
to its child tries.
366364
% As we are only interested in the paths, we consider tries
367365
% without values.
368-
369-
\begin{lstlisting}
370-
type trie =
371-
| Empty
372-
| Leaf
373-
| Node of trie CharMap.t
374-
\end{lstlisting}
375-
366+
%
376367
% The implementation of most operations follows the literature.
377368
The only novel operation is \code{append} which computes the product of two sets.
378-
As we only store values at the leaves,
379-
it can be implemented in a single traversal which will graft the appended trie
380-
\code{t0} at each leaf of \code{t}, without copies.
369+
It can be implemented in a single traversal which grafts the
370+
appended trie \code{t0} at each leaf of \code{t}, without copies.
381371

382372
\begin{lstlisting}
373+
type trie = Empty | Leaf | Node of trie CharMap.t
383374
let rec append t t0 = match t with
384-
| Empty -> Empty
385-
| Leaf -> t0
375+
| Empty -> Empty | Leaf -> t0
386376
| Node map ->
387377
CharMap.map (fun t' -> append t' t0) map
388378
\end{lstlisting}

0 commit comments

Comments
 (0)