% !TeX spellcheck = en_GB
%\section{Skew-T log-P diagram from Stavanger}%\hfill}
\chapter{Synoptic Weather Situation}
\section{Skew-T log-P diagram from Stavanger}%\hfill}
\label{app:sounding}
The Skew-T log-P diagram shows the observed vertical temperature and dew-point temperature at Stavanger. The data are taken from \cite{university_wyoming_atmospheric_2018} and processed in Python.
\\
\noindent
Isobars are grey lines, every \SI{50}{\hPa}, dry adiabats are blue (labelled in \SI{}{\celsius}), isotherms are red [\SI{}{\celsius}], water vapour mixing ratios are green, dashed in [\SI{}{\gram\per\kilogram}], and moist adiabats are dashed, purple lines (labelled in [\SI{}{\celsius}]).

\begin{landscape}
	\begin{figure}%\ContinuedFloat
		\centering
		% 20/12
		\begin{subfigure}[b]{0.66\textheight}
			\includegraphics[trim={0cm 0.2cm 2.5cm .5cm},clip,width=\textwidth]{./fig_Sounding/20161220_12Z}
			\caption{}\label{fig:Soun20}
		\end{subfigure}
		\quad
		% 21/12
		\begin{subfigure}[b]{0.66\textheight}
			\includegraphics[trim={0cm 0.2cm 2.5cm .5cm},clip,width=\textwidth]{./fig_Sounding/20161221_12Z}
			\caption{}\label{fig:Soun21}
		\end{subfigure}
	\end{figure}

	%%%%%%%% 2nd page
	\begin{figure}\ContinuedFloat
		\centering
		% 22/12
		\begin{subfigure}[b]{0.66\textheight}
			\includegraphics[trim={0cm 0.2cm 2.5cm .5cm},clip,
			width=\textwidth]{./fig_Sounding/20161222_12Z}
			\caption{}\label{fig:Soun22}
		\end{subfigure}
		\quad
		% 23/00
		\begin{subfigure}[b]{0.66\textheight}
			\includegraphics[trim={0cm 0.2cm 2.5cm .5cm},clip,
			width=\textwidth]{./fig_Sounding/20161223_00Z}
			\caption{}\label{fig:Soun23}
		\end{subfigure}
	\end{figure}

	%%%%%%%% 3rd page
	\begin{figure}\ContinuedFloat
		\centering
		% 25/12
		\begin{subfigure}[b]{0.66\textheight}
			\includegraphics[trim={0cm 0.2cm 2.5cm .5cm},clip,
			width=\textwidth]{./fig_Sounding/20161225_12Z}
			\caption{}\label{fig:Soun25}
		\end{subfigure}
		\quad
		% 26/12
		\begin{subfigure}[b]{0.66\textheight}
			\includegraphics[trim={0cm 0.2cm 2.5cm .5cm},clip,
			width=\textwidth]{./fig_Sounding/20161226_12Z}
			\caption{}\label{fig:Soun26}
		\end{subfigure}

		\caption{Vertical profiles of atmospheric temperature (black) and dew-point temperature (green) during \SIrange{20}{26}{\dec}. Vertical Profiles from \SI{24}{\dec} are missing at the webpage \url{http://weather.uwyo.edu/upperair/sounding.html}}\label{fig:sounding}
	\end{figure}
\end{landscape}


\documentclass[11pt,a4paper]{article}
\usepackage[xetex]{hyperref}
\usepackage{mathtools,latexsym,amsfonts,amssymb,MnSymbol}
\usepackage{xcolor}
\usepackage{xifthen}
\usepackage{fancyhdr}
\usepackage{ccicons}

\hypersetup{colorlinks=true}
\pagestyle{fancy}

\fancyhf{}
\cfoot{\thepage}
\rfoot{\ccby}
\renewcommand{\headrulewidth}{0.0pt}
\renewcommand{\footrulewidth}{0.0pt}

\newcommand{\key}[1]{\textrm{\textbf{#1}}}
\newcommand{\sig}       {\key{sig}}
\newcommand{\End}       {\key{end}}
\newcommand{\val}       {\key{val}}
\newcommand{\type}      {\key{type}}
\newcommand{\eqtype}    {\key{eqtype}}
\newcommand{\datatype}  {\key{datatype}}
\newcommand{\exception} {\key{exception}}
\newcommand{\of}        {\key{of}}
\newcommand{\inc}       {\key{include}}
\newcommand{\sharing}   {\key{sharing}}
\newcommand{\where}     {\key{where}}
\newcommand{\typerfn}   {\textit{typerfn}}
\newcommand{\Let}       {\key{let}}
\newcommand{\Structure} {\key{structure}}
\newcommand{\Struct}	{\key{struct}}
\newcommand{\In}        {\key{in}}
\newcommand{\Local}     {\key{local}}
\newcommand{\signature} {\key{signature}}
\newcommand{\functor}   {\key{functor}}

\newcommand{\B}  {\textrm{B}}
\newcommand{\sB} {\textrm{\tiny B}}
\newcommand{\E}  {\textrm{E}}
\newcommand{\sE} {\textrm{\tiny E}}
\newcommand{\T}  {\textrm{T}}
\newcommand{\sT} {\textrm{\tiny T}}
\newcommand{\TE} {\textrm{TE}}
\newcommand{\sTE}{\textrm{\tiny TE}}
\newcommand{\VE} {\textrm{VE}}
\newcommand{\sVE}{\textrm{\tiny VE}}
\newcommand{\SE} {\textrm{SE}}
\newcommand{\sSE}{\textrm{\tiny SE}}
\renewcommand{\G}{\textrm{G}}
\newcommand{\sG} {\textrm{\tiny G}}
\newcommand{\F}  {\textrm{F}}
\newcommand{\sF} {\textrm{\tiny F}}

\newcommand{\tycon}{\mathbb{C}}
\newcommand{\vcon} {\mathbf{C}}
\newcommand{\equality}{\mathcal{E}}
\newcommand{\eqyes}{\equiv}
\newcommand{\eqnot}{\nequiv}
\newcommand{\VKE}  {\textrm{EXN}}
\newcommand{\VKV}  {\textrm{VAR}}
\newcommand{\VKC}  {\textrm{CONS}}
\newcommand{\corenew}[1]{\textit{new\_#1}}

\newcommand{\vdashSigBind} {\ \vdash_{\textrm{\tiny sigbind}}\ }
\newcommand{\vdashSigexp}  {\ \vdash_{\textrm{\tiny sigexp}}\ }
\newcommand{\vdashSpec}    {\ \vdash_{\textrm{\tiny spec}}\ }
\newcommand{\vdashSpecTB}  {\ \vdash_{\textrm{\tiny specTB}}\ }
\newcommand{\vdashSpecDBA} {\ \vdash_{\textrm{\tiny specDB1}}\ }
\newcommand{\vdashSpecDBB} {\ \vdash_{\textrm{\tiny specDB2}}\ }
\newcommand{\vdashTyperfn} {\ \vdash_{\textrm{\tiny rfn}}\ }
\newcommand{\vdashShareTycon}{\ \vdash_{\textrm{\tiny share-tycon}}\ }
\newcommand{\vdashShareStr}	{\ \vdash_{\textrm{\tiny share-str}}\ }
\newcommand{\vdashStr}		{\ \vdash_{\textrm{\tiny str}}\ }
\newcommand{\vdashStrDec}	{\ \vdash_{\textrm{\tiny strdec}}\ }
\newcommand{\vdashStrBind} {\ \vdash_{\textrm{\tiny strbind}}\ }
\newcommand{\vdashFctBind} {\ \vdash_{\textrm{\tiny fctbind}}\ }
\newcommand{\vdashFctArg}  {\ \vdash_{\textrm{\tiny fctarg}}\ }
\newcommand{\vdashFctParm} {\ \vdash_{\textrm{\tiny fctparm}}\ }
\newcommand{\vdashProg}	   {\ \vdash_{\textrm{\tiny prog}}\ }
\newcommand{\vdashT}       {\ \vdash_{\textrm{\tiny T}}\ }
\newcommand{\vdashD}       {\ \vdash_{\textrm{\tiny D}}\ }
\newcommand{\braced}[1]{\{#1\}}
\newcommand{\angled}[1]{\,{\color{gray}\langle#1\rangle}\,}
\newcommand{\qualtype}[2]{#1 \triangleright #2}
\newcommand{\tyfun}[2]{\mathbf{\Lambda} #1\,.\,#2}
\newcommand{\fctor}[2]{#1 \leadsto #2}

\newcommand{\MaximizeEq}{\key{ME}}
\newcommand{\matchEnv}[3][]{ \ifthenelse{\isempty{#1}}{#2 \sqsubseteq #3}{#1 \Leftarrow #2 \sqsubseteq #3}}
\newcommand{\SUPP}[1]{\textrm{SUPP}(#1)}
\newcommand{\KEYS}[1]{keys(#1)}
\newcommand{\TYNAMES}[1]{\KEYS{#1}}
\newcommand{\GENTYPES}[2]{renewtypes_{\textrm{\tiny $#1$}}(#2)}
\newcommand{\compose}[2]{#1 \circ #2}
\newcommand{\wildcard}{{\color{gray}\scriptstyle\textbf{*}}}
\newcommand{\Empty}{\braced{}}
\newcommand{\absval}{\star}

\newcommand{\vect}[1]{\overline{#1}}

\begin{document}

\title {A pure specification of MLton - Part 3. Module}
\author{Wu Jiasen $\langle$\href{mailto:wujiasen@yahoo.com}{wujiasen@yahoo.com}$\rangle$}
\maketitle
\thispagestyle{fancy}

\section{Modeling the Module}
\[\begin{array}{lcl}
    \B & = & (\F, \G, \E) \\
    \F & = & \braced{fctid \mapsto (\fctor{\E_1^{\sT_1}}{\E_2^{\sT_2}}, \vect{coredec})} \\
    \G & = & \braced{sigid \mapsto \E^\sT} \\
\end{array}\]

\section{Signature}
\subsection {Signature in Standard ML}
{\renewcommand{\arraystretch}{1.2}\[
\begin{array}{lcl}
sigbind
    & = & \overline{sigid = sigexp}                        \\

sigexp
    & = & sigid \\
    & | & \sig\ spec\ \End  \\
    & | & sigexp\ \where\ \overline{\type\ \overline{tyvar}\ tycon = type} \\

spec
    & = & \val\ \overline{vid : type} \\
    & | & \type\ \overline{\overline{tyvar}\ tycon} \\
    & | & \eqtype\ \overline{\overline{tyvar}\ tycon} \\
    & | & \type\ \overline{\overline{tyvar}\ tycon = type} \\
    & | & \datatype\ tycon = \datatype\ longtycon \\
    & | & \datatype\ \overline{\overline{tyvar}\ tycon = \overline{vid\ \of\ type}} \\
    & | & \exception\ \overline{vid\ \of\ type} \\
    & | & \Structure\ \overline{strid:sigexp} \\
    & | & \inc\ \overline{sigid} \\
    & | & \inc\ sigexp \\
    & | & spec\ \sharing\ \type\ \overline{longtycon} \\
    & | & spec\ \sharing\ \overline{longstrid} \\
    & | & spec\ \key{;}\ spec \\
\end{array}\]}

\subsection{Elaboration of signature}
\vspace{-25pt}
\begin{flushright}
\framebox{ $ \B, sigbind \vdashSigBind \B'$ }
\end{flushright}

\[
\frac
 {\B, sigexp \vdashSigexp \E \qquad
  \T' = \TYNAMES{\E}-\TYNAMES{\B}}
 {\B, sigid = sigexp \vdashSigBind \braced{sigid \mapsto \E^{\sT'}}^\sG}
\]

\[
\frac
 { sigid \mapsto \E^{\sT} \in B }
 {\B, sigid \vdashSigexp \E}
\]

\[
\frac
 {\B, spec \vdashSpec \E}
 {\B, \sig\ spec\ \End \vdashSigexp \E}
\]

\[
\frac
 {\begin{array}{c}
  \B, sigexp \vdashSigexp \E \qquad
  \B, \E, \typerfn_i \vdashTyperfn \varphi_i
  \end{array}}
 {\B, sigexp\ \where\ \overline{\typerfn} \vdashSigexp [\sum_i \varphi_i]\E}
\]

\subsubsection{elaborating specification}
\[
\cfrac
 {\B, type_i \vdashT \qualtype{p_i}{\tau_i}}
 {\B, \val\ \overline{vid:type}_{1..n} \vdashSpec \sum_i \braced{vid_i \mapsto (\absval, gen_\sB(\qualtype{p_i}{\tau_i}), \VKV)}}
\]

\[
\cfrac
 {\overline{\alpha}_i^{(k_i)} = tyvars_i \qquad
  \tycon_i \Leftarrow \corenew{tycon}}
 {\B, \type\ \overline{tyvars\ tycon} \vdashSpec \sum_i \braced{tycon_i \mapsto (k_i, \tycon_i^\eqnot)}^\sTE}
\]

\[
\cfrac
 {\overline{\alpha}_i^{(k_i)} = tyvars_i \qquad
  \tycon_i \Leftarrow \corenew{tycon}}
 {\B, \eqtype\ \overline{tyvars\ tycon} \vdashSpec \sum_i \braced{tycon_i \mapsto (k_i, \tycon_i^\eqyes)}^\sTE}
\]

\[
\cfrac
 {\B, tybind_i \vdashSpecTB \TE_i}
 {\B, \type\ \overline{tybind} \vdashSpec \sum_i \TE_i}
\]

\[
\cfrac
 {\begin{array}{c}
  (eqset,\wildcard) \Leftarrow \MaximizeEq(\overline{databind}) \qquad
  \B, eqset, databind_i \vdashSpecDBA \TE_i             \\
  \B + \sum_i \TE_i, databind_j \vdashSpecDBB \VE_j
  \end{array}}
 {\B, \datatype\ \overline{databind} \vdashSpec \sum_i \TE_i \oplus \sum_j \VE_j}
\]

\[
\cfrac
 {\B, type_i \vdashT \qualtype{p_i}{\tau_i} \qquad
  free(\qualtype{p_i}{\tau_i}) = \emptyset
  \vcon\Leftarrow\corenew{vcon}}
 {\B, \exception\ \overline{con\ \of\ type} \vdashSpec
    \sum_i \braced{con_i \mapsto (\vcon_i, \qualtype{p_i}{\tau_i\to exn}, \VKE)}^\sVE}
\]

\[
\cfrac
 {\B, sigexp_i \vdashSigexp \E_i}
 {\B, \Structure\ \overline{strid:sigexp} \vdashSpec
   \sum_i \braced{strid_i \mapsto \E_i}^\sSE }
\]

\[
\cfrac
 {\B, sigexp \vdashSigexp \E}
 {\B, \inc\ sigexp \vdashSpec \E}
\]

\[
\cfrac
 {sigid_i \mapsto \E_i^{\T_i} \in^\sG \B}
 {\B, \inc\ \overline{sigid} \vdashSpec \sum_i \E_i}
\]

\[
\cfrac
 {\B,      spec_1 \vdashSpec \E_1 \qquad
  \B+\E_1, spec_2 \vdashSpec \E_2}
 {\B, spec_1\ \key{;}\ spec_2 \vdashSpec \E_1 + \E_2}
\]

\[
\cfrac
 { \B, spec \vdashSpec \E \qquad
   \B, \E, \overline{longtycon} \vdashShareTycon \E' }
 {\B, spec\ \sharing\ \type\ \overline{longtycon} \vdashSpec \E'}
\]

\[
\cfrac
 {\B, spec \vdashSpec \E \qquad
  \B, \E, \overline{longstrid},\braced{(i,j)\,|\,i<j}\vdashShareStr E'}
 {\B, spec\ \sharing\ \overline{longstrid} \vdashSpec \E'}
\]

\subsubsection {type refinement}
\[
\cfrac
 {tycon \mapsto k, \tycon^\equality \in \E                  \qquad
  \overline{\alpha}^{(k)} = \overline{tyvar}                \qquad
  \B, type \vdashT \qualtype{p}{\tycon'^\equality\ \overline{\alpha}} \qquad
  }
 {\B, \E, \type\ \overline{tyvar}\ tycon = type \vdashTyperfn \braced{\tycon \mapsto \tycon'}}
\]
\[
\cfrac
 {tycon \mapsto k, \tycon^\equality \in \E                  \qquad
  \overline{\alpha}^{(k)} = tyvars                          \qquad
  \B, type \vdashT \qualtype{p}{\tau}                       \qquad
  \equality = eq(\tau)
  }
 {\B, \E, \type\ tyvars\ tycon = type \vdashTyperfn
    \braced{\tycon \mapsto \tyfun{\overline{\alpha}}{\qualtype{p}{\tau}}}}
\]

\subsubsection {elaborating type bindings}
\[
\cfrac
 {\B, type \vdashT \tycon^\equality \overline\alpha }
 {\B,\overline{\alpha}^{(k)}\ tycon = type \vdashSpecTB \braced{tycon \mapsto (k, \tycon^\equality,\emptyset}^\TE}
\]
\[
\cfrac
 {\B, type \vdashT \tau \qquad free(\tau) \subseteq \overline\alpha}
 {\B,\overline{\alpha}^{(k)}\ tycon = type \vdashSpecTB
     \braced{tycon \mapsto (k, \tyfun{\overline\alpha}{\tau},\emptyset)}^\TE}
\]
\subsubsection {elaborating datatype bindings}
\[
\cfrac
 {\overline{\alpha}^{(k)} = tyvars      \qquad
  \tycon \Leftarrow \corenew{tycon} 	\qquad
  \equality = \left\{\begin{array}{ll}
  			  \eqyes	& \textrm{if } tycon \in eqset  	\\
			  \eqnot	& \textrm{otherwise.}				\\
  			  \end{array}\right.
 }
 {\B,eqset,tyvars\ tycon = \overline{vid\ \angled{\key{of}\ type}} \vdashSpecDBA
    \braced{tycon \mapsto (k, \tycon^\equality,\overline{vid})}^\TE }
\]

\[
\cfrac
 {\begin{array}{c}
  \overline{\alpha}^{(k)} = tyvars                 \qquad
  tycon \mapsto (k,\tycon) \in^\TE \B 	           \\
  \angled{\B,type_i \vdashT \qualtype{p_i}{\tau_i} \qquad
  free(\tau_i) \subseteq \overline{\alpha}}        \\
  \delta_i = \forall{\overline\alpha}.(
    \qualtype{\angled{p_i}}{{\angled{\tau_i \to }\tycon\ \overline\alpha}}) \qquad
  \vcon_i\Leftarrow\corenew{vcon}			       \\
  \end{array} }
 {
  \B,tyvars\ tycon = \overline{vid\ \angled{\key{of}\ type}} \vdashSpecDBB
    \sum_i\braced{con_i \mapsto (\vcon_i,\delta_i,\VKC)}^\VE
 }
\]

\subsubsection {type sharing}
\[
\cfrac
 {\begin{array}{c}
  longtycon_i \mapsto (k_i, \tycon_i^{\equality_i}) \in^\sTE \E \qquad
  k_1 = \cdots k_n                                              \\
  \forall i. \tycon_i \not\in^\sT \B \qquad
  \equality = \left\{\begin{array}{ll}
                \eqyes & \exists i. \equality_i = \eqyes \\
                \eqnot & \textrm{otherwise.}             \\
              \end{array}\right.                                \\
  \tycon = \corenew{tycon}  \qquad
  \varphi = \sum_i \braced{\tycon_i \mapsto \tycon^\equality}
  \end{array}}
 {\B, \E, \overline{longtycon} \vdashShareTycon [\varphi]\E}
\]
\subsubsection {structure sharing}
\[
\cfrac
 {}
 {\B,\E,\overline{longstrid}, \emptyset \vdashShareStr \E}
\]
\[
\cfrac
 {\begin{array}{c}
  longstrid_i \mapsto \E_a \in \E   \qquad
  longstrid_j \mapsto \E_b \in \E   \qquad
  \overline{tycon}^{(k)} = \E_a \cap \E_b \\
  \begin{array}{lllll}
  \B,&\E  ,&longstrid_i.tycon_1 = longstrid_j.tycon_1 &\vdashShareTycon &\E_1 \\
  \B,&\E_1,&longstrid_i.tycon_2 = longstrid_j.tycon_2 &\vdashShareTycon &\E_2 \\
  \multicolumn{5}{c}{\cdots}\\
  \B,&\E_k,&longstrid_i.tycon_k = longstrid_j.tycon_k &\vdashShareTycon &\E'  \\
  \end{array} \\
  \B,\E',\overline{longstrid}, pairs        \vdashShareStr \E''
  \end{array}}
 {\B,\E, \overline{longstrid}, (i,j)::pairs \vdashShareStr \E''}
\]

\section{Structure}
\subsection {Structure in Standard ML}
{\renewcommand{\arraystretch}{1.2}\[
\begin{array}{lcl}
strdec
    & = & dec	                        	\\
    & | & \Local\ strdec\ \In\ strdec\ \End	\\
    & | & strdec\ \key{;}\ strdec			\\
    & | & \Structure\ \overline{strbind}	\\

strbind
    & = & strid = str			\\
    & | & strid :  sigexp = str	\\
    & | & strid :> sigexp = str	\\

str
    & = & longstrid 				\\
    & | & \Struct\ dec\ \End 		\\
    & | & str :  sigexp				\\
    & | & str :> sigexp				\\
    & | & fctid\,(fctarg)			\\
    & | & \Let\ dec\ \In\ str\ \End \\

fctarg
	& = & dec						\\
	& | & str						\\

\end{array}\]}

\subsection{Elaboration of structure}
\vspace{-25pt}
\begin{flushright}
\framebox{ $ \B, strdec \vdashStrDec \vect{coredec}, \E, \rho$ }
\end{flushright}
\[
\cfrac
 {\B, dec \vdashD      cdecs, \E, \rho}
 {\B, dec \vdashStrDec cdecs, \E, \rho}
\]

\[
\cfrac
 {         \B             , strdec_1 \vdashStr cdecs_1, \E_1, \rho_1  \qquad
  ([\rho_1]\B) \oplus \E_1, strdec_2 \vdashStr cdecs_2, \E_2, \rho_2  }
 {\B, \Local\ strdec_1\ \In\ strdec_2\ \End \vdashStrDec cdecs_1+cdecs_2, \E_2, \compose{\rho_2}{\rho_1}}
\]

\[
\cfrac
 {         \B             , strdec_1 \vdashStr cdecs_1, \E_1, \rho_1  \qquad
  ([\rho_1]\B) \oplus \E_1, strdec_2 \vdashStr cdecs_2, \E_2, \rho_2  }
 {\B, strdec_1\ \key{;}\ strdec_2 \vdashStrDec cdecs_1 + cdecs_2, ([\rho]\E_1)+\E_2, \compose{\rho_2}{\rho_1}}
\]

\[
\cfrac
 {\B, strbind_i \vdashStrBind cdecs_i, \E_1, \rho_i}
 {\B, \Structure\ strbind \vdashStrDec \sum_i cdecs_i, \sum_i \E_i, \prod_i \rho_i}
\]

\subsubsection{elaborating structure expression}

\[
\cfrac
 {longstrid \mapsto \E \in^\sSE \B}
 {\B, longstrid \vdashStr \Empty,\E,\Empty}
\]

\[
\cfrac
 {\B dec \vdashD cdecs,\E,\rho}
 {\B, \Struct\ dec\ \End \vdashStr cdecs,\E,\rho}
\]

\[
\cfrac
 {\begin{array}{c}
  \B,sigexp \vdashSigexp \E_1  		 \qquad
  \B,str \vdashStr cdecs,\E_2,\rho	 \\
  \matchEnv[\varphi]{\E_1}{\E_2}	 \qquad
  \T = \TYNAMES{\E_1} - \TYNAMES{\E\ \of\ \B} \qquad
  \SUPP{\varphi}\subseteq\T
  \end{array}}
 {\B, str:sigexp \vdashStr \GENTYPES{[\varphi]\T}{[\varphi]\E_1}}
\]

\[
\cfrac
 {\begin{array}{c}
  \B,sigexp \vdashSigexp \E_1	     \qquad
  \B,str \vdashStr cdecs,\E_2,\rho	 \\
  \matchEnv[\varphi]{\E_1}{\E_2}	 \qquad
  \T = \TYNAMES{\E_1} - \TYNAMES{\E\ \of\ \B} \qquad
  \SUPP{\varphi}\subseteq\T
  \end{array}}
 {\B, str:>sigexp \vdashStr \GENTYPES{\T}{\E_1}}
\]

\[
\cfrac
 {\begin{array}{c}
  \B,fctarg \vdashFctArg cdecs_1, \E, \rho                              	\qquad
  fctid \mapsto (\fctor{\E_1^{\sT_1}}{\E_2^{\sT_2}}, cdecs_2) \in^\sG \B  	\\
  \matchEnv[\varphi]{\E_1}{\E}                                          	\qquad
  \SUPP{\varphi}\subseteq \T_1                                          	\\
  \end{array}}
 {\B,fctid\,(fctarg) \vdashStr cdecs_1 + cdecs_2, [\varphi](\GENTYPES{\T_2}{\E_2}), \rho}
\]

\[
\cfrac
 {\B, dec \vdashD cdecs_1,\E, \rho_1                    \qquad
  [\rho]\B \oplus \E, str \vdashStr cdecs_2, \E', \rho_2}
 {\B, \Let\ dec\ \In\ str\ \End \vdashStr cdecs_1+cdecs_2,\E', \compose{\rho_2}{\rho_1}}
\]

\subsubsection{elaborating structure bindings}

\[
\cfrac
 {\B, str \vdashStr cdecs, \E, \rho}
 {\B, strid = str \vdashStrBind cdecs, \braced{strid \mapsto \E}^\sSE, \rho}
\]

\[
\cfrac
 {\begin{array}{c}
  \B, str    \vdashStr    cdecs_1, \E_1, \rho    \qquad
  \B, sigexp \vdashSigexp \E_2                   \\
  \T = \TYNAMES{\E_2}-\TYNAMES{\B}               \qquad
  \E'_2 = \GENTYPES{\T}{\E_2}                    \\
  \matchEnv[\varphi]{\E'_2}{\E_1}                \qquad
  \SUPP{\varphi} \subseteq ([\varphi]\T)
  \end{array}}
 {\B, strid: sigexp = str \vdashStrBind cdecs, \braced{strid \mapsto [\varphi]\E'_2}, \rho}
\]

\[
\cfrac
 {\begin{array}{c}
  \B, str    \vdashStr    cdecs_1, \E_1, \rho    \qquad
  \B, sigexp \vdashSigexp \E_2                   \\
  \T = \TYNAMES{\E_2}-\TYNAMES{\B}               \qquad
  \E'_2 = \GENTYPES{\T}{\E_2}                    \\
  \matchEnv[\varphi]{\E'_2}{\E_1}                \qquad
  \SUPP{\varphi} \subseteq ([\varphi]\T)
  \end{array}}
 {\B, strid:>sigexp = str \vdashStrBind cdecs, \braced{strid \mapsto \E'_2}, \rho}
\]

\subsubsection{elaborating functor argument}
\[
\cfrac
 {\B, str \vdashStr cdecs,\E,\rho}
 {\B, str \vdashFctArg cdecs, \E, \rho}
\]

\[
\cfrac
 {\B, dec \vdashD   cdecs,\E,\rho}
 {\B, dec \vdashFctArg cdecs, \E, \rho}
\]

\section{Functor}
\subsection {Functor in Standard ML}
{\renewcommand{\arraystretch}{1.2}\[
\begin{array}{lcl}
fctbind
    & = & fctid\,(fctparm) \angled{fctcons} = str \\
fctcons
    & = & :  sigexp = str \\
    & | & :> sigexp = str \\
fctparm
    & = & strid: sigexp                  \\
    & | & spec                           \\
\end{array}
\]}

\subsection{Elaboration of functor}
\vspace{-25pt}
\begin{flushright}
\framebox{ $ \B, fctbind \vdashFctBind \B', \rho$ }
\end{flushright}

\[
\cfrac
 {\begin{array}{c}
  \B,fctparm \vdashFctParm \E_1^{\sT_1}                               \qquad
  \B \oplus \E_1, str \angled{fctcons} \vdashStr cdecs, \E_2, \rho    \\
  \T_2 = \TYNAMES{\E_2}-\T_1-\TYNAMES{\B}
  \end{array}}
 {\B, fctid\,(fctparm) \angled{fctcons} = str \vdashFctBind
	\braced{fctid \mapsto (\fctor{\E_1^{\sT_1}}{\E_2^{\sT_2}}, cdecs)}^\sF, \rho}
\]

\subsubsection{elaborating functor parameter}

\[
\cfrac
 {\B, sigexp \vdashSigexp \E_1      \qquad
  \T = \TYNAMES{\E_1}-\TYNAMES{\B}  \qquad
  \E_2 = \GENTYPES{\T}{\E_1}}
 {\B, strid: sigexp \vdashFctParm \E_2^{\sT}}
\]

\[
\cfrac
 {\B, spec \vdashSpec \E_1          \qquad
  \T = \TYNAMES{\E_1}-\TYNAMES{\B}  \qquad
  \E_2 = \GENTYPES{\T}{\E_1}}
 {\B, spec \vdashFctParm \E_2^{\sT}}
\]

\section{Program}
\subsection {Program in Standard ML}
{\renewcommand{\arraystretch}{1.2}\[
\begin{array}{lcl}
prog
    & = & strdec                            \\
    & | & \signature\ \overline{sigbind}    \\
    & | & \functor\   \overline{fctbind}	\\
    & | & prog\ \key{;}\ prog				\\
\end{array}
\]}

\subsection{Elaboration of program}
\vspace{-25pt}
\begin{flushright}
\framebox{ $ \B, prog \vdashProg \vect{coredec},\B', \rho$ }
\end{flushright}

\[
\frac
 {\B, strdec \vdashStrDec cdecs,\E,\rho}
 {\B, strdec \vdashProg cdecs,\E,\rho}
\]

\[
\frac
 {\begin{array}{c}
  \B, sigbind_1 \vdashSigBind \B_1 \\
  \B \oplus \B_1, sigbind_2 \vdashSigBind \B_2 \\
  \cdots \\
  \B \oplus \B_1 \cdots \oplus \B_{n-1}, sigbind_n \vdashSigBind \B_n \\
  \end{array}}
 {\B, \signature\ sigbind_{1..n} \vdashProg \Empty,\sum_i \B_i, \Empty}
\]

\[
\frac
 {\begin{array}{lll}
  \B      , fctbind_1 \vdashFctBind \B_1,\rho_1  & \B'_1 = ([\rho_1]\B)    + \B_1 & \B''_1 =                  \B_1\\
  \B'_1    , fctbind_2 \vdashFctBind \B_2,\rho_2 & \B'_2 = ([\rho_2]\B'_1) + \B_2 & \B''_2 = ([\rho_2]\B''_1)+\B_2\\
  \multicolumn{3}{c}{\cdots} \\
  \B'_{n-1}, fctbind_n \vdashFctBind \B_n,\rho_n & \wildcard & \B''_n= ([\rho_n]\B''_{n-1}) + \B_{n} \\
  \end{array}}
 {\B, functor\ \overline{fctbind} \vdashProg \Empty,\B''_n, \prod_i\rho_i}
\]

\[
\cfrac
 {\B               , prog_1 \vdashProg cdecs_1,\B_1,\rho_1 \qquad
  [\rho_1]\B + \B_1, prog_2 \vdashProg cdecs_2,\B_2,\rho_2 }
 {\B, prog_1\ \key{;}\ prog_2 \vdashProg cdecs_1+cdecs_2,[\rho_2]\B_1 + \B_2, \compose{\rho_2}{\rho_1}}
\]

\section{Realisation}
\vspace{-25pt}
\begin{flushright}
\framebox{ $ \matchEnv[\varphi]{\E_1}{\E_2} $ }
\end{flushright}

\newcommand{\instEop} {:<}
\newcommand{\instE}  [3][]{\ifthenelse{\isempty{#1}}{#2 \instEop #3}{#2 \instEop #3 = #1}}
\newcommand{\enrichE}[2]{#1 \prec #2}
\[
\cfrac
 {\instE[\varphi]{\E_1}{\E_2} \qquad \enrichE{[\varphi]\E_1}{\E_2} }
 {\matchEnv[\varphi]{\E_1}{\E_2}}
\]
\subsection{instantiation}
\[
\cfrac
 {\instE[\varphi_1]{\TE_1}{\TE_2} \qquad \instE[\varphi_2]{\TE_2}{\SE_2}}
 {\instE[\varphi_1 + \varphi_2]{(\TE_1,\SE_1,\VE_1)}{(\TE_2,\SE_2,\VE_2)}}
\]
\[
\cfrac
 {\begin{array}{c}
  tycon_i \mapsto (k_{i_1}, tyfun_{i_1}) \in \TE_1 \qquad tycon_i \mapsto (k_{i_2}, tyfun_{i_2}) \in \TE_2 \\
  k_{i_1} = k_{i_2} \qquad eq(tyfun_{i_1}) = eq(tyfun_{i_2}) \qquad \instE[\varphi_i]{tyfun_{i_1}}{tyfun_{i_2}} \\
  \end{array}}
 {\instE[\sum_i\varphi_i]{\TE_1}{\TE_2}}
\]

\[
\cfrac
 {\begin{array}{c}
  strid_i \mapsto \E_{i_1} \in \SE_1 \qquad strid_i \mapsto \E_{i_2} \in \SE_2 \\
  \instE[\varphi_i]{\E_{i_1}}{\E_{i_2}}
  \end{array}}
 {\instE[\sum_i\varphi_i]{\SE_1}{\SE_2}}
\]

\[
\begin{array}{lclcl}
{\tycon}    & \instEop & {tyfun}     & = & \braced{\tycon \mapsto tyfun} \\
{\wildcard} & \instEop & {\wildcard} & = & \Empty \\
\end{array}
\]

\subsection{enrichment}
\[
\cfrac
 {\enrichE{\TE_1}{\TE_2} \qquad \enrichE{\SE_1}{\SE_2} \qquad \enrichE{\VE_1}{\VE_2}}
 {\enrichE{(\TE_1,\SE_1,\VE_1)}{(\TE_2,\SE_2,\VE_2)}}
\]

\[
\cfrac
 {\begin{array}{cl}
  \multicolumn{2}{c}{\TYNAMES{\TE_1}\subseteq\TYNAMES{\TE_2}}   \\
  \forall\ tycon \in \TYNAMES{\TE_1}.
    & tycon \mapsto tystr_1 \in \TE_1    \\
    & tycon \mapsto tystr_2 \in \TE_2    \\
    & \enrichE{tystr_1}{tystr_2}
  \end{array}}
 {\enrichE{\TE_1}{\TE_2}}
\]

\[
\cfrac
 {cons_1 = \emptyset \vee cons_1 = cons_2}
 {\enrichE{(k, tyfun, cons_1)}{(k, tyfun, cons_2)}}
\]

\[
\cfrac
 {\begin{array}{cl}
  \multicolumn{2}{c}{\KEYS{\SE_1} \subseteq \KEYS{\SE_2}}   \\
  \forall\ strid \in \KEYS{\SE_1}.
    & strid \mapsto \E_1 \in \SE_1 \\
    & strid \mapsto \E_2 \in \SE_2 \\
    & \enrichE{\E_1}{\E_2}
  \end{array}}
 {\enrichE{\SE_1}{\SE_2}}
\]

\[
\cfrac
 {\begin{array}{cl}
  \multicolumn{2}{c}{\KEYS{\VE_1} \subseteq \KEYS{\VE_2}}   \\
  \forall\ vid \in \KEYS{\VE_1}.
    & vid \mapsto val_1 \in \VE_1 \\
    & vid \mapsto val_2 \in \VE_2 \\
    & \enrichE{val_1}{val_2}
  \end{array}}
 {\enrichE{\VE_1}{\VE_2}}
\]

\[
\cfrac
 {kind_1 = \VKV \vee kind_1 = kind_2}
 {\enrichE{(\absval,\delta,kind_1)}{(\wildcard, \delta, kind_2)}}
\]

\end{document}


\documentclass[a4paper,11pt]{article}

\usepackage{physics}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{amsthm, mathtools, bm}
%\usepackage{hyperref}
\usepackage{color}
\usepackage{verbatim}
\usepackage{jheppub}
\usepackage[T1]{fontenc} % if needed

\newcommand{\be}{\begin{equation}}
\newcommand{\ee}{\end{equation}}
\newcommand{\bes}{\begin{equation*}}
\newcommand{\ees}{\end{equation*}}
\newcommand{\bea}{\begin{flalign*}}
\newcommand{\eea}{\end{flalign*}}

%\linespread{1.0}
%\setlength{\parindent}{0em}
%\setlength{\parskip}{0.8em}

\title{\textbf{Multipole Expansion of Gravitational Waves}}
\author{Aditya Vijaykumar}
\affiliation{International Centre for Theoretical Sciences, Bengaluru, India.}
\emailAdd{aditya.vijaykumar@icts.res.in}
\abstract{Term Paper for the Electromagnetism Course, January-April 2019}

\begin{document}
\maketitle

\section{Introduction}
We hope to understand how the gravitational radiation field can be expanded in terms of multipole moments. This is important especially because the multipole moments can be written in terms of the parameters of the source producing these waves. The references for the document are :-
\begin{itemize}
	\item Thorne, Kip S. 1980. "Multipole expansions of gravitational radiation" - The classic reference, and the first that did the job of establishing a uniform notation for the subject. The structure of this document roughly follows the first four sections of this paper.
	\item Misner, Charles W., Kip S. Thorne, John Archibald Wheeler, and David Kaiser. 2017. Gravitation. - The article above constantly refers to this book.
	\item Padmanabhan, T. 2012. \textit{Gravitation: foundations and frontiers}. Cambridge: Cambridge University Press. - So far, my favourite text book on the subject
	\item Poisson, Eric, and Clifford M. Will. 2014. \textit{Gravity: Newtonian, post-Newtonian, relativistic}. Cambridge: Cambridge University Press. - An expansive reference, which I had planned to follow  as the primary reference earlier for its treatment of post-Newtonian theory, but had to abandon the idea mainly to the expanse itself.
\end{itemize}

\section{Gravitational Waves}
\textit{Main Reference : Gravitation - Foundations and Frontiers by Thanu Padmanabhan}

\subsection{Facts about the Field Equations}
The field equations are given by,
\begin{equation*}
G_{ab}  = R_{ab} - \dfrac{1}{2} g_{ab} R = 8 \pi T_{ab}
\end{equation*}
where,
\begin{align*}
R_{ijkl} = \dfrac{1}{2} (\partial_k \partial_l g_{im}  + \partial_i \partial_m g_{kl} - \partial_k \partial_m g_{il} &- \partial_i \partial_l g_{km}) + g_{np} (\Gamma^n_{kl} \Gamma^p_{im} - \Gamma^p_{il} \Gamma^n_{km}) \\
R_{ab} &= R_{iajb} g^{ij} \\
R &= R_{ab} g^{ab}
\end{align*}
The equations are symmetric under the exchange of indices, and hence there are really \textbf{ten} equations from the face of it. But we also note that the Bianchi identity tells us that $ \nabla_a G^a_{b} = 0 $, giving us \textbf{four} constraint equations. So really, we have \textbf{six} independent functions of spacetime coordinates to solve for. This suggests naively that though we have ten independent components in $ g_{ab} $ only six of them play a part in dynamics, and the other four are just fixed by the evolution of these six components. Let's now observe a few other things :-

\begin{itemize}
	\item Second derivatives of time are contained only in $ R_{0 \alpha 0 \beta} $, where $ \alpha, \beta $ run only over the space coordinates. \textit{The only terms which have double time derivatives}, hence, are $ \ddot{g}_{\alpha \beta} $.
	\item $ \nabla_a G^a_{b} = 0 \implies \nabla_0 G^0_{b} =-  \nabla_\alpha G^\alpha_{b}  $. The RHS has terms with double time derivatives, which means that $ G^0_{b} $ should have \textit{only one time derivative}.
	\item Further, the space-time and the time-time components have first time derivatives which are propotional to $ \dot{g}_{\alpha \beta} $. The time derivatives of the type $ \dot{g}_{0 a} $ \textit{do not appear in Einstein's equations}.
\end{itemize}
This now gives us an alternate way to understand the evolution equations. To evolve the equations, we need to provide the initial values of $ g_{\alpha \beta} $ and $ \dot{g}_{\alpha \beta} $ on a time slice. The space-time and the time-time Einstein's equations fix the value of the other four components.

\subsection{Weak field limit of gravity}
Consider $ g_{ab} = \eta_{ab} + \epsilon h_{ab} $, with $  \eta = \text{diag} (-1,1,1,1) $, and $ \epsilon $ being a small number. We now write down the field equations with terms only up to $ \order{\epsilon} $. After the dust settles, we get,
\begin{equation*}
\partial_n \partial_m h + \Box h_{mn} - \partial_n \partial_r h^r_m - \partial_m \partial_r h^r_n - \eta_{mn} \qty(\Box h - \partial_r \partial_s h^{sr}) = - 16 \pi \kappa T_{mn}
\end{equation*}
We effect a change of variables as $ \bar{h}_{mn} = h_{mn} - \dfrac{\eta_{mn}}{2} h $. The equation now becomes,
\begin{equation*}
\Box \bar{h}_{mn} + \eta_{mn} \partial_r \partial_s \bar{h}^{rs} - \partial_n \partial_r \bar{h}^r_m - \partial_m \partial_r \bar{h}^r_n = - 16 \pi \kappa T_{mn}
\end{equation*}
Noticing that the above equation is invariant under gauge transformations of the form \begin{equation*}
\bar{h}'^{mr} = \bar{h}^{mr} - \partial^m \xi^r - \partial^r \xi^m + \eta^{mr} \partial_s \xi^s
\end{equation*}
and imposing the harmonic gauge constraint $\partial_r \bar{h}'^{mr} =0 $, we get,
\begin{equation*}
\Box \bar{h}^{mn} = - 16 \pi \kappa T_{mn}
\end{equation*}
This shows us that some sort of gravitational waves exist, with or without a source. We note that this gauge condition can always be satisfied if we choose $ \xi^r $ such that $ \Box \xi^m =  \partial_r \bar{h}^{mr}$. This also shows us that there is a freedom is choosing $ \xi^r $, and we can add to it any vector $ \tilde{\xi}^r $ such that $ \Box \tilde{\xi}^r = 0 $.
\subsection{Gravitational waves in a flat background}
\begin{comment}
By symmetry considerations of the Riemann tensor and upto first order in perturbation, we can write,
\begin{equation*}
\Box R_{bcmn } = 8 \pi [\partial_b(\partial_m \bar{T}_{nc} - \partial_n \bar{T}_{mc} ) - \partial_c(\partial_m \bar{T}_{nb} - \partial_n \bar{T}_{mb} )] = 8 \pi \bar{T}_{bcmn}
\end{equation*}
where $ \bar{T}_{ij} = T_{ij} -\dfrac{g_{ij} T}{2} $. The equation in invariant under infinitesimal coordinate transformations. Let's first consider the vacuum case $ \Box R_{bcmn } =0 \implies R_{abmn} = C_{abmn} e^{i k_a x^a}, k^a k_a = 0$. The Bianchi identity gives,
\begin{equation*}
C_{bcmn} k_a + C_{camn}k_b + C_{abmn}k_c =0
\end{equation*}
We now choose the wave-vector to be oriented along the $ z $-axis \textit{ie} $ k_a = (-\omega, 0 , 0 , \omega) $. Setting index $ c=0 $, we get
\begin{align*}
C_{abmn} = \dfrac{1}{\omega}(C_{b0mn} k_a + C_{0amn}k_b ) &= \dfrac{1}{\omega}(C_{b0mn} k_a - C_{a0mn}k_b ) \\
n \rightarrow 0 \implies C_{a0bm} &= \dfrac{1}{\omega}(C_{b0m0} k_a - C_{a0m0}k_b )
\end{align*}
Substituting the second equation into the first, we can figure that $ C_{abmn} $ can be specified completely in terms of the form $ C_{i0j0} $. Furthermore, substituting $a=0$ in the second equation gives,
\begin{align*}
 C_{00bm} &= \dfrac{1}{\omega}(C_{b0m0} (-\omega) - C_{00m0}k_b ) \implies C_{00m0}=0
\end{align*}
This means that $ i,j $ cannot be zero, and hence only the terms of the form $ C_{\alpha 0 \beta 0} $ survive this ordeal.
\end{comment}
In general, one can describe the solution to the wave equation without sources as follows,
\begin{equation*}
\bar{h}_{mn} = \int \dd^3{k} A_{mn}( \vb{k}) \exp(i \vb{k} \cdot \vb{x} - i \omega t)
\end{equation*}
Recall that the harmonic gauge constraint that had already been imposed still left us with a freedom of choice for $ \tilde{\xi}^r; \Box \tilde{\xi}^r =0 $. To take care of these, let us postulate the following gauge,
\begin{equation*}
h_{00} = h_{0\alpha} = 0 \qq{,} h = h^\alpha_\alpha = 0 \qq{,} \partial_\alpha h^{\alpha \beta} = 0
\end{equation*}
This gauge is called the transverse traceless (TT) gauge. To see that this is an allowed gauge, we write the general solution for $ \xi^r $,
\begin{equation*}
\xi^r = \int \dd^3{k} C^a(\vb{k}) \exp(i \vb{k} \cdot \vb{x} - i \omega t)
\end{equation*}
Under the harmonic gauge condition,
\begin{equation*}
A_{mn} \rightarrow A'_{mn} = A_{mn} - ik_m C_n - i k_m C_n + i \eta_{mn} k^d C_d
\end{equation*}
\textcolor{red}{Add remaining steps of calculation}
Note that the TT gauge can be used only in the absence of sources, while the harmonic gauge is valid for general $ T_{mn} $.

So how many degrees of freedom does our $ h_{mn} $ have left? Initially, we had 10 degrees of freedom. The harmonic gauge constraint $ \partial_r \bar{h}^{mr} = 0 $ allows us to eliminate 4 degrees of freedom. For solutions of the source-less wave equation, we can further use the above condition to eliminate four more degrees of freedom! This leaves us with just two degrees of freedom. For a gravitational wave propagating along the $ z $-axis, we can write the TT components as follows,
\begin{equation*}
h_{xx}^{TT} = - h_{yy}^{TT} = h_+ (t-z) \qq{and} h_{xy}^{TT} = h_{yx}^{TT} = h_{\cross} (t-z)
\end{equation*}
It can be shown that the TT gauge permits us to write the stress-energy tensor as follows,
\begin{equation*}
t_{mn} = \dfrac{1}{32 \pi} \ev{\partial_m h^{TT}_{ij} \partial_n h^{ij}_{TT}}
\end{equation*}
where the average is over all wavelengths. \textcolor{red}{add derivation from notes}
We can thus write down expressions for the energy and momentum of the gravitational wave! $ t_{00} $ gives the energy flux, $ t^{0\alpha} $ gives the linear momentum flux,
\begin{align*}
\implies \dfrac{\dd{E}}{\dd{\Omega} \dd{t}} &=  \dfrac{r^2}{32 \pi} \ev{ \dot{h}^{TT}_{ij} \dot{h}^{ij}_{TT}} \\
 \dfrac{\dd{p^k}}{\dd{\Omega} \dd{t}} &= \dfrac{1}{32 \pi} \ev{\dot{h}^{TT}_{ij} \partial^k h^{ij}_{TT}}
\end{align*}

\section{Spherical Harmonics}
Let us first fix notations for the rest of the document. If $ n_a $ is a radial unit vector, then
\begin{equation*}
N_{A_l}  = n_{a_1} n_{a_2} n_{a_3} \ldots n_{a_l}
\end{equation*}
We also use the shorthand notation,
\begin{equation*}
S_{A_l} = S_{a_1 a_2 \ldots a_l}
\end{equation*}
The indices on which a tensor is symmetrized will be denoted by parentheses,
\begin{equation*}
S_{ab(cde)} = \dfrac{1}{6}(S_{abcde} + S_{abdec} + S_{abecd} + S_{abdce} + S_{abced} +  S_{abedc})
\end{equation*}
When only the free indices are being symmetrized, we denote that by $ [S_{abc}]^S $. To denote symmetric trace-free tensors, we use the superscript STF,
\begin{equation*}
[T_{abc}]^{STF}= T_{(abc)} - \dfrac{1}{5} \qty(\delta_{ab} T_{(jjc)} + \delta_{bc} T_{(ajj)} + \delta_{ac} T_{(jbj)} )
\end{equation*}
The transverse part of a tensor will be denoted by superscript $ T $,
\begin{equation*}
[T_{abc}]^T = P_{ai} P_{bj} P_{ck} T_{ijk} \qq{,} P_{jk} = \delta_{jk} - n_j n_k
\end{equation*}
and the transverse-traceless part of the tensor will be denoted superscript TT,
\begin{equation*}
[T_{ab}]^T = P_{ai} P_{bj} T_{ij} - \dfrac{1}{2} P_{ab} P_{jk } T_{kj}
\end{equation*}
We reserve script notation \textit{eg}. $ \mathcal{B} $ for tensors which are independent of $ \theta, \phi $.
\subsection{Symmetric trace-free tensors}
How does one construct a general symmetric trace-free tensor? Consider a tensor $ A_{k_1 k_2 \ldots k_l	} $. We first construct the symmetric part of the tensor,
\begin{equation*}
[A_{k_1 k_2 \ldots k_l	}]^S = \dfrac{1}{l!}\sum_{\pi} A_{(\pi_1 \pi_2) \pi_3 \ldots \pi_l}
\end{equation*}
where $ \pi $ runs over all permutations of $k_1 k_2 \ldots k_l  $. We now proceed to remove all the traces.

\subsection{Scalar spherical harmonics}
The scalar spherical harmonics are given by,
\begin{equation*}
Y^{lm} (\theta , \phi) = C^{lm} e^{i m \phi} P^{lm} (\cos \theta) \qq{,} C^{lm} = (-1)^m \qty[\dfrac{2l + 1}{4 \pi} \dfrac{(l-m)!}{(l+m)!}]^{1/2}
\end{equation*}
The value of $ C^{lm} $ is such that the orthonormality relation of $ Y^{lm} $ is satisfied, that is,
\begin{equation*}
\int Y^{lm} Y^{l'm'} \dd{\Omega} = \delta_{ll'} \delta_{mm'}
\end{equation*}
If we expand the expression for $ P^{lm} $ in the equation for $ Y^{lm} $, we get,
\begin{align*}
Y^{lm} (\theta , \phi)&= C^{lm} e^{i  m\phi}  \sum_{j=0}^{[(l-m)/2]} a^{lmj} (\sin\theta)^m (\cos \theta)^{l-m-2j} \\
&= C^{lm} (e^{i  \phi} \sin \theta)^m \sum_{j=0}^{[(l-m)/2]} a^{lmj} (\cos \theta)^{l-m-2j}  \qq{,} a^{lmj} = \dfrac{(-1)^j (2l - 2j)!}{2^l j! (l-j)! (l-m-2j)!}
\end{align*}

One notes that the symmetric trace-free tensors of rank $ l $ form an irreducible representation of the rotation group, and hence the should exist a one-to-one correspondence by the STF tensors and the spherical harmonics. One can simplify the above formula by writing it in terms of cartesian components of unit radial vector. Substituting $ n_x + i n_y = e^{i  \phi} \sin \theta $ and $ n_z = \cos \theta $, we get
\begin{equation*}
Y^{lm} (\theta, \phi) = \mathcal{Y}^{lm}_{K_l} N_{K_l}
\end{equation*}
Here, $ \mathcal{Y}^{lm}_{K_l} $ are the STF tensors, and they can be used to generate spherical harmonics following the above equation. It is also interesting to note that the  $ \mathcal{Y}^{lm}_{K_l} $'s form a basis for the $ 2l+1 $ dimensional vector space of STF-$ l $ tensors. A scalar function can be expanded in terms of spherical harmonics as follows,
\begin{equation*}
f(\theta,\phi) =  \sum_{l = 0}^{\infty} \sum_{m=-l}^{l} f^{lm} Y^{lm} (\theta, \phi) = \sum_{l = 0}^{\infty} \sum_{m=-l}^{l} f^{lm} \mathcal{Y}^{lm}_{K_l} N_{K_l}
\end{equation*}
\subsection{Vector spherical harmonics}
We formulate the vector spherical harmonics in the following basis,
\begin{equation*}
\vu{\xi}^0 = \vu{z} \qq{,} \vu{\xi}^\pm = \mp \dfrac{\vu{x} \pm i \vu{y}}{\sqrt{2}}
\end{equation*}
These basis vectors transform under an irreducible representation of order $ 1 $. The vector spherical harmonics can now be generated by coupling scalar spherical harmonics to these basis vectors, thereby generating harmonics that transform under a representation of order $ l = l', l'\pm 1 $.
\begin{equation*}
\vb{Y}^{l',lm} (\theta, \phi) = \sum_{m'=-l'}^{l'} \sum_{m''=-1}^{1} \ip{1 l' m'' m'}{lm} \vu{\xi}^{m''} Y^{l'm'}
\end{equation*}
where $ \ip{1 l' m'' m'}{lm}  $ are just the \textit{Clebsch-Gordan} coefficients. Again, the vector spherical harmonics satisfy the orthonormality relation,
\begin{equation*}
\int \vb{Y}^{l'_1,l_1m_1} \vdot \vb{Y}^{l'_2,l_2m_2} \dd{\Omega} = \delta_{l_1l_2} \delta_{l'_1l'_2} \delta_{m_1m_2}
\end{equation*}
These $ \vb{Y}^{l',lm}  $ are called the \textit{pure-orbital vector harmonics}, because they are the eigenfunctions of the angular momentum operator $ L^2 $, as we shall see further. Though the pure-orbital harmonics can be used perfectly well for describing solutions to the Laplace and wave equations, we can't use them to describe radiation because they aren't purely radial or purely transverse. For this reason, we introduce the \textit{pure-spin vector harmonics}, which are related to the $  \vb{Y}^{l',lm} $'s by the following relations,
\begin{align*}
\vb{Y}^{E,lm} &= \dfrac{1}{\sqrt{2 l + 1}} \qty[\sqrt{l+1} \vb{Y}^{l-1,lm}  + \sqrt{l} \vb{Y}^{l+1,lm} ] = \dfrac{r \grad{Y^{lm}}}{\sqrt{l(l + 1)}}\\
\vb{Y}^{B,lm} &= i \vb{Y}^{l,lm} = \dfrac{i}{\sqrt{l(l + 1)}} \vb{L} Y^{lm} =  \dfrac{ r \vb{n} \cross \grad}{\sqrt{l(l + 1)}}  Y^{lm}\\
\vb{Y}^{R,lm} &= \dfrac{1}{\sqrt{2 l + 1}} \qty[\sqrt{l} \vb{Y}^{l-1,lm}  - \sqrt{l-1} \vb{Y}^{l+1,lm} ] = \vb{n} Y^{lm}
\end{align*}
We can also see from the expressions that $ \vb{Y}^{B,lm} = \vb{n} \cross \vb{Y}^{B,lm} $$ \vb{Y}^{B,lm} $$ \vb{Y}^{E,lm} $ are purely transverse, and $ \vb{Y}^{R,lm} $ is purely radial. The constants in the above expressions are fixed by demanding that the spin harmonics be orthonormal \textit{ie.},
\begin{equation*}
\int \vb{Y}^{J,lm} \vdot \vb{Y}^{J',l'm'} \dd{\Omega} = \delta_{J J'} \delta_{l l'} \delta_{m m'}
\end{equation*}
Regge-Wheeler harmonics are related to the pure-spin harmonics as follows,
\begin{align*}
\vb{Y}^{E,lm} = \dfrac{\bm{\psi}^{lm}}{\sqrt{l(l+1)}} \qq{,}
\vb{Y}^{B,lm}= \dfrac{\bm{\Phi}^{lm}}{\sqrt{l(l+1)}} \qq{,}
\vb{Y}^{R,lm} = \vb{n} Y^{lm}
\end{align*}
Newman-Penrose also proposed the \textit{spin-weighted spherical harmonics} given by $ _s Y^{lm} $,
\begin{align*}
\vb{Y}^{E,lm} = \dfrac{1}{\sqrt{2}} \qty[_{-1}Y^{lm} \vb{m} - {}_{1}Y^{lm} \vb{m^*} ] \qq{,}
\vb{Y}^{B,lm} & =- \dfrac{i}{\sqrt{2}}\qty[_{-1}Y^{lm} \vb{m} + {}_{1}Y^{lm} \vb{m^*} ] \qq{,} \vb{Y}^{R,lm} = {}_0 Y^{lm} \vb{n}\\
\qq{Here} \vb{m} &= \dfrac{\vu{e}_{\theta} + i\vu{e}_{\phi}}{\sqrt{2}}
\end{align*}

We have seen that multiple formulations of vector spherical harmonics exist and they are all related. It is worth noting that all we did to obtain vector harmonics is to couple the scalar harmonics to basis vectors, and though the expressions might look scary and long, the key takeaway is that knowledge of scalar harmonics is enough to generate the vector harmonics. We shall see in the next subsection that general tensor spherical harmonics are also generated by a similar procedure - only the expressions and calculations involved would be longer and more tedious.

Another consequence of the vector/tensor harmonics being generated from scalar harmonics is that it becomes easy, in principle, to obtain the STF version of the harmonics. All one has to do is plug in $ Y^{lm} = \mathcal{Y}^{lm}_{K_l} N_{K_l} $ and proceed with the calculations.
\subsection{Tensor spherical harmonics}
Like we did for vector harmonics, the first job here is to construct the basis. We use the $ \vu{\xi} $'s that we formulated earlier. Using them, we can write the basis tensors as,
\begin{equation*}
\vb{t}^m =  \sum_{m'=-1'}^1 \sum_{m''=-1}^1 \ip{11m'm''}{2m} \vu{\xi}^{m'} \otimes \vu{\xi}^{m''}
\end{equation*}
Note that the above tensors have $ l=1+1 =2 $, and are also symmetric. We can also have basis tensors of $ l=1-1=0 $, which will essentially give us just one tensor $ \delta $,
\begin{equation*}
\dfrac{1}{\sqrt{3}}\bm{\delta} = - \sum_{m'=-1'}^1 \sum_{m''=-1}^1 \ip{11m'm''}{00} \vu{\xi}^{m'} \otimes \vu{\xi}^{m''}
\end{equation*}
We do not consider tensors of $ l=1 $ because they are antisymmetric. \textcolor{red}{(Expound)}

The basis tensors $ \vb{t}^m $ can be written as follows,
\begin{align*}
\vb{t}^{\pm 2} &= \dfrac{1}{2} (\vu{x} \otimes \vu{x}  - \vu{y} \otimes \vu{y} ) \pm \dfrac{i}{2} (\vu{x} \otimes \vu{y} + \vu{y} \otimes \vu{x} ) \\
\vb{t}^{\pm 1} &= \mp \dfrac{1}{2} (\vu{x} \otimes \vu{z}  + \vu{z} \otimes \vu{x} ) -\dfrac{i}{2} (\vu{z} \otimes \vu{y} + \vu{y} \otimes \vu{z} ) \\
\vb{t}^0 &= \dfrac{1}{\sqrt{6}} (- \vu{x} \otimes \vu{x}  - \vu{y} \otimes \vu{y} + 2 \vu{z} \otimes \vu{z} )\\
\dfrac{1}{\sqrt{3}}\bm{\delta}  &=\dfrac{1}{\sqrt{3}}  (\vu{x} \otimes \vu{x}  + \vu{y} \otimes \vu{y} + \vu{z} \otimes \vu{z})
\end{align*}
Using the above tensors, we can now define our harmonics as,
\begin{align*}
\vb{T}^{2l',lm} &= \sum_{m'=-l'}^{l'} \sum_{m''=-2}^2 \ip{l'2m'm''}{ lm} Y^{l'm'} \vb{t}^{m''} \qq{,} \vb{T}^{0l,lm} = - Y^{lm} \dfrac{\bm{\delta}}{\sqrt{3}}
\end{align*}
These are the \textit{pure-orbital tensor harmonics}, and again, as always, they satisfy the orthonormality relations,
\begin{equation*}
\int \vb{T}^{ab,cd}_{ij} \vb{T}^{a'b',c'd'}_{ij}  \dd{\Omega} = \delta_{a a'} \delta_{b b'} \delta_{c c'} \delta_{d d'}
\end{equation*}
Again, though the pure-orbital harmonics are perfectly good for describing solutions to the Laplace equation and the wave equation, the tensor components do not transform as the polarization tensor of a pure spin state \textcolor{red}{(expound from notes)} under local rotations about the radial direction. Zerilli introduced a consistent formulation of \textit{pure-spin tensor harmonics} denoted by $ \vb{T}^{T0,lm}, \vb{T}^{L0,lm}, \vb{T}^{E1,lm}, \vb{T}^{E2,lm} , \vb{T}^{B1,lm} , \vb{T}^{B2,lm}  $  and they are related to the pure-orbital harmonics as follows,
\begin{align*}
 \vb{T}^{0l,lm} &= - \dfrac{1}{\sqrt{3}}\vb{T}^{L0,lm} - \sqrt{\dfrac{2}{3}}\vb{T}^{T0,lm} \\
\vb{T}^{2 \text{ }l-2,lm} &= \sqrt{\dfrac{(l-1)l}{(2l-1)(2l+1)}}  \vb{T}^{L0,lm} - \sqrt{\dfrac{(l-1)l}{2(2l-1)(2l+1)}}  \vb{T}^{T0,lm} \\
&+ \sqrt{\dfrac{2(l-1)(l+1)}{(2l-1)(2l+1)}}  \vb{T}^{E1,lm} + \sqrt{\dfrac{(l+1)(l+2)}{2(2l-1)(2l+1)}}  \vb{T}^{E2,lm} \\
\vb{T}^{2 \text{ }l,lm} &= i \sqrt{\dfrac{l-1}{2l+1}} \vb{T}^{B1,lm}+  i \sqrt{\dfrac{l+2}{2l+1}} \vb{T}^{B2,lm}\\
\vb{T}^{2 \text{ }l-2,lm} &= -\sqrt{\dfrac{2l(l+1)}{3(2l-1)(2l+3)}}  \vb{T}^{L0,lm} + \sqrt{\dfrac{(l+1)l}{3(2l-1)(2l+3)}}  \vb{T}^{T0,lm} \\
&- \sqrt{\dfrac{3}{(2l-1)(2l+3)}}  \vb{T}^{E1,lm} + \sqrt{\dfrac{3(l-1)(l+2)}{(2l-1)(2l+3)}}  \vb{T}^{E2,lm}
\\
\vb{T}^{2 \text{ }l+1,lm} &= -i \sqrt{\dfrac{l+2}{2l+1}} \vb{T}^{B1,lm}+  i \sqrt{\dfrac{l-1}{2l+1}} \vb{T}^{B2,lm}
\\
\vb{T}^{2 \text{ }l+2,lm} &= \sqrt{\dfrac{(l+1)(l+2)}{(2l+1)(2l+3)}}  \vb{T}^{L0,lm} - \sqrt{\dfrac{(l+1)(l+2)}{2(2l+1)(2l+3)}}  \vb{T}^{T0,lm} \\
&- \sqrt{\dfrac{2l(l+2)}{(2l+1)(2l+3)}}  \vb{T}^{E1,lm} + \sqrt{\dfrac{(l-1)l}{2(2l+1)(2l+3)}}  \vb{T}^{E2,lm}
\end{align*}
The thus defined pure-spin spherical harmonics have the following properties -
\begin{itemize}
	\item $\vb{T}^{L0,lm}$ - purely radial
	\item $\vb{T}^{T0,lm}$ - purely transverse, and proportion to the projection operator $ P_{ij} $
	\item $ \vb{T}^{E1,lm} \qq{and} \vb{T}^{B1,lm}$ - mixed longitudinal and transverse
	\item  $ \vb{T}^{E2,lm} \qq{and} \vb{T}^{B2,lm}$ - transverse and traceless
\end{itemize}
The pure-spin tensor harmonics have been defined such that they are orthonormal, as has been the convention so far. One can now equivalently also describe the \textit{Regge-Wheeler tensor harmonics} and the \textit{Newman-Penrose tensor harmonics}. \textcolor{red}{Expound if needed}
\section{Solving Equations with Multipole Expansion}
\subsection{Solving Laplace equation}
The angular momentum operator $ L^2 $ is given by,
\begin{equation*}
\vb{L}^2 = -\dfrac{1}{\sin \theta} \pdv{\theta}\qty(\sin \theta \pdv{\theta}) - \dfrac{1}{\sin^2 \theta} \pdv[2]{\phi} = -r^2 \nabla^2 + \pdv{r}\qty(r^2 \pdv{r})
\end{equation*}
We know that,
\begin{equation*}
\vb{L^2} Y^{lm} = l (l+1) Y^{lm} \qq{,} \vb{L^2} \vb{Y}^{l',lm} = l' (l'+1) \vb{Y}^{l',lm} \qq{,}
\vb{L^2} \vb{T}^{al',lm} = l' (l'+1) \vb{T}^{al',lm}
\end{equation*}
From this, we can write the general scalar, vector and tensor solutions to the eigenvalue equations in terms of the multipoles,
\begin{align*}
F(r, \theta, \phi ) &= \sum_{l,m} [F^{lm} r^{-(l +1)} + G^{lm } r^l] Y^{l',lm}  \impliedby \qq{scalar harmonics}\\
\vb{V}(r, \theta, \phi ) &= \sum_{l',l,m} [F^{l',lm} r^{-(l' +1)} + G^{l',lm } r^{l'}] \vb{Y}^{lm}  \impliedby \qq{vector harmonics}\\
\vb{U}(r, \theta, \phi ) &=\sum_{\lambda, l',l,m} [F^{\lambda l',lm} r^{-(l' +1)} + G^{\lambda l',lm } r^{l'}] \vb{T}^{\lambda l', lm}  \impliedby \qq{tensor harmonics}
\end{align*}
\textcolor{red}{Insert expressions for STF solutions to Laplace}
\subsection{Solving wave equation}
\textcolor{red}{Insert expressions for Green Functions}
\section{Description of Spacetime around Gravitational-wave Sources}

If we look at the generation of gravitational waves from a bird's eye view, we can broadly say that there are three length scales :-
\begin{itemize}
	\item $ L  \rightarrow $ size of the source, the length of the region inside which the stress-energy $ T_{ab} $ is contained.

	\item $ 2M \rightarrow $ gravitational radius of the source, proportional to mass expressed in geometric unity $ G=c=1 $

	\item $ \lambda_c  \rightarrow $ characteristic wavelength of the emitted gravitational waves. This is defined as $ \frac{2\pi c}{\omega_c} $, where $ \omega_c $ is the characteristic frequency of the source.
\end{itemize}
With the preceding scales in mind, we can define the concept of the \textit{near zone} and the \textit{wave zone} as follows :-
\begin{itemize}
	\item Strong field region $ \rightarrow $ $ r \le 10 M $ provided that $ L < 10 M $. If $ L>10M $ the strong field region can be considered non-existent.
	\item Weak field near zone $ \rightarrow $ $ r > L $, $ r \ll 10 M $, $ r \gg \lambda_c $
	\item Local wave zone $ \rightarrow $ This is the region where the gravitational waves are weak, and the propagate on the background spacetime feeling no effects of the background curvature. We define two quantities $ r_I $ and $ r_O $ corresponding to the inner and outer radii of the local wave zone. Hence, for the local wave zone $  r_I \le r \le r_O $.
	\item Distant wave zone $ \rightarrow $  $ r\ge r_O $
\end{itemize}
\textcolor{red}{write more about how the sources can be considered to be isolated}.

\section{Multipole Expansion of the Radiation Field}
\subsection{The radiation field}
We restrict ourselves to the region where, for an isolated source of gravitational waves, we can treat the waves as a linearized metric perturbation. We introduce our coordinate system $ (t,x,y,z) $ with the source at the origin and at rest. As we have shown earlier, under these conditions, we can write the radiation field in terms of the transverse traceless part of the metric perturbation; these components describe the radiation completely. One can write,
\begin{equation*}
h^{TT}_{ij} = \dfrac{1}{r} A_{ij}(t-r,\theta, \phi	)
\end{equation*}
Of course, $ A_{ij} $ is a transverse traceless function that does varies slowly in the transverse direction. Now the time has come that we use all the knowledge that we have developing over the past few sections. We can decompose the angular dependence of  $ A_{ij} $ in terms of the tensor spherical harmonics. But since $ A_{ij} $ is already transverse and traceless, the non-transverse harmonics can be conveniently thrown away. Considering only the TT harmonics $ \vb{T}^{E2, lm} $ and $ \vb{T}^{B2,lm} $, we can write,
\begin{equation*}
h^{TT}_{ij} = \dfrac{1}{r}\qty[\sum_{l=2}^{\infty} \sum_{m=-l}^{l} {}^{(l)} I^{lm}(t-r){T}^{E2, lm}_{ij} + {}^{(l)} S^{lm}(t-r){T}^{B2, lm}_{ij}]
\end{equation*}
The $ I^{lm} $'s are called the \textit{mass multipole moments} of the field and the $ S^{lm} $'s are called the \textit{spin multipole moments} of the field. The $ (l) $ in $ {}^{(l)}I^{lm}(t-r) $ denotes the the number of times a derivative is taken with respect to $ t-r $. One now needs to write the tensor harmonics in symmetric trace-free form, and then we are done! From the multipole expansion of the radiation field, it is straightforward to find the expressions for the energy, linear momentum and angular momentum carried by gravitational waves using the formulas in Section 1.5

\subsection{Energy in the waves}

\subsection{Linear momentum in the waves}

\subsection{Angular momentum in the waves}

\end{document}


\section{Classification}

\subsection{Classification Algorithms}
To discover the best method of classification for our features, we use a set of different supervised learning algorithms. These algorithms are Decision Tree, Random Forrest, AdaBoost, Gradient boosting and MLP classifier. We use Decision Trees because this would produce a model which would be easy to interpret. However, the disadvantage of Decision Trees is the general inaccuracy and instability of small changes in data. To compensate for the disadvantages of the Decision Tree classifier, we used the Random Forrest classifier as well, which is a form of ensemble learning that combines multiple weak learning algorithms to improve predictive performance. In the case of the Random Forrest, it uses Decision Trees to construct a strong classification algorithm that reduces the tendency of single Decision Trees to overfit. Similar to Random Forrest, AdaBoost and Gradient boosting are both ensemble learning techniques as well; AdaBoost especially is known to perform well without the need to adjust many parameters. The MLP  or Multi-Layer Perceptron classifier is a class of feedforward artificial neural network that is used for training and classification using a hidden layer and can classify non-linear relationships in the data. We used the scikit-learn package for the implementation of these classification algorithms \cite{scikit-learn}.

\subsection{Performance Measures}
We require an objective measure of performance to compare the results between different features, parameters, and images. Measuring classification performance on highly imbalanced datasets is difficult; common measures, like accuracy, often fail to capture the actual performance. For instance, on highly imbalanced data, classifying everything as the most common class could result in high accuracy, although the classification is completely trivial and useless. To get a more useful impression of the results, we used the F1-score and Matthews correlation coefficient as performance metrics. The F1-score gives a measure of performance based on the balance between precision and recall. A shortcoming of F1-score is the disregard of true negatives. We compensated for this by using Matthews coefficient. Similar to the F1-score, the Matthews coefficient is a measure of quality in binary classification that is known to produce balanced quality measures regardless of vastly different class sizes.

\subsection{Data Preparation}

In the classification, we use the three sections displayed in Figure \ref{fig:sections}. These sections of the image contain the largest concentration of slums in the image. We divided the three sections into two sections for training and one section for testing. Although these regions of the image contain the highest concentrations of slums, there is still a significant class imbalance; the ratio of formal to informal surface area is often 100 to 1 or more. Classification algorithms generally do not perform well on imbalanced data as they are likely to classify everything as the most common class. Two standard approaches to balance the dataset are undersampling and oversampling. Undersampling removes occurrences of the most common class while oversampling duplicates existing data points of the minority class. We will use SMOTEBoost, which is a form of synthetic oversampling that creates new data points based on the minority class \cite{chawla2003smoteboost}. Besides imbalanced data, classification algorithms may encounter difficulties when the ranges of values within the features are not balanced. We, therefore, scale the values of the features to a range of negative one to positive one.

\subsection{Experimental Setup}

In this section, we discuss the experimental setup for feature classification experiments in the next section. The division of the test and training sets is 1 to 2; a single section is the test image while the other sections are training images. We use a single section as the test set because this allows displaying the predicted slums over the original image, which could help to identify parts of the image that are difficult to classify correctly through visual inspection. To discover the effects of the test image on performance, we will evaluate the performance of all feature sets on each section as the test image. These feature sets are: LSR, HoG, and RID combined in a single set, together with the three features in separate sets, resulting in four different feature sets. Using the features separate and in combination enables us to observe the individual performance features and infer what features are performing well for what test images.

Besides discovering the effects of the test image and features of performance, we will also evaluate the impact of scale and block size on the classification performance. In these two experiments, the only variable is the scale and block size, which allows us to conclude the impact of these parameters on the performance. In all other experiments, the scale and block size will have a constant value, which is displayed in Figure \ref{fig:params}.

As explained in the data preparation section, using a balanced dataset is essential for the performance of classification algorithms. In the experiments described above, we use the SMOTEBoost oversampling method to balance the dataset as we experienced that performed well although alternative oversampling methods were not thoroughly explored.  We perform a separate experiment to discover the effects of oversampling methods on the classification performance and compare this to the performance of the dataset without oversampling. Besides SMOTEBoost, these different oversampling methods are an unsophisticated random oversampler and ADASYN, which is a synthetic oversampling method \cite{he2008adasyn}. These dataset balancing methods are implemented in the Python package Imbalanced-learn \cite{lemaitre2017imbalanced}.

The classifiers that are used contain random components, therefore changing performance for every classification on a constant dataset. The presented performance in the experiments is the mean of five repeats of each experiment to reduce the impact of randomness. The repetition of experiments should provide a more accurate picture of the performance than a single experiment.

\begin{figure}
	\centering
	\begin{tabular}{|ll|}
		\hline
		Test Images: & Section 1, 2, and 3 \\
		Features: & HoG, LSR, RID, All three features\\
		Scales: & 50, 100 and 150 \\
		Block size: & 20\\
		Classifiers: & Decision Tree, Random Forrest, AdaBoost, Gradient boosting, MLP \\
		Performance Metrics: & F1-Score, Matthews coefficient\\
		Oversampling Method: & SMOTE\\
		\hline
	\end{tabular}
	\caption{The main parameters of the classification experiments}
	\label{fig:params}
\end{figure}


\subsection{Analysis}
For the following analysis of our graphics accelerator we are using a Terasic DE10-SoC with an Altera Cyclone 5 SE FPGA. Additionally we connected the accelerator with the VexRiscV to get realistic data, as this is how it should be used in the end.

The resources needed can be seen in \cref{tab:pmem}. For clarification, an Adaptive Logic Module consists of two lookup tables, so the final result might be higher for other hardware vendors. The four DSPs in use are not by the graphics accelerator, but by the VexRiscV itself. They are needed for the multiplication unit. As Quartus \rom{2} delivers us several frequency values for the maximal frequency, we decided to considered it to be approximately between the values of 81 - 85 MHz.

\begin{table}[H]
	\begin{center}
		\begin{tabular}{p{5cm}|c}
			\toprule
			\textbf{Type} & \textbf{Value}
			\\\midrule
			Adaptive Logic Modules & 2473                     \\
			FlipFlops              & 3703                      \\
			Block Memory           & 2,624,256 bits             \\
			DSP                    & 4                           \\
			Frequency              & \textasciitilde ~81 - 85 MHz \\
			Slack at 50 MHz        & 0.221 ns                      \\
			\bottomrule
		\end{tabular}
		\caption{Parameters of size and speed}
		\label{tab:pmem}
	\end{center}
\end{table}

For comparison purposes we also ran tests to compare the speeds of a pure software solution of drawing to a screen and our solution. In software the VexRiscV writes directly into the frame buffer. In this comparison we have to consider one major factor. The AXI bus itself has a latency of about five cycles in our test, depending of the load on the bus. The exact value may be different, as more complexity in the code may also increase the load on the bus and the memory.

For filling the complete screen at a resolution of \(320 \times 240\) with one color our fill rect function takes 131,624 cycles. If this is done in pure software it takes up to 4,283,088 cycles.
Drawing a line from the coordinate \((0|0)\) to \(320|240\) takes in hardware 1,105 cycles while in software it takes up to 180,755 cycles. Lastly the test of drawing a circle with the Bresenham Midpoint algorithm at the coordinate \(160|120\) with a radius of \(20\) takes in hardware 841 cycles and in software 38,176 cycles.

This results in a speed up of the hardware by a factor of about 32.5 for filling rectangles, 163.6 for drawing lines, and 45.4 for drawing circles. This results mainly in the software having to calculate the addresses for writing into the frame buffer. In hardware this is not technically needed, as the seperate functions calculate this on the fly.