commit eecccef8c324dfb57d3af7010f8863301b8a3b68
parent a77f5a01309d0f3e90248ab44522aa95efa74406
Author: Silas Brack <s174433@student.dtu.dk>
Date: Mon, 2 Jan 2023 22:39:53 +0100
Small updates.
Diffstat:
4 files changed, 73 insertions(+), 491 deletions(-)
diff --git a/chapters/higham.tex b/chapters/higham.tex
@@ -0,0 +1,60 @@
+Consider a neural network function \(f: \reals^q \rightarrow \reals^k\) parameterized in \(\theta \in \reals^n\) with a Jacobian given by \(J = J_{\theta}(f)(x) \in \reals^{k \times n}\).
+As per the Laplace approximation, we compute its posterior precision as:
+\begin{align}
+ \Sigma^{-1} = J\T J + \alpha \identity \label{eq:ggn-hessian}.
+\end{align}
+We can then sample from the Laplace posterior by taking the inverse square root of our precision matrix\cite{fasi2022computing} and using the reparameterisation trick:
+\begin{align}
+ \Sigma^{1/2} ={} & \alpha^{-1/2} \identity + J\T \left(J J\T\right)^{-1} \left(\left(J J\T + \alpha \identity\right)^{-1/2} - \alpha^{-1/2} \identity \right) J,\nonumber
+ \\ \Sigma^{1/2} \epsilon ={}& \alpha^{-1/2} \epsilon + J\T \left(J J\T\right)^{-1} \left(\left(J J\T + \alpha \identity\right)^{-1/2} J \epsilon - \alpha^{-1/2} J \epsilon \right), \label{eq:higham-samples}
+\end{align}
+with \(\epsilon \in \reals^n\).
+Unfortunately, this requires a precision matrix in the form of \cref{eq:ggn-hessian}.
+In reality, for a dataset of \(N\) independent observations \(x_n \in \reals^q\), our precision matrix \(\Sigma^{-1}\) becomes
+\begin{align}\label{eq:sum-ggn-hessian}
+ \Sigma^{-1} = \sum^N_n J_n\T J_n + \alpha \identity, \quad J_n = J_{\theta}(f)(x_n).
+\end{align}
+We can, however, stack the per-observation Jacobians and reframe this problem as
+\begin{align*}
+ \Sigma^{-1} = {J^\prime}\T J^\prime + \alpha \identity, \quad {J^\prime}\T = [J_1\T, J_2\T, ..., J_N\T] \T, \quad J^\prime \in \reals^{k N \times n},
+\end{align*}
+effectively reformulating \cref{eq:sum-ggn-hessian} into the form of \cref{eq:ggn-hessian}.
+However, we are trying to only store matrices of size \(k \times k\), which would now become \(kN \times kN\), which is infeasible.
+Ideally, we would like to be able to sum over the whole pseudo-inverse term and compute something along the lines of\footnote{From this point on, we use \(J = J^\prime\) in our equations.}
+\begin{align*}
+ \sum^N_n \left( J_n\T \left(J_n J_n\T\right)^{-1} \left(\left(J_n J_n\T + \alpha \identity\right)^{-1/2} J_n \epsilon - \alpha^{-1/2} J_n \epsilon \right) \right),
+\end{align*}
+since this would allow us to only compute one summation term at a time, and cumulatively sum them.
+However, this does not return the correct value.
+Let us analyse the shapes of the different terms in \cref{eq:higham-samples} as
+\begin{align*}
+ \Sigma^{1/2} \epsilon = \underbrace{\alpha^{-1/2} \epsilon}_{n} + \underbrace{J\T}_{n \times kN} \underbrace{\left(J J\T\right)^{-1}}_{kN \times kN} \left( \underbrace{\left(J J\T + \alpha \identity\right)^{-1/2}}_{kN \times kN} \underbrace{J \epsilon}_{kN} - \underbrace{\alpha^{-1/2} J \epsilon}_{kN} \right).
+\end{align*}
+Now, which matrix multiplications involve summing over two \(kN\)-shaped dimensions?\footnote{Notice that both \(J J\T\) and \(J \epsilon\) sum over \(n\).}
+Why is this relevant?
+Notice that these summations are the only thing which prevents us from simply summing over the whole term!
+These multiplications are bolded in the following equation:
+\begin{align*}
+ \Sigma^{1/2} \epsilon = \alpha^{-1/2} \epsilon + J\T \bullet \left(J J\T\right)^{-1} \bullet \left(\left(J J\T + \alpha \identity\right)^{-1/2} \bullet J \epsilon - \alpha^{-1/2} J \epsilon \right)
+\end{align*}
+Notice that in each of these terms we sum over the output size \(k\) naturally by performing the matrix multiplication, and that we would like to sum over \(N\) as well.
+Let us look at the individual terms which get summed over their \(kN\)-sized dimension.
+We separate these terms into \(A\) and \(B\):
+\begin{align*}
+ \Sigma^{1/2} \epsilon = \alpha^{-1/2} \epsilon + J\T \underbrace{\left(J J\T\right)^{-1} \biggl( \underbrace{\left(J J\T + \alpha \identity\right)^{-1/2} J \epsilon }_{A} - \alpha^{-1/2} J \epsilon \biggr)}_{B}.
+\end{align*}
+If we isolate the \(A\) and \(B\) terms and look at them per observation, we see that
+\begin{align*}
+ A_i ={} & \sum^N_n \left( J_i J_n\T + \alpha \identity \right)^{-1/2} J_n \epsilon,
+ \\ B_i ={}& \sum^N_n \left( J_i J_n\T \right)^{-1} A_n - \alpha^{-1/2} J_n \epsilon,
+ \\ \Sigma^{1/2} \epsilon ={}& \alpha^{-1/2} \identity + \sum^N_n J_n\T B_n.
+\end{align*}
+We can then sample as per
+\begin{align*}
+ \Sigma^{-\frac{1}{2}} \epsilon = \alpha^{-\frac{1}{2}} \identity + \sum^N_i J_i\T \left( \sum^N_j \left( J_i J_j\T \right)^{-1} \left( \sum^N_k \left( J_j J_k\T + \alpha \identity \right)^{-\frac{1}{2}} J_k \epsilon \right) - \alpha^{-\frac{1}{2}} J_j \epsilon \right).
+\end{align*}
+
+Unfortunately, this leads to a cubic dependency on the dataset size.\footnote{:-(}
+Why is this the case?
+Is this unexpected?
+If so, what aspect of this formulation causes this?
diff --git a/chapters/references.tex b/chapters/references.tex
@@ -1,322 +0,0 @@
-\setchapterstyle{kao}
-%\setchapterpreamble[u]{\margintoc}
-\chapter{References}
-\labch{references}
-
-\section{Citations}
-
-\index{citations}
-To cite someone \sidecite{Visscher2008,James2013} is very simple: just
-use the \Command{sidecite}\index{\Command{sidecite}} command. It does
-not have an offset argument yet, but it probably will in the future.
-This command supports multiple entries, as you can see, and by default
-it prints the reference on the margin as well as adding it to the
-bibliography at the end of the document. Note that the citations have
-nothing to do with the text,\sidecite{James2013} but they are completely
-random as they only serve the purpose to illustrate the feature.
-
-For this setup I wrote a separate package, \Package{kaobiblio}, which
-you can find in the \Package{styles} directory and include in your main
-tex file. This package accepts all the options that you can pass to
-\Package{biblatex}, and actually it passes them to \Package{biblatex}
-under the hood. Moreover, it also defines some commands, like
-\Command{sidecite}, and environments that can be used within a
-\Class{kao} book.\sidenote[][-.9cm]{For this reason you should always
- use \Package{kaobiblio} instead of \Package{biblatex}, but the syntax
- and the options are exactly the same.}
-
-If you want to use \Package{bibtex} instead of \Package{biblatex},
-pass the option \Option{backend=bibtex} to \Package{kaobiblio}.
-\Package{kaobiblio} also supports two options that are not shared with
-\Package{biblatex}: \Option{addspace} and \Option{linkeverything},
-both of which are boolean options, meaning that they can take
-either \enquote{true} or \enquote{false} as a value. If you
-pass \Option{addspace=true} when loading \Package{kaobiblio},
-a space will be automatically added before the citation marks.
-If you pass \Option{linkeverything=true}, the author's name in
-the authoryear-* and authortitle-* styles will be a hyperlink
-like the year.\sidenote{The fact that the author name is not
- a hyperlink bothers more than one biblatex user. There are
- \href{https://github.com/plk/biblatex/issues/428}{strong arguments}
- \emph{against} hyperlinking the author name, but in my personal opinion,
- linking the author's name does not result in any problems in most
- practical cases.}
-
-As you have seen, the \Command{sidecite} command will print a citation
-in the margin. However, this command would be useless without a way to
-customise the format of the citation, so the \Class{kaobook} provides
-also the \Command{formatmargincitation} command. By \enquote{renewing}
-that command, you can choose which items will be printed in the margins.
-The best way to understand how it works is to see the actual definition
-of this command.
-
-\begin{lstlisting}[style=kaolstplain,linewidth=1.5\textwidth]
-\newcommand{\formatmargincitation}[1]{%
- \parencite{#1}: \citeauthor*{#1} (\citeyear{#1}), \citetitle{#1}%
-}
-\end{lstlisting}
-
-Thus, the \Command{formatmargincitation} accepts one parameter, which is
-the citation key, and prints the parencite followed by a colon, then the
-author, then the year (in brackets), and finally the
-title.\sidecite{Battle2014} Now, suppose that you wish the margin
-citation to display the year and the author, followed by the title, and
-finally a fixed arbitrary string; you would add to your document:
-
-\begin{lstlisting}[style=kaolstplain,linewidth=1.5\textwidth]
-\renewcommand{\formatmargincitation}[1]{%
- \citeyear{#1}, \citeauthor*{#1}: \citetitle{#1}; very interesting!%
-}
-\end{lstlisting}
-
-\renewcommand{\formatmargincitation}[1]{%
- \citeyear{#1}, \citeauthor*{#1}: \citetitle{#1}; very interesting!%
-}
-
-The above code results in citations that look like the
-following.\sidecite{Zou2005} Of course, changing the format is most
-useful when you also change the default bibliography style. For
-instance, if you want to use the \enquote{philosophy-modern} style for
-your bibliography, you might have something like this in the preamble:
-
-\begin{lstlisting}[style=kaolstplain,linewidth=1.5\textwidth]
-\usepackage[style=philosophy-modern]{styles/kaobiblio}
-\renewcommand{\formatmargincitation}[1]{%
- \sdcite{#1}%
-}
-\addbibresource{main.bib}
-\end{lstlisting}
-
-\renewcommand{\formatmargincitation}[1]{%
- \parencite{#1}: \citeauthor*{#1} (\citeyear{#1}), \citetitle{#1}%
-}
-
-The commands like \Command{citeyear}, \Command{parencite}
-and \Command{sdcite} are just examples. A full
-reference of the available commands can be found in this
-\href{http://tug.ctan.org/info/biblatex-cheatsheet/biblatex-cheatsheet.pdf}{cheatsheet},
-under the \enquote{Citations} section.
-
-Finally, to compile a document containing citations, you need to use an
-external tool, which for this class is biber. You need to run the
-following (assuming that your tex file is called main.tex):
-
-\begin{lstlisting}[style=kaolstplain]
-$ pdflatex main
-$ biber main
-$ pdflatex main
-\end{lstlisting}
-
-\section{Glossaries and Indices}
-
-\index{glossary}
-The \Class{kaobook} class loads the packages \Package{glossaries} and
-\Package{imakeidx}, with which you can add glossaries and indices to
-your book. For instance, I previously defined some glossary entries and
-now I am going to use them, like this: \gls{computer}.
-\Package{glossaries} also allows you to use acronyms, like the
-following: this is the full version, \acrfull{fpsLabel}, and this is the
-short one \acrshort{fpsLabel}. These entries will appear in the glossary
-in the backmatter.
-
-Unless you use \href{https://www.overleaf.com}{Overleaf} or some other
-fancy IDE for \LaTeX, you need to run an external command from your
-terminal in order to compile a document with a glossary. In particular,
-the commands required are:\sidenote{These are the commands you would run
- in a UNIX system, but see also \nrefsec{compiling}; I have no idea about
- how it works in Windows.}
-
-\begin{lstlisting}[style=kaolstplain]
-$ pdflatex main
-$ makeglossaries main
-$ pdflatex main
-\end{lstlisting}
-
-Note that you need not run \texttt{makeglossaries} every time you
-compile your document, but only when you change the glossary entries.
-
-\index{index}
-To create an index, you need to insert the command
-\lstinline|\index{subject}| whenever you are talking about
-\enquote{subject} in the text. For instance, at the start of this
-paragraph I would write \lstinline|index{index}|, and an entry would be
-added to the Index in the backmatter. Check it out!
-
-\marginnote[2mm]{In theory, you would need to run an external command
- for the index as well, but luckily the package we suggested,
- \Package{imakeidx}, can compile the index automatically.}
-
-\index{nomenclature}
-A nomenclature is just a special kind of index; you can find one at the end of
-this book. To insert a nomenclature, we use the package \Package{nomencl} and
-add the terms with the command \Command{nomenclature}. We put then a
-\Command{printnomenclature} where we want it to appear.
-
-Also with this package we need to run an external command to compile the
-document, otherwise the nomenclature will not appear:
-
-\begin{lstlisting}[style=kaolstplain]
-$ pdflatex main
-$ makeindex main.nlo -s nomencl.ist -o main.nls
-$ pdflatex main
-\end{lstlisting}
-
-These packages are all loaded in
-\href{style/packages.sty}{packages.sty}, one of the files that come with
-this class. However, the configuration of the elements is best done in
-the main.tex file, since each book will have different entries and
-styles.
-
-Note that the \Package{nomencl} package caused problems when the
-document was compiled, so, to make a long story short, I had to prevent
-\Package{scrhack} to load the hack-file for \Package{nomencl}. When
-compiling the document on Overleaf, however, this problem seem to
-vanish.
-
-\marginnote[-19mm]{This brief section was by no means a complete
- reference on the subject, therefore you should consult the documentation
- of the above package to gain a full understanding of how they work.}
-
-\section{Hyperreferences}
-\labsec{hyprefs}
-
-\index{hyperreferences}
-Together with this class we provide a handy package to help you
-referencing the same elements always in the same way, for consistency
-across the book. First, you can label each element with a specific
-command. For instance, should you want to label a chapter, you would put
-\lstinline|\labch{chapter-title}| right after the \Command{chapter}
-directive. This is just a convenience, because \Command{labch} is
-actually just an alias to \lstinline|\label{ch:chapter-title}|, so it
-spares you the writing of \enquote{ch:}. We defined similar commands for
-many typically labeled elements, including:
-
-\begin{multicols}{2}
- \setlength{\columnseprule}{0pt}
- \begin{itemize}
- \item Page: \Command{labpage}
- \item Part: \Command{labpart}
- \item Chapter: \Command{labch}
- \item Section: \Command{labsec}
- \item Figure: \Command{labfig}
- \item Table: \Command{labtab}
- \item Definition: \Command{labdef}
- \item Assumption: \Command{labassum}
- \item Theorem: \Command{labthm}
- \item Proposition: \Command{labprop}
- \item Lemma: \Command{lablemma}
- \item Remark: \Command{labremark}
- \item Example: \Command{labexample}
- \item Exercise: \Command{labexercise}
- \end{itemize}
-\end{multicols}
-
-Of course, we have similar commands for referencing those elements.
-However, since the style of the reference should depend on the context,
-we provide different commands to reference the same thing. For instance,
-in some occasions you may want to reference the chapter by name, but
-other times you want to reference it only by number. In general, there
-are four reference style, which we call plain, vario, name, and full.
-
-The plain style references only by number. It is accessed, for chapters,
-with \lstinline|\refch{chapter-title}| (for other elements, the syntax
-is analogous). Such a reference results in: \refch{references}.
-
-The vario and name styles rest upon the \Package{varioref} package.
-Their syntax is \lstinline|\vrefch{chapter-title}| and
-\lstinline|\nrefch{chapter-title}|, and they result in:
-\vrefch{references}, for the vario style, and: \nrefch{references}, for
-the name style. As you can see, the page is referenced in
-\Package{varioref} style.
-
-The full style references everything. You can use it with
-\lstinline|\frefch{chapter-title}| and it looks like this:
-\frefch{references}.
-
-Of course, all the other elements have similar commands (\eg for parts
-you would use \lstinline|\vrefpart{part-title}| or something like that).
-However, not all elements implement all the four styles. The commands
-provided should be enough, but if you want to see what is available or
-to add the missing ones, have a look at the
-\href{styles/kaorefs.sty}{attached package}.
-
-In order to have access to all these features, the \Package{kaorefs}
-should be loaded in the preamble of your document. It should be loaded
-last, or at least after \Package{babel} (or \Package{polyglossia}) and
-\Package{plaintheorems} (or \Package{mdftheorems}). Options can be
-passed to it like to any other package; in particular, it is possible to
-specify the language of the captions. For instance, if you specify
-\enquote{italian} as an option, instead of \enquote{Chapter} it will be
-printed \enquote{Capitolo}, the Italian analog. If you know other
-languages, you are welcome to contribute the translations of these
-captions! Feel free to contact the author of the class for further
-details.
-
-The \Package{kaorefs} package also include \Package{cleveref}, so it is
-possible to use \Command{cref} in addition to all the previously
-described referencing commands.
-
-\section{A Final Note on Compilation}
-\labsec{compiling}
-
-Probably the easiest way to compile a latex document is with the
-\Package{latexmk} script, as it can take care of everything, if properly
-configured, from the bibliography to the glossary. The command to issue,
-in general, is:
-
-\begin{lstlisting}
-latexmk [latexmk_options] [filename ...]
-\end{lstlisting}
-
-\Package{latexmk} can be extensively configured (see
-\url{https://mg.readthedocs.io/latexmk.html}). For convenience, I print
-here an example configuration that would cover all the steps described
-above.
-
-\begin{lstlisting}
-# By default compile only the file called 'main.tex'
-@default_files = ('main.tex');
-
-# Compile the glossary and acronyms list (package 'glossaries')
-add_cus_dep( 'acn', 'acr', 0, 'makeglossaries' );
-add_cus_dep( 'glo', 'gls', 0, 'makeglossaries' );
-$clean_ext .= " acr acn alg glo gls glg";
-sub makeglossaries {
- my ($base_name, $path) = fileparse( $_[0] );
- pushd $path;
- my $return = system "makeglossaries", $base_name;
- popd;
- return $return;
-}
-
-# Compile the nomenclature (package 'nomencl')
-add_cus_dep( 'nlo', 'nls', 0, 'makenlo2nls' );
-sub makenlo2nls {
- system( "makeindex -s nomencl.ist -o \"$_[0].nls\" \"$_[0].nlo\"" );
-}
-\end{lstlisting}
-
-However, if you'd rather not use an external package and want to do
-everything manually, here are some tips.\sidenote{As the author only
- uses Linux and compiles everything from the command line, he doesn't
- know how the compilation works in Windows or Mac. The tips, therefore,
- refer to the usage with Linux from the command line.}
-
-\minisec{Compiling the examples in the kaobook repository}
-To compile the examples, and in particular the documentation, that are
-in the \Path{examples} directory of the
-\href{https://github.com/fmarotta/kaobook}{kaobook repository} on
-GitHub, do as follows. \lstinline[language=bash]|cd| into the root
-directory of the repository, and run
-\lstinline|pdflatex -output-directory examples/documentation main.tex|.
-With this trick, you can compile the documentation using the class files
-pertaining to the repository (and not, say, those in your texmf tree).
-The \enquote{-output-directory} option works with the other
-\LaTeX-related commands such as biber and makeglossaries.
-
-A note of warning: sometimes \LaTeX\ needs more than one run to get the
-correct position of each element; this is true in particular for the
-positioning of floating elements like figures, tables, and margin notes.
-Occasionally, \LaTeX\ can need up to four re-runs, so If the alignment
-of margin elements looks odd, or if they bleed into ther main text, try
-runnign pdflatex one more time.
diff --git a/chapters/textnotes.tex b/chapters/textnotes.tex
@@ -1,163 +0,0 @@
-\setchapterpreamble[u]{\margintoc}
-\chapter{Margin Stuff}
-
-Sidenotes are a distinctive feature of all 1.5-column-layout books.
-Indeed, having wide margins means that some material can be displayed
-there. We use margins for all kind of stuff: sidenotes, marginnotes,
-small tables of contents, citations, and, why not?, special boxes and
-environments.
-
-\section{Sidenotes}
-
-Sidenotes are like footnotes, except that they go in the margin, where
-they are more readable. To insert a sidenote, just use the command
-\Command{sidenote\{Text of the note\}}. You can specify a
-mark\sidenote[O]{This sidenote has a special mark, a big O!} with \\
-\Command{sidenote[mark]\{Text\}}, but you can also specify an offset,
-which moves the sidenote upwards or downwards, so that the full syntax is:
-
-\begin{lstlisting}[style=kaolstplain]
-\sidenote[mark][offset]{Text}
-\end{lstlisting}
-
-If you use an offset, you always have to add the brackets for the mark,
-but they can be empty.\sidenote{If you want to know more about the usage
- of the \Command{sidenote} command, read the documentation of the
- \Package{sidenotes} package.}
-
-In \Class{kaobook} we copied a feature from the \Package{snotez}
-package: the possibility to specify a multiple of \Command{baselineskip}
-as an offset. For example, if you want to enter a sidenote with the
-normal mark and move it upwards one line, type:
-
-\begin{lstlisting}[style=kaolstplain]
-\sidenote[][*-1]{Text of the sidenote.}
-\end{lstlisting}
-
-As we said, sidenotes are handled through the \Package{sidenotes}
-package, which in turn relies on the \Package{marginnote} package.
-
-\section{Marginnotes}
-
-This command is very similar to the previous one. You can create a
-marginnote with \Command{marginnote[offset]\{Text\}}, where the offset
-argument can be left out, or it can be a multiple of
-\Command{baselineskip},\marginnote[-1cm]{While the command for margin
- notes comes from the \Package{marginnote} package, it has been redefined
- in order to change the position of the optional offset argument, which
- now precedes the text of the note, whereas in the original version it
- was at the end. We have also added the possibility to use a multiple of
- \Command{baselineskip} as offset. These things were made only to make
- everything more consistent, so that you have to remember less things!}
-\eg
-
-\begin{lstlisting}[style=kaolstplain]
-\marginnote[-12pt]{Text} or \marginnote[*-3]{Text}
-\end{lstlisting}
-
-\begin{kaobox}[frametitle=To Do]
- A small thing that needs to be done is to renew the \Command{sidenote}
- command so that it takes only one optional argument, the offset. The
- special mark argument can go somewhere else. In other words, we want the
- syntax of \Command{sidenote} to resemble that of \Command{marginnote}.
-\end{kaobox}
-
-We load the packages \Package{marginnote}, \Package{marginfix} and
-\Package{placeins}. Since \Package{sidenotes} uses \Package{marginnote},
-what we said for marginnotes is also valid for sidenotes. Side- and
-margin- notes are shifted slightly upwards
-(\Command{renewcommand\{\textbackslash marginnotevadjust\}\{3pt\}}) in
-order to align them to the bottom of the line of text where the note is
-issued. Importantly, both sidenotes and marginnotes are defined as
-floating if the optional argument (\ie the vertical offset) is left
-blank, but if the offset is specified they are not floating. Recall that
-floats cannot be nested, so in some rare cases you may encounter errors
-about lost floats; in those cases, remember that sidenotes and
-marginnotes are floats. To solve the problem, it may be possible to
-transform them into non-floating elements by specifying an offset of
-0pt.
-
-\section{Footnotes}
-
-Even though they are not displayed in the margin, we will discuss about
-footnotes here, since sidenotes are mainly intended to be a replacement
-of them. Footnotes force the reader to constantly move from one area of
-the page to the other. Arguably, marginnotes solve this issue, so you
-should not use footnotes. Nevertheless, for completeness, we have left
-the standard command \Command{footnote}, just in case you want to put a
-footnote once in a while.\footnote{And this is how they look like.
- Notice that in the PDF file there is a back reference to the text;
- pretty cool, uh?}
-
-\section{Margintoc}
-
-Since we are talking about margins, we introduce here the
-\Command{margintoc} command, which allows one to put small table of
-contents in the margin. Like other commands we have discussed,
-\Command{margintoc} accepts a parameter for the vertical offset, like
-so: \Command{margintoc[offset]}.
-
-The command can be used in any point of the document, but we think it
-makes sense to use it just at the beginning of chapters or parts. In
-this document I make use of a \KOMAScript\xspace feature and put it in
-the chapter preamble, with the following code:
-
-\marginnote{The font used in the margintoc is the same as the one for
- the chapter entries in the main table of contents at the beginning
- of the document.}
-
-\begin{lstlisting}[style=kaolstplain]
-\setchapterpreamble[u]{\margintoc}
-\chapter{Chapter title}
-\end{lstlisting}
-
-As the space in the margin is a valuable resource, there is the
-possibility to print a shorter version of the title in the margin toc.
-Thus, there are in total three possible versions for the title of a
-section (or subsection): the one for the main text, the one for the main
-table of contents, and the one for the margintoc. These versions can be
-specified at the same time when the section is created in the source
-\TeX file:
-\begin{lstlisting}[style=kaolstplain]
-\section[alternative-title-for-toc]{title-as-written-in-text}[alternative-title-for-margintoc]
-\end{lstlisting}
-
-By default, the margintoc includes sections and subsections.
-If you only want to show sections, add
-\begin{lstlisting}[style=kaolstplain]
-\setcounter{margintocdepth}{\sectiontocdepth}
-\end{lstlisting}
-somewhere in your preamble.
-
-\section{Marginlisting}
-
-On some occasions it may happen that you have a very short piece of code
-that doesn't look good in the body of the text because it breaks the
-flow of narration: for that occasions, you can use a
-\Environment{marginlisting}. The support for this feature is still
-limited, especially for the captions, but you can try the following
-code:
-
-\begin{marginlisting}[-1.35cm]
- \caption{An example of a margin listing.}
- \vspace{0.6cm}
- \begin{lstlisting}[language=Python,style=kaolstplain]
-print("Hello World!")
- \end{lstlisting}
-\end{marginlisting}
-
-\begin{verbatim}
-\begin{marginlisting}[-0.5cm]
- \caption{My caption}
- \vspace{0.2cm}
- \begin{lstlisting}[language=Python,style=kaolstplain]
- ... code ...
- \end{lstlisting}
-\end{marginlisting}
-\end{verbatim}
-
-Unfortunately, the space between the caption and the listing must be
-adjusted manually; if you find a better way, please let me know.
-
-Not only textual stuff can be displayed in the margin, but also figures.
-Those will be the focus of the next chapter.
diff --git a/glossary.tex b/glossary.tex
@@ -1,9 +1,16 @@
-\newglossaryentry{computer}{
- name=computer,
- description={is a programmable machine that receives input, stores and manipulates data, and provides output in a useful format}
+\newglossaryentry{hessian-vector-product}{
+ name={Hessian-vector product},
+ description={is the concept of multiplying a Hessian with a vector}
+}
+\newglossaryentry{hvp}{
+ name={HVP},
+ description={is the specific memory-efficient JAX implementation of the Hessian-vector product}
+}
+\newglossaryentry{gvp}{
+ name={GVP},
+ description={is the specific memory-efficient JAX implementation of the Generalised-Gauss-Newton-vector product}
}
% Glossary entries (used in text with e.g. \acrfull{fpsLabel} or \acrshort{fpsLabel})
-\newacronym[longplural={Frames per Second}]{fpsLabel}{FPS}{Frame per Second}
-\newacronym[longplural={Tables of Contents}]{tocLabel}{TOC}{Table of Contents}
-
+% \newacronym[longplural={Frames per Second}]{fpsLabel}{FPS}{Frame per Second}
+% \newacronym[longplural={Tables of Contents}]{tocLabel}{TOC}{Table of Contents}