commit 0203f4439e2cb0420e6b58aa9a939322e2ffdc32
parent 5873a042db28fec2318f0c108b7d9b0a76ac6735
Author: Silas Brack <s174433@student.dtu.dk>
Date: Mon, 2 Jan 2023 01:03:06 +0100
Formatted.
Diffstat:
9 files changed, 372 insertions(+), 372 deletions(-)
diff --git a/chapters/acknowledgments.tex b/chapters/acknowledgments.tex
@@ -3,22 +3,22 @@
\blackout
{
-To S{\o}ren's group --- in particular, Marco --- for always making me feel like a part of the group, and like my contribution was valued.
+ To S{\o}ren's group --- in particular, Marco --- for always making me feel like a part of the group, and like my contribution was valued.
-To Marco and Frederik for giving me the chance to dip my toes in ``real'' research in the rawest, realest way possible, with what I perceive to be all of the highs and the lows which constitute it.
+ To Marco and Frederik for giving me the chance to dip my toes in ``real'' research in the rawest, realest way possible, with what I perceive to be all of the highs and the lows which constitute it.
-To S{\o}ren, for always being up for a great chat, for giving me the opportunity to work on difficult and novel problems (such as preconditioning), and for approaching everything with kindness.
-I don't think I could have chosen a better supervisor.
+ To S{\o}ren, for always being up for a great chat, for giving me the opportunity to work on difficult and novel problems (such as preconditioning), and for approaching everything with kindness.
+ I don't think I could have chosen a better supervisor.
-To J\'ulia, Brandon and Julia for the constant laughs and endless opportunities to relax on the couch when working was too much (memes surrounding me working on the couch aside)
-And to Adam, with who I shared the experience of writing a thesis --- highs and lows both.
+ To J\'ulia, Brandon and Julia for the constant laughs and endless opportunities to relax on the couch when working was too much (memes surrounding me working on the couch aside)
+ And to Adam, with who I shared the experience of writing a thesis --- highs and lows both.
-To Jason and Kristi for always cultivating/imparting/instilling/nurturing in me a sense of curiosity and independence
-And for never forgetting me in the supermarket.
+ To Jason and Kristi for always cultivating/imparting/instilling/nurturing in me a sense of curiosity and independence
+ And for never forgetting me in the supermarket.
-Lorenza
+ Lorenza
-And above all else, \emph{to Steampunk}.
+ And above all else, \emph{to Steampunk}.
}
\begin{flushright}
diff --git a/chapters/appendix.tex b/chapters/appendix.tex
@@ -3,52 +3,52 @@
% \setchapterpreamble[u]{\margintoc}
\begin{algorithm}
-\caption{Multi-Shift Minimum Residual (msMINRES)}\label{alg:msminres}
-\Input{$\bm K \succ 0$, $\bm b$, $\bm P \succ 0$, $t_1, \ldots, t_Q$, $J > 0$}
-\Output{$\bm c_1 = (\bm K + t_1)^{-1} \bm b, \ldots, \bm c_Q = (\bm K + t_Q)^{-1} \bm b$}
-$\norm{\bm b}_2 \gets \left( \bm b \cdot \bm b \right)^{1/2}$\;
-$\bm b \gets \bm b / \norm{\bm b}_2$\;
-$\bm p \gets \bm K \bm b$\;
-$\bm z_{-1} = \bm 0$\;%Like \bm p
-$\bm z_{0} = \bm b$\;
-$\bm q_{0} = \bm P \bm z_{0}$\;
-$\beta_{0} = \left(\bm z_{0} \cdot \bm q_{0} \right)$\;
-\For{$q \gets 1$ \KwTo $Q$}{
- $\bm c^{(q)}_{0} \gets \bm 0$\;
- $\bm d^{(q)}_{0}, \bm d^{(q)}_{-1} \gets \bm 0$\;%Like \bm b
- $\cos^{(q)}_0, \cos^{(q)}_{-1} \gets 1$\;
- $\sin^{(q)}_0, \sin^{(q)}_{-1} \gets 0$\;
- $\varphi^{(q)}_0 \gets \beta_{0}$\;
-}
-\For{$j \gets 1$ \KwTo $J$}{
- $\bm p \gets \bm K \bm q_{j-1}$\; % Removed negative because we input the "negative" K matrix
- % $\bm p \gets - \bm K \bm q_{j-1}$\;
- $\alpha_{j} \gets \bm p \cdot \bm q_{j-1}$\;
- $\bm z_j \gets \bm p - \alpha_j \bm z_{j-1} - \beta_{j-1} \bm z_{j-2}$\;
- $\bm q_j \gets \bm P \bm z_j$\;
- $\beta_j \gets \left({\bm z_j \bm q_j}\right)^{1/2}$\;
- % $\beta_j = \sqrt{\bm z_j \bm q_j}$\;
- $\bm z_j \gets \bm z_j / \beta_{j}$\;
- $\bm q_j \gets \bm q_j / \beta_{j}$\;
+ \caption{Multi-Shift Minimum Residual (msMINRES)}\label{alg:msminres}
+ \Input{$\bm K \succ 0$, $\bm b$, $\bm P \succ 0$, $t_1, \ldots, t_Q$, $J > 0$}
+ \Output{$\bm c_1 = (\bm K + t_1)^{-1} \bm b, \ldots, \bm c_Q = (\bm K + t_Q)^{-1} \bm b$}
+ $\norm{\bm b}_2 \gets \left( \bm b \cdot \bm b \right)^{1/2}$\;
+ $\bm b \gets \bm b / \norm{\bm b}_2$\;
+ $\bm p \gets \bm K \bm b$\;
+ $\bm z_{-1} = \bm 0$\;%Like \bm p
+ $\bm z_{0} = \bm b$\;
+ $\bm q_{0} = \bm P \bm z_{0}$\;
+ $\beta_{0} = \left(\bm z_{0} \cdot \bm q_{0} \right)$\;
\For{$q \gets 1$ \KwTo $Q$}{
- $\epsilon^{(q)}_{j} \gets \sin^{(q)}_{j-2} \beta_{j-1}$\;%\Comment{Start Givens rotation}
- $\zeta^{(q)}_{j} \gets \cos^{(q)}_{j-2} \beta_{j-1}$\;
- $\alpha^{(q)}_{j} \gets \alpha_{j} + t_q$\;%\Comment{Compute shifted alpha}
- $\eta^{(q)}_j \gets \cos^{(q)}_{j-1} \alpha^{(q)}_{j} - \sin^{(q)}_{j-1} \zeta^{(q)}_{j}$\;%\Comment{Givens rotation from 1 step ago}
- $\zeta^{(q)}_{j} \gets \cos^{(q)}_{j-1} \zeta^{(q)}_{j} + \sin^{(q)}_{j-1} \alpha^{(q)}_{j}$\;
- $r^{(q)}_{j} \gets \left({\eta^{(q)2}_{j} + \beta^2_{j}}\right)^{1/2}$\;%\Comment{Compute next Givens terms}
- % $r^{(q)}_{j} \gets \sqrt{\eta^{(q)2}_{j} + \beta^2_{j}}$\;%\Comment{Compute next Givens terms}
- $\cos^{(q)}_{j} \gets \eta^{(q)}_{j} / r^{(q)}_{j}$\;
- $\sin^{(q)}_{j} \gets \beta^{(q)}_{j} / r^{(q)}_{j}$\;
- $\eta^{(q)}_{j} \gets \eta^{(q)}_{j} \cos^{(q)}_{j} + \sin^{(q)}_{j} \beta_{j}$\;%\Comment{Apply current Givens rotation}
- $\varphi^{(q)}_{j} \gets - \varphi^{(q)}_{j-1} \sin^{(q)}_{j}$\;%\Comment{Apply the latest Givens rotation to the Lanczos-rhs, computing the scale terms for the search vectors}
- $\varphi^{(q)}_{j-1} \gets \varphi^{(q)}_{j-1} \cos^{(q)}_{j}$\;
- $\bm d^{(q)}_j \gets \left( \bm q_{j-1} - \zeta^{(q)}_{j} \bm d^{(q)}_{j-1} - \epsilon^{(q)}_{j} \bm d^{(q)}_{j-2} \right) / \eta^{(q)}_{j}$\;%\Comment{Get the new search vector}
- $\Delta \bm c^{(q)}_{j} \gets \bm d^{(q)}_{j} \varphi^{(q)}_{j-1}$\;
- $\bm c^{(q)}_{j} \gets \bm c^{(q)}_{j-1} + \Delta \bm c^{(q)}_{j}$\;%\Comment{Update the solution}
+ $\bm c^{(q)}_{0} \gets \bm 0$\;
+ $\bm d^{(q)}_{0}, \bm d^{(q)}_{-1} \gets \bm 0$\;%Like \bm b
+ $\cos^{(q)}_0, \cos^{(q)}_{-1} \gets 1$\;
+ $\sin^{(q)}_0, \sin^{(q)}_{-1} \gets 0$\;
+ $\varphi^{(q)}_0 \gets \beta_{0}$\;
+ }
+ \For{$j \gets 1$ \KwTo $J$}{
+ $\bm p \gets \bm K \bm q_{j-1}$\; % Removed negative because we input the "negative" K matrix
+ % $\bm p \gets - \bm K \bm q_{j-1}$\;
+ $\alpha_{j} \gets \bm p \cdot \bm q_{j-1}$\;
+ $\bm z_j \gets \bm p - \alpha_j \bm z_{j-1} - \beta_{j-1} \bm z_{j-2}$\;
+ $\bm q_j \gets \bm P \bm z_j$\;
+ $\beta_j \gets \left({\bm z_j \bm q_j}\right)^{1/2}$\;
+ % $\beta_j = \sqrt{\bm z_j \bm q_j}$\;
+ $\bm z_j \gets \bm z_j / \beta_{j}$\;
+ $\bm q_j \gets \bm q_j / \beta_{j}$\;
+ \For{$q \gets 1$ \KwTo $Q$}{
+ $\epsilon^{(q)}_{j} \gets \sin^{(q)}_{j-2} \beta_{j-1}$\;%\Comment{Start Givens rotation}
+ $\zeta^{(q)}_{j} \gets \cos^{(q)}_{j-2} \beta_{j-1}$\;
+ $\alpha^{(q)}_{j} \gets \alpha_{j} + t_q$\;%\Comment{Compute shifted alpha}
+ $\eta^{(q)}_j \gets \cos^{(q)}_{j-1} \alpha^{(q)}_{j} - \sin^{(q)}_{j-1} \zeta^{(q)}_{j}$\;%\Comment{Givens rotation from 1 step ago}
+ $\zeta^{(q)}_{j} \gets \cos^{(q)}_{j-1} \zeta^{(q)}_{j} + \sin^{(q)}_{j-1} \alpha^{(q)}_{j}$\;
+ $r^{(q)}_{j} \gets \left({\eta^{(q)2}_{j} + \beta^2_{j}}\right)^{1/2}$\;%\Comment{Compute next Givens terms}
+ % $r^{(q)}_{j} \gets \sqrt{\eta^{(q)2}_{j} + \beta^2_{j}}$\;%\Comment{Compute next Givens terms}
+ $\cos^{(q)}_{j} \gets \eta^{(q)}_{j} / r^{(q)}_{j}$\;
+ $\sin^{(q)}_{j} \gets \beta^{(q)}_{j} / r^{(q)}_{j}$\;
+ $\eta^{(q)}_{j} \gets \eta^{(q)}_{j} \cos^{(q)}_{j} + \sin^{(q)}_{j} \beta_{j}$\;%\Comment{Apply current Givens rotation}
+ $\varphi^{(q)}_{j} \gets - \varphi^{(q)}_{j-1} \sin^{(q)}_{j}$\;%\Comment{Apply the latest Givens rotation to the Lanczos-rhs, computing the scale terms for the search vectors}
+ $\varphi^{(q)}_{j-1} \gets \varphi^{(q)}_{j-1} \cos^{(q)}_{j}$\;
+ $\bm d^{(q)}_j \gets \left( \bm q_{j-1} - \zeta^{(q)}_{j} \bm d^{(q)}_{j-1} - \epsilon^{(q)}_{j} \bm d^{(q)}_{j-2} \right) / \eta^{(q)}_{j}$\;%\Comment{Get the new search vector}
+ $\Delta \bm c^{(q)}_{j} \gets \bm d^{(q)}_{j} \varphi^{(q)}_{j-1}$\;
+ $\bm c^{(q)}_{j} \gets \bm c^{(q)}_{j-1} + \Delta \bm c^{(q)}_{j}$\;%\Comment{Update the solution}
+ }
+ }
+ \For{$q \gets 1$ \KwTo $Q$}{
+ $\bm c_q \gets \bm c^{(q)}_J \norm{\bm b}_2$\;
}
-}
-\For{$q \gets 1$ \KwTo $Q$}{
- $\bm c_q \gets \bm c^{(q)}_J \norm{\bm b}_2$\;
-}
\end{algorithm}
diff --git a/chapters/literature.tex b/chapters/literature.tex
@@ -49,7 +49,7 @@ However, instead of finding the optimal Gaussian distribution locations and scal
Since the Taylor expansion is performed around the MAP solution, the first order derivative is zero, and the expansion is simply given by
\begin{align*}
\ln p(\bm \theta \given \bm y)
- \approx{} & \ln p(\bm \theta_{\textsc{map}} \given \bm y) +
+ \approx{} & \ln p(\bm \theta_{\textsc{map}} \given \bm y) +
\\ & + \frac{1}{2} (\bm \theta - \bm \theta_{\textsc{map}})\T \left( \left.\nabla^2_{\bm \theta} \ln p(\bm \theta \given \bm y) \right|_{\bm \theta_\mathrm{MAP}} \right) (\bm \theta - \bm \theta_{\textsc{map}}) %\label{eq:laplace-taylor}
\\ \Rightarrow \tilde{p}(\bm \theta \given \bm y) \approx{}& p(\bm \theta_{\textsc{map}} \given \bm y) \exp\left(- \frac{1}{2} (\bm \theta - \bm \theta_{\textsc{map}})\T \bm \Lambda (\bm \theta - \bm \theta_{\textsc{map}})\right) \propto p(\bm \theta \given \bm y) \nonumber
\end{align*}
diff --git a/chapters/mixture.tex b/chapters/mixture.tex
@@ -9,23 +9,23 @@ We could then frame the Laplace posterior as a mixture of per-sample Laplace app
such that \(\sum^N_i w_i \bm \mu_i = \bm \mu_{\textsc{map}}\) and \(\sum_i^N w_i = 1\).
Sampling from this model would then involve sampling an index
\begin{align}
- i \sim{}& \mathrm{Cat}(N, \bm w)
-\\ \bm \epsilon \sim{}& \normal(\bm \mu_i, \bm \Sigma_i)
+ i \sim{} & \mathrm{Cat}(N, \bm w)
+ \\ \bm \epsilon \sim{}& \normal(\bm \mu_i, \bm \Sigma_i)
\end{align}
where \(\bm \mu_i\) is computed by shifting the MAP solution based on ??? and \(\bm \Sigma_i\) is computed as the inverse precision matrix from the Laplace approximation, as per \cref{eq:shifted-map}.
\begin{align}\label{eq:shifted-map}
- \bm \mu_i ={}& \bm \mu_{\textsc{map}} - \nabla_{\bm\theta} F_n (\bm \theta) \nabla_{\bm\theta}^2 F_n (\bm \theta)
-\\ \bm \Sigma^{-1}_i ={}& - \nabla^2_{\bm \theta} \log p(\bm \theta \given x_i)
+ \bm \mu_i ={} & \bm \mu_{\textsc{map}} - \nabla_{\bm\theta} F_n (\bm \theta) \nabla_{\bm\theta}^2 F_n (\bm \theta)
+ \\ \bm \Sigma^{-1}_i ={}& - \nabla^2_{\bm \theta} \log p(\bm \theta \given x_i)
\end{align}
The reparameterisation trick can then be performed using only a single observation to determine the covariance matrix
\begin{align}
- \bm \epsilon ={}& \bm \mu_i + \bm \Sigma^{-1/2}_i \bm \epsilon_0,
+ \bm \epsilon ={} & \bm \mu_i + \bm \Sigma^{-1/2}_i \bm \epsilon_0,
\end{align}
where, since \(\bm \Sigma^{-1}_i = J_i\T H_i J_i + \alpha / N \identity\) is low-rank with rank \(o\), the Woodbury identity from \cref{sec:woodbury} can be used.
This method depends on the conditioning number of the outer product \(J H J\T\), which is significantly lower than that of the inner product \(J\T H J\).
However, this method poses some major issues when it comes to computing the evidence of the model.
\begin{align}
- p(\bm x) ={}& \int_{\bm \theta} p(\bm x \given \bm \theta) p(\bm \theta)\,d \bm \theta
-\\ ={}& \prod^N_n \exp F_n (\bm \theta_\textsc{map}) \int_{\bm \theta} \exp\left\{ -\frac{1}{2} (\bm\theta - \bm\theta_\textsc{map} )\T \Lambda_n (\bm\theta - \bm\theta_\textsc{map} )\,d\bm\theta \right\}
+ p(\bm x) ={} & \int_{\bm \theta} p(\bm x \given \bm \theta) p(\bm \theta)\,d \bm \theta
+ \\ ={}& \prod^N_n \exp F_n (\bm \theta_\textsc{map}) \int_{\bm \theta} \exp\left\{ -\frac{1}{2} (\bm\theta - \bm\theta_\textsc{map} )\T \Lambda_n (\bm\theta - \bm\theta_\textsc{map} )\,d\bm\theta \right\}
\end{align}
diff --git a/chapters/preface.tex b/chapters/preface.tex
@@ -3,11 +3,11 @@
\blackout
{
-I've been studying for a pretty long time.
-I suppose that, because of this, there is some kind of expectation of anticipation, of the sensation that a culmination/apogee of a.
-I, not always being the biggest adherent to the idea of symbol-for-the-sake-of-symbol, wasn't sure what to expect of this experience
+ I've been studying for a pretty long time.
+ I suppose that, because of this, there is some kind of expectation of anticipation, of the sensation that a culmination/apogee of a.
+ I, not always being the biggest adherent to the idea of symbol-for-the-sake-of-symbol, wasn't sure what to expect of this experience
-The work in this thesis is the product of a five-month-long research project conducted in the Section for Cognitive Systems of DTU Compute, during which I helped develop some of the ideas in the paper ``Large-Scale Laplace''(cite).
+ The work in this thesis is the product of a five-month-long research project conducted in the Section for Cognitive Systems of DTU Compute, during which I helped develop some of the ideas in the paper ``Large-Scale Laplace''(cite).
}
\begin{flushright}
diff --git a/chapters/references.tex b/chapters/references.tex
@@ -6,24 +6,24 @@
\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
+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.}
+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}.
@@ -36,18 +36,18 @@ 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
+ 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]
@@ -56,11 +56,11 @@ of this command.
}
\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
+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]
@@ -73,10 +73,10 @@ finally a fixed arbitrary string; you would add to your document:
\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
+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]
@@ -97,8 +97,8 @@ 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
+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]
@@ -110,21 +110,21 @@ $ pdflatex main
\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
+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.}
+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
@@ -132,18 +132,18 @@ $ makeglossaries main
$ pdflatex main
\end{lstlisting}
-Note that you need not run \texttt{makeglossaries} every time you
+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
+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,
+\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}
@@ -152,7 +152,7 @@ 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
+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]
@@ -161,107 +161,107 @@ $ 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
+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
+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.}
+\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}
+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
+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}
+ \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
+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
+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
+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:
+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
+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
+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,
+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}
@@ -269,8 +269,8 @@ 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
+\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}
@@ -296,22 +296,22 @@ sub makenlo2nls {
}
\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.}
+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
+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
+\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
diff --git a/chapters/sampling.tex b/chapters/sampling.tex
@@ -7,7 +7,7 @@
In many methods, such as the Laplace approximation (\cref{sec:laplace}), we need to sample from a multivariate normal distribution parameterised by a mean vector \(\bm \mu\) and a covariance matrix \(\bm \Sigma\).
To sample from a Gaussian distribution, you can apply the \emph{reparameterisation trick} to compute a vector of samples as
\begin{align}\label{eq:sample-reparam}
- \bm \epsilon ={}& \bm \mu + \bm \Sigma^{1/2} \bm \epsilon_0,
+ \bm \epsilon ={} & \bm \mu + \bm \Sigma^{1/2} \bm \epsilon_0,
\end{align}
where \(\bm \epsilon_0\) are samples drawn from a standard normal distribution, i.e., \(\bm \epsilon_0 \sim \normal(\bm 0, \identity)\).
@@ -34,19 +34,19 @@ There are then essentially three steps to CIQ, namely:
\end{enumerate}
\begin{algorithm}
-\caption{Contour Integral Quad (CIQ)}\label{alg:ciq}
-\Input{$\bm K \succ 0$, $\bm b$, $\bm P \succ 0$, $J > 0$, $Q > 0$}
-\Output{$\bm s = \bm K^{-1/2} b$}
-$\_, \bm\alpha, \bm\beta \gets \mathrm{CG}(\bm K, \bm b, \bm P, J)$\;
-$M_{\mathrm{Lanczos}} \gets \mathrm{TriDiag}(\bm\alpha, \bm\beta)$\;
-$\lambda_M \gets \lambda(M_{\mathrm{Lanczos}})$\;
-$\lambda_{\min} \gets \min{\lambda_M}$\;
-$\lambda_{\max} \gets \max{\lambda_M}$\;
-$w_1, \ldots, w_Q, t_1, \ldots, t_Q \gets \mathrm{Quadrature}(\lambda_{\min}, \lambda_{\max}, Q)$\;
-$\bm c_1, \ldots, \bm c_Q \gets \mathrm{msMINRES}(-\bm K, \bm b, t_q, \bm P, J)$ \Comment*[r]{$\left( t_q \identity - \bm K \right)^{-1} \bm b$.}
-% $s_q \gets \left( t_q \identity + H \right)^{-1} b$ \Comment*[r]{Computed via msMINRES(K, t, J).}
-$\bm s \gets \sum^Q_{q=1} w_q \bm c_q$\;
-% $\mathrm{samples} \gets \sum^Q_{q=1} w_q \left( t_q \identity + H \right)^{-1} b$
+ \caption{Contour Integral Quad (CIQ)}\label{alg:ciq}
+ \Input{$\bm K \succ 0$, $\bm b$, $\bm P \succ 0$, $J > 0$, $Q > 0$}
+ \Output{$\bm s = \bm K^{-1/2} b$}
+ $\_, \bm\alpha, \bm\beta \gets \mathrm{CG}(\bm K, \bm b, \bm P, J)$\;
+ $M_{\mathrm{Lanczos}} \gets \mathrm{TriDiag}(\bm\alpha, \bm\beta)$\;
+ $\lambda_M \gets \lambda(M_{\mathrm{Lanczos}})$\;
+ $\lambda_{\min} \gets \min{\lambda_M}$\;
+ $\lambda_{\max} \gets \max{\lambda_M}$\;
+ $w_1, \ldots, w_Q, t_1, \ldots, t_Q \gets \mathrm{Quadrature}(\lambda_{\min}, \lambda_{\max}, Q)$\;
+ $\bm c_1, \ldots, \bm c_Q \gets \mathrm{msMINRES}(-\bm K, \bm b, t_q, \bm P, J)$ \Comment*[r]{$\left( t_q \identity - \bm K \right)^{-1} \bm b$.}
+ % $s_q \gets \left( t_q \identity + H \right)^{-1} b$ \Comment*[r]{Computed via msMINRES(K, t, J).}
+ $\bm s \gets \sum^Q_{q=1} w_q \bm c_q$\;
+ % $\mathrm{samples} \gets \sum^Q_{q=1} w_q \left( t_q \identity + H \right)^{-1} b$
\end{algorithm}
This procedure (see \cref{alg:ciq}) computes the approximate inverse square root product \(\bm K\) by \(\bm \epsilon_0\) up to a rotation, i.e.,
@@ -64,10 +64,10 @@ From here, it is then trivial to also compute the product of a matrix square roo
\def\xmin{-0.5}
\def\R{1.3}
\begin{marginfigure}[-7cm]
-\centering
-\input{figures/cauchy_integral.tex}
-\caption{Representation of integration circle \(\Gamma\) contained within the domain of \(f\) as defined according to the Cauchy integral formula.}
-\label{fig:cauchy-integral-formula}
+ \centering
+ \input{figures/cauchy_integral.tex}
+ \caption{Representation of integration circle \(\Gamma\) contained within the domain of \(f\) as defined according to the Cauchy integral formula.}
+ \label{fig:cauchy-integral-formula}
\end{marginfigure}
% ------------------------------------------
@@ -77,7 +77,7 @@ From here, it is then trivial to also compute the product of a matrix square roo
The first step therefore invokes Cauchy's integral formula.
Cauchy's integral formula is a central theorem in complex analysis which states that, for a holomorphic function \(f\)\marginnote{Note that the square root function is holomorphic for all positive definite real matrices.}, for a closed circular contour \(\Gamma\) in the complex plane (see \cref{fig:cauchy-integral-formula}) which encloses the eigenvalues of \(\bm K\), \(f(\bm K)\) can be approximated as
\begin{align}\label{eq:cauchy-integral-formula}
- f(\bm K) ={}& \frac{1}{2 \pi i} \oint_\Gamma f(\tau) \left(\tau \identity - \bm K\right)^{-1}\,d\tau.
+ f(\bm K) ={} & \frac{1}{2 \pi i} \oint_\Gamma f(\tau) \left(\tau \identity - \bm K\right)^{-1}\,d\tau.
\end{align}
Since, in our case, the eigenvalues of \(\bm K\) will all be real-valued\marginnote{If a real-valued matrix is symmetric, its eigenvalues are real. In our case, \(\bm K\) will be the precision matrix obtained from the Laplace approximation.}, a circle centred on the real axis which encloses the minimum and maximum eigenvalues of \(\bm K\) will suffice.
@@ -87,10 +87,10 @@ Since, in our case, the eigenvalues of \(\bm K\) will all be real-valued\marginn
We can then apply this to the function \(f(\bm K) = \bm K^{-1/2}\), apply a change of variable, and then approximate the integral using the quadrature rule with \(Q\) quadrature points, as per
\begin{align}\label{eq:ciq}
- \bm K^{-1/2} ={}& \frac{1}{2 \pi i} \oint_\Gamma \tau^{-1/2} \left(\tau \identity - \bm K\right)^{-1}\,d\tau \nonumber
-\\ ={}& \frac{1}{\pi i} \oint_{\Gamma_\sigma} \left( \sigma^2 \identity - \bm K \right)^{-1}\,d\sigma \nonumber
-\\ \approx{}& \frac{1}{\pi i} \sum_{q=1}^Q w_q \left( \sigma^2_q \identity - \bm K \right)^{-1} \nonumber
-\\ \bm K^{-1/2} \bm v \approx{}& \frac{1}{\pi i} \sum_{q=1}^Q w_q \underbrace{\left( \sigma^2_q \identity - \bm K \right)^{-1} \bm v}_{Q\text{ system solves}},
+ \bm K^{-1/2} ={} & \frac{1}{2 \pi i} \oint_\Gamma \tau^{-1/2} \left(\tau \identity - \bm K\right)^{-1}\,d\tau \nonumber
+ \\ ={}& \frac{1}{\pi i} \oint_{\Gamma_\sigma} \left( \sigma^2 \identity - \bm K \right)^{-1}\,d\sigma \nonumber
+ \\ \approx{}& \frac{1}{\pi i} \sum_{q=1}^Q w_q \left( \sigma^2_q \identity - \bm K \right)^{-1} \nonumber
+ \\ \bm K^{-1/2} \bm v \approx{}& \frac{1}{\pi i} \sum_{q=1}^Q w_q \underbrace{\left( \sigma^2_q \identity - \bm K \right)^{-1} \bm v}_{Q\text{ system solves}},
\end{align}
where \(\sigma\) is obtained from \(\tau\) as a change of variable and \(w_1, \ldots, w_Q\) are the \(Q\) quadrature weights.
We can then solve the \(Q\) systems of equations \(\left( \sigma^2_1 \identity - \bm K \right) = \bm v, \ldots, \left( \sigma^2_Q \identity - \bm K \right) = \bm v\) to obtain the solutions \(\bm c_q = \left(\sigma^2_q \identity - \bm K \right)^{-1} \bm v\).
@@ -108,10 +108,10 @@ Since we will be sampling a fixed number of quadrature points from the circle, t
\def\xmin{-0.5}
\def\R{1.3}
\begin{marginfigure}
-\centering
-\input{figures/cauchy_quadrature.tex}
-\caption{The shifts \(\tau_1, \ldots, \tau_Q\) are sampled from a circle with its centre on the real axis which intersects the real axis at the points \(\lambda_{\mathrm{min}}\) and \(\lambda_{\mathrm{max}}\). Since we use Jacobi elliptic functions, we over-sample points that are closer to the minimum eigenvalue \(\lambda_{\mathrm{min}}\).}
-\label{fig:ciq}
+ \centering
+ \input{figures/cauchy_quadrature.tex}
+ \caption{The shifts \(\tau_1, \ldots, \tau_Q\) are sampled from a circle with its centre on the real axis which intersects the real axis at the points \(\lambda_{\mathrm{min}}\) and \(\lambda_{\mathrm{max}}\). Since we use Jacobi elliptic functions, we over-sample points that are closer to the minimum eigenvalue \(\lambda_{\mathrm{min}}\).}
+ \label{fig:ciq}
\end{marginfigure}
% ------------------------------------------
@@ -120,7 +120,7 @@ Since we will be sampling a fixed number of quadrature points from the circle, t
We could sample these quadrature points uniformly, but...
Instead, we use Jacobi elliptic functions (\cref{sec:jacobi-elliptic})
-With these functions, we can compute the weights for Gaussian quadrature as
+With these functions, we can compute the weights for Gaussian quadrature as
\begin{align}
w_q = - \frac{2 \sqrt{\lambda_\mathrm{min}}}{\pi Q} \mathcal{K}^\prime (k) \cn(i u_q \mathcal{K}^\prime (k) \given k) \dn (i u_q \mathcal{K}^\prime (k) \given k)
\end{align}
@@ -132,26 +132,26 @@ and shifts as
\cref{alg:quad} describes .
\begin{marginfigure}
-\begin{algorithm}[H]
-\caption{Quadrature}\label{alg:quad}
-\Input{$\lambda_{\min}$, $\lambda_{\max}$, $Q > 0$}
-\Output{$w_q, t_q \given q \in 1, \ldots, Q$}
-$k^2 \gets \lambda_{\min} / \lambda_{\max}$\;
-${k^{\prime}}^2 \gets \sqrt{1 - k^2}$\;
-$K^\prime \gets \mathcal{K}({k^{\prime}}^2)$\;
-\For{$q \gets 1$ \KwTo $Q$}{
- $u_q \gets (q - 1/2) / Q$\;
- $\overline{\sn}_q \gets \sn(u_q K^\prime \given {k^{\prime}}^2)$\;
- $\overline{\cn}_q \gets \cn(u_q K^\prime \given {k^{\prime}}^2)$\;
- $\overline{\dn}_q \gets \dn(u_q K^\prime \given {k^{\prime}}^2)$\;
- $\sn_q \gets i ( \overline{\sn}_q / \overline{\cn}_q )$\;
- $\dn_q \gets ( \overline{\dn}_q / \overline{\cn}_q )$\;
- $\cn_q \gets ( 1 / \overline{\cn}_q )$\;
- $w_q \gets \lambda_{\min}^{1/2} K^\prime \cn_q \dn_q$\;
- $w_q \gets -2 w_q / \left(\pi Q\right) $\;
- $t_q \gets \lambda_{\min} \sn_q^2$\;
-}
-\end{algorithm}
+ \begin{algorithm}[H]
+ \caption{Quadrature}\label{alg:quad}
+ \Input{$\lambda_{\min}$, $\lambda_{\max}$, $Q > 0$}
+ \Output{$w_q, t_q \given q \in 1, \ldots, Q$}
+ $k^2 \gets \lambda_{\min} / \lambda_{\max}$\;
+ ${k^{\prime}}^2 \gets \sqrt{1 - k^2}$\;
+ $K^\prime \gets \mathcal{K}({k^{\prime}}^2)$\;
+ \For{$q \gets 1$ \KwTo $Q$}{
+ $u_q \gets (q - 1/2) / Q$\;
+ $\overline{\sn}_q \gets \sn(u_q K^\prime \given {k^{\prime}}^2)$\;
+ $\overline{\cn}_q \gets \cn(u_q K^\prime \given {k^{\prime}}^2)$\;
+ $\overline{\dn}_q \gets \dn(u_q K^\prime \given {k^{\prime}}^2)$\;
+ $\sn_q \gets i ( \overline{\sn}_q / \overline{\cn}_q )$\;
+ $\dn_q \gets ( \overline{\dn}_q / \overline{\cn}_q )$\;
+ $\cn_q \gets ( 1 / \overline{\cn}_q )$\;
+ $w_q \gets \lambda_{\min}^{1/2} K^\prime \cn_q \dn_q$\;
+ $w_q \gets -2 w_q / \left(\pi Q\right) $\;
+ $t_q \gets \lambda_{\min} \sn_q^2$\;
+ }
+ \end{algorithm}
\end{marginfigure}
% \begin{algorithm}
@@ -181,20 +181,20 @@ One drawback of contour integral quadrature if that the accuracy its of approxim
In the case of the Laplace approximation, as per \cref{eq:ggn-laplace}, we have that the precision matrix is given by
\begin{align}\label{eq:ggn-laplace}
\bm \Lambda = \sum_i^N \bm J_i\T \bm H \bm J_i + \alpha \identity,
-\\ \bm \theta \sim \normal(\bm \mu, \bm \Lambda^{-1})
+ \\ \bm \theta \sim \normal(\bm \mu, \bm \Lambda^{-1})
\end{align}
where \(N\) is the number of observations in your dataset.
Since each \(J_i\T H J_i\) is, for \(i \in 1 \ldots N\), a low-rank\sidenote{With rank \(o\), where \(o\) is the number of neural network outputs.} positive semi-definite matrix, it has \(o\) non-zero eigenvalues.
Let us define \(\lambda_1, \ldots, \lambda_o\) as the eigenvalues of a matrix sorted in decreasing order.
-We can then
+We can then
Assume that the non-zero spectrum of \(J_i\T H J_i\) is relatively flat, i.e., \(\lambda_1 \not\gg \lambda_o\).
-In a hand-wavy way, we have that the ``more similar'' the eigenvectors (and assuming that the eigenvectors have the same ordering between the two matrices)
+In a hand-wavy way, we have that the ``more similar'' the eigenvectors (and assuming that the eigenvectors have the same ordering between the two matrices)
For preconditioning, we need to find a preconditioner matrix \(P\) and its inverse \(P^{-1}\) such that
\begin{align}
- P^{-1} A \approx{}& \identity \Rightarrow P \approx A
-\\ P^{-1} \Sigma^{-1} ={}& P^{-1} \left( \textstyle{\sum^N_i} J_i\T H J_i + \alpha \identity \right)
+ P^{-1} A \approx{} & \identity \Rightarrow P \approx A
+ \\ P^{-1} \Sigma^{-1} ={}& P^{-1} \left( \textstyle{\sum^N_i} J_i\T H J_i + \alpha \identity \right)
\end{align}
where \(\Sigma^{-1}\) is our precision matrix, approximated by a GGN Hessian.
@@ -204,7 +204,7 @@ The eigenvalues of our GGN approximation are given by
\end{align}
where \(\{s_1, \ldots, s_p\}, p \leq N \cdot k\) are the nonzero eigenvalues of the rank-\(p\) matrix \(\sum^N_i J_i\T H J_i\).
-Notice that if a preconditioner approximates all eigenvalues and eigenvectors of a
+Notice that if a preconditioner approximates all eigenvalues and eigenvectors of a
Something something spectrum, shape of spectrum, how steep is it?
The more values you add, the steeper the spectrum becomes (even the nonzero one)
@@ -217,7 +217,7 @@ The more values you add, the steeper the spectrum becomes (even the nonzero one)
\item Speed
\end{enumerate}
-Typically, when preconditioning, you need a matrix which is similar to the
+Typically, when preconditioning, you need a matrix which is similar to the
In this way, the preconditioner acts as an ``initial best guess'' of the value to be computed.
As such, for CIQ, it would be expected that the preconditioner should approximate the value of \(H^{-1/2}\).
In reality, we only need an approximation of \(H^{-1}\) wait is this really true? we still need \(H^{1/2} b\), we just calculate this value itself using CIQ?
@@ -231,12 +231,12 @@ Let us consider the toy example of a preconditioner which we can guarantee to ha
One example of such a preconditioner would be???
Depending on the rank of the preconditioner, we can then eliminate a number of the largest / lowest eigenvalues of \(H\) equal to the rank of the preconditioner.
If we have a rank-one preconditioner whose only eigenvector is the largest eigenvector of \(H\), the second largest eigenvalue becomes the largest.
-In the best-case scenario, you can then eliminate
+In the best-case scenario, you can then eliminate
If \(H\) has a very flat spectrum, then the problem cannot be ill conditioned and thus preconditioning is immaterial.
-If \(H\) has a very
+If \(H\) has a very
% This analogy can be extended in a hand-wavy way to an imperfect preconditioner which doesn't exactly approximate the eigenvalue
-Finally, performance of computing
+Finally, performance of computing
In CIQ, we will, in each iteration, perform one matrix-vector product \(H v\) and one preconditioner-vector product\sidenote{Because of this, to avoid the preconditioner becoming a performance bottleneck, the speed of the preconditioner-vector products should ideally be significantly greater than that of the matrix-vector products.} \textbf{check this}, as seen in \cref{alg:ciq}.
As such, if the preconditioner-vector product is similarly or more expensive to compute compared to the matrix-vector product, then preconditoineing will ....
However, an effective preconditioner will significantly improve the convergence speed of CIQ, and this effect can often outweigh the cost of computing the preconditioner.
@@ -244,9 +244,9 @@ However, an effective preconditioner will significantly improve the convergence
\subsection{Adam-esque fully linear GGN}\label{ssec:adam-preconditioner}
If we calculate the GGN approximation of the Hessian by linearizing over the whole model and loss (as described in \cref{ssec:practical-ggn}), we get
\begin{align}
- P ={}& \nabla \nabla\T + \alpha \identity
-\\ P^{-1} ={}& \beta \cdot \nabla \nabla\T + \alpha^{-1} \identity
-\\ \beta ={}& \left(\alpha \norm{\nabla}^2 + \norm{\nabla}^4\right)^{-1} - \left(\alpha \norm{\nabla}^2\right)^{-1}.
+ P ={} & \nabla \nabla\T + \alpha \identity
+ \\ P^{-1} ={}& \beta \cdot \nabla \nabla\T + \alpha^{-1} \identity
+ \\ \beta ={}& \left(\alpha \norm{\nabla}^2 + \norm{\nabla}^4\right)^{-1} - \left(\alpha \norm{\nabla}^2\right)^{-1}.
\end{align}
DO I NEED TO PROVE THIS?
The problem with using this approximation is that the rank of \(P\) is 1.
@@ -259,11 +259,11 @@ As such, this preconditioner is not worth pursuing.
\subsection{Sub-sampling the data}
We could simply choose to calculate the Hessian over fewer points and invert it using the conjugate gradient method to find our preconditioner.
-This would have the advantage of
+This would have the advantage of
\begin{align}
- \lambda\left( J\T J + \alpha I \right) ={}& \{ \underbrace{s_1, s_2, \ldots, s_k}_{k}, \underbrace{\alpha, \ldots, \alpha}_{n - k} \}
-\\ \lambda\left( N J\T J + \alpha I \right) ={}& \{ \underbrace{N s_1, N s_2, \ldots, N s_k}_{k}, \underbrace{\alpha, \ldots, \alpha}_{n - k} \}
-\\ \lambda\left( \frac{N}{B} \textstyle{\sum^B_i} J_i\T J_i + \alpha I \right) ={}& \{ \underbrace{?, \ldots, ?}_{\leq B \cdot k}, \underbrace{\alpha, \ldots, \alpha}_{\geq n - B \cdot k} \}
+ \lambda\left( J\T J + \alpha I \right) ={} & \{ \underbrace{s_1, s_2, \ldots, s_k}_{k}, \underbrace{\alpha, \ldots, \alpha}_{n - k} \}
+ \\ \lambda\left( N J\T J + \alpha I \right) ={}& \{ \underbrace{N s_1, N s_2, \ldots, N s_k}_{k}, \underbrace{\alpha, \ldots, \alpha}_{n - k} \}
+ \\ \lambda\left( \frac{N}{B} \textstyle{\sum^B_i} J_i\T J_i + \alpha I \right) ={}& \{ \underbrace{?, \ldots, ?}_{\leq B \cdot k}, \underbrace{\alpha, \ldots, \alpha}_{\geq n - B \cdot k} \}
% \Span_\lambda\left( J\T J + \alpha \identity \right)
\end{align}
@@ -291,20 +291,20 @@ Since \(N \gg B\), then the cost of computing the preconditioner will be negligi
\cite{harbrecht2012low,bach2013sharp,gardner2018gpytorch}
\begin{align}
- \Sigma^{-1} ={}& \sum_i^N J_i\T J_i + \alpha \identity
-\\ \approx{}& L\T L + \alpha \identity
+ \Sigma^{-1} ={} & \sum_i^N J_i\T J_i + \alpha \identity
+ \\ \approx{}& L\T L + \alpha \identity
\end{align}
where \(L \in \reals^{k \times n}\), with \(k\) being the chosen rank of the pivoted Cholesky factorisation and \(n\) being the number of parameters.
We can then use this approximation as a preconditioner by computing its inverse via the Woodbury matrix identity (\cref{sec:woodbury}):
\begin{align}
- P ={}& L\T L + \alpha \identity
-\\ P^{-1} ={}& \alpha^{-1} \identity - \alpha^{-2} L\T \left( \identity + \alpha^{-1} L L\T \right)^{-1} L
+ P ={} & L\T L + \alpha \identity
+ \\ P^{-1} ={}& \alpha^{-1} \identity - \alpha^{-2} L\T \left( \identity + \alpha^{-1} L L\T \right)^{-1} L
\end{align}
we then obtain the preconditioner-vector and inverse-preconditioner-vector products as in Equation~\ref{eq:pivoted-cholesky-preconditioner}.
Notice that the ``scariest'' computation in the inverse preconditioner is inverting a \(k \times k \) matrix, where \(k\) is the rank of our pivoted Cholesky factorization (which we choose).
\begin{align}\label{eq:pivoted-cholesky-preconditioner}
- P v ={}& L\T ( L v ) + \alpha v
-\\ P^{-1} v ={}& \alpha^{-1} v - \alpha^{-2} L\T ( \underbrace{\identity + \alpha^{-1} L L\T}_{k \times k} )^{-1} ( L v )
+ P v ={} & L\T ( L v ) + \alpha v
+ \\ P^{-1} v ={}& \alpha^{-1} v - \alpha^{-2} L\T ( \underbrace{\identity + \alpha^{-1} L L\T}_{k \times k} )^{-1} ( L v )
\end{align}
We can precompute \(L\T ( \identity + \alpha^{-1} L L\T )^{-1} \in \reals^{n \times k}\), meaning that we only need to perform two matrix multiplications for both the preconditioner- and inverse preconditioner-vector products.
@@ -312,12 +312,12 @@ This would then require storing \(L \in \reals^{k \times n}\) and the aforementi
ADD SOMEWHERE:
As we sum over multiple low-rank matrices, we will likely find that the minimum non-zero eigenvalue gets progressively smaller relative to the largest.
-When we have a single rank \(o\) GGN matrix, we have
+When we have a single rank \(o\) GGN matrix, we have
This means that the preconditioning of \(J J\T\) (which should be low-rank) will progressively become both \emph{less} low-rank and its condition number will progressively become higher.
-In terms of eigenvalues and eigenvectors,
+In terms of eigenvalues and eigenvectors,
Assume that the pivoted Cholesky factorisation finds the \(k\) largest eigenvectors.
-If the fall-off in the eigenspectrum of this factorisation is steep enough, then the largest eigenvector \(s_1\) will be significantly larger than the smallest eigenvector \(s_k\), especially if the value of \(B\) is large enough that the
+If the fall-off in the eigenspectrum of this factorisation is steep enough, then the largest eigenvector \(s_1\) will be significantly larger than the smallest eigenvector \(s_k\), especially if the value of \(B\) is large enough that the
Unfortunately, if want to use the pivoted Cholesky decomposition to approximate \(\sum^B_i J_i\T J_i\), we are largely trying to approximate the higher eigenvectors of the sum.
In order for this to be the case, we will want to oversample vectors from this matrix which correspond to the largest eigenvalues.
@@ -329,7 +329,7 @@ Alternatively, it is possible to approximate the diagonal of the GGN matrix as t
In conclusion, to find the optimal parameters for the pivoted Cholesky preconditioner (the number of observations \(B\) and the rank of the pivoted Cholesky factorisation \(k\), there are some rules of thumb to keep in mind.
Notably, the quality of the preconditioner depends largely on the ease of inverting the \(\identity + \alpha^{-1} L L\T\) matrix, which depends on its conditioning number.
-In practice, increasing the number
+In practice, increasing the number
I've found that it's most important to keep \(k\) low, such that the \(k \times k\) outer product of the pivoted Cholesky factorisation matrix \(L\) approximates few enough of the largest eigenvectors that the eigenvalue of the largest is similar to that of the smallest (meaning this outer product is well-conditioned).
Overall, this means that you need a large enough \(k\) to approximate enough large eigenvectors and a small enough \(k\) to make sure the conditioning number of the outer product is low.
Furthermore, you want enough observations \(B\) to be included in the preconditioner such that it's possible to accurately approximate the eigenvectors of the problem (why not include all of them, always?).
@@ -367,8 +367,8 @@ In general, it is worth noting the flaw with scaling the term in the \(\sum J\T
Samples \(\epsilon\) which are normally distributed but do not have a mean of zero and a standard deviation of one can be normalised and their sum of square deviations be calculated by computing their Mahalanobis distances.
\begin{align}
- d ={}& \sqrt{(\epsilon - \mu)\T \Sigma^{-1} (\epsilon - \mu)}\label{eq:mahalanobis-distance}
-\\ \Rightarrow{}& d\T d \sim \chi^2(D) \nonumber
+ d ={} & \sqrt{(\epsilon - \mu)\T \Sigma^{-1} (\epsilon - \mu)}\label{eq:mahalanobis-distance}
+ \\ \Rightarrow{}& d\T d \sim \chi^2(D) \nonumber
\end{align}
This has the advantage of only requiring computation of the precision matrix \(\Sigma^{-1}\).
diff --git a/chapters/textnotes.tex b/chapters/textnotes.tex
@@ -1,54 +1,54 @@
\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
+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,
+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.}
+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
+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}
+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!}
+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]
@@ -56,54 +56,54 @@ everything more consistent, so that you have to remember less things!}
\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}.
+ 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
+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?}
+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
+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 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
+\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]
@@ -111,12 +111,12 @@ the chapter preamble, with the following code:
\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
+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]
@@ -131,11 +131,11 @@ 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
+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]
@@ -156,8 +156,8 @@ print("Hello World!")
\end{marginlisting}
\end{verbatim}
-Unfortunately, the space between the caption and the listing must be
+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.
+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/figures/cauchy_integral.tex b/figures/cauchy_integral.tex
@@ -19,12 +19,12 @@
\draw [
thick,
decoration={
- brace,
- mirror,
- raise=0.40cm
- },
+ brace,
+ mirror,
+ raise=0.40cm
+ },
decorate
- ] (0.5, 0) -- (2.5, 0)
- node [pos=0.5,anchor=north,yshift=-0.55cm] {$\lambda(\bm K)$};
+ ] (0.5, 0) -- (2.5, 0)
+ node [pos=0.5,anchor=north,yshift=-0.55cm] {$\lambda(\bm K)$};
\node at (2.8, -0.95) {$\Gamma$};
\end{tikzpicture}