\par
\section{Prototypes and descriptions of {\tt MT} methods}
\label{section:MT:proto}
\par
This section contains brief descriptions including prototypes
of all methods found in the {\tt MT} source directory.
\par
\subsection{Matrix-matrix multiply methods}
\label{subsection:MT:proto:mvm}
\par
There are five methods to multiply a vector times a dense matrix.
The first three methods, called {\tt InpMtx\_MT\_nonsym\_mmm*()},
are straightforward,
$y := y + \alpha A x$, where $A$ is nonsymmetric, and $\alpha$ is
real (if $A$ is real) and complex (if $A$ is complex).
The fourth method, {\tt InpMtx\_MT\_sym\_mmm()},
is used when the matrix is real symmetric or complex symmetric,
though it is not necessary that only the lower or upper
triangular entries are stored.
(If one fills the {\tt InpMtx} object with only the entries in
the lower triangle of $A$, and then permute the matrix $PAP^T$,
the entries will not generally be found in only the lower or upper
triangle. However, the code is still correct.)
The last method,
{\tt InpMtx\_MT\_herm\_mmm()}, is used when the matrix is
complex hermitian.
\par
%=======================================================================
\begin{enumerate}
%-----------------------------------------------------------------------
\item
\begin{verbatim}
void InpMtx_MT_nonsym_mmm ( InpMtx *A, DenseMtx *Y, double alpha[], DenseMtx *X,
                            int nthread, int msglvl, int msgFile ) ;
void InpMtx_MT_sym_mmm ( InpMtx *A, DenseMtx *Y, double alpha[], DenseMtx *X,
                            int nthread, int msglvl, int msgFile ) ;
void InpMtx_MT_herm_mmm ( InpMtx *A, DenseMtx *Y, double alpha[], DenseMtx *X,
                            int nthread, int msglvl, int msgFile ) ;
\end{verbatim}
\index{InpMtx_MT_nonsym_mmm@{\tt InpMtx\_MT\_nonsym\_mmm()}}
\index{InpMtx_MT_sym_mmm@{\tt InpMtx\_MT\_sym\_mmm()}}
\index{InpMtx_MT_herm_mmm@{\tt InpMtx\_MT\_herm\_mmm()}}
These methods compute the matrix-vector product $y := y + \alpha A x$,
where $y$ is found in the {\tt Y DenseMtx} object,
$\alpha$ is real or complex in {\tt alpha[]},
$A$ is found in the {\tt A Inpmtx} object, and
$x$ is found in the {\tt X DenseMtx} object.
If any of the input objects are {\tt NULL}, an error message is
printed and the program exits.
{\tt A}, {\tt X} and {\tt Y} must all be real or all be complex.
When {\tt A} is real, then $\alpha$ = {\tt alpha[0]}.
When {\tt A} is complex, then $\alpha$ =
{\tt alpha[0]} + i* {\tt alpha[1]}.
This means that one cannot call the methods with a constant as the
third parameter, e.g.,
{\tt InpMtx\_MT\_nonsym\_mmm(A, Y, 3.22, X, nthread, msglvl, msgFile)},
for this may result in a segmentation violation.
The values of $\alpha$ must be loaded into an array of length 1 or 2.
The number of threads is specified by the {\tt nthread} parameter;
if, {\tt nthread} is {\tt 1}, the serial method is called.
The {\tt msglvl} and {\tt msgFile} parameters are used for
diagnostics during the creation of the threads' individual data
structures.
\par \noindent {\it Error checking:}
If {\tt A}, {\tt Y} or {\tt X} are {\tt NULL},
or if {\tt coordType} is not {\tt INPMTX\_BY\_ROWS},
{\tt INPMTX\_BY\_COLUMNS} or {\tt INPMTX\_BY\_CHEVRONS},
or if {\tt storageMode} is not one of {\tt INPMTX\_RAW\_DATA},
{\tt INPMTX\_SORTED} or {\tt INPMTX\_BY\_VECTORS},
or if {\tt inputMode} is not {\tt SPOOLES\_REAL} or
{\tt SPOOLES\_COMPLEX},
an error message is printed and the program exits.
%-----------------------------------------------------------------------
\item
\begin{verbatim}
void InpMtx_MT_nonsym_mmm_T ( InpMtx *A, DenseMtx *Y, double alpha[], DenseMtx *X,
                            int nthread, int msglvl, int msgFile ) ;
\end{verbatim}
\index{InpMtx_MT_nonsym_mmm_T@{\tt InpMtx\_MT\_nonsym\_mm\_Tm()}}
This method computes the matrix-vector product $y := y + \alpha A^T x$,
where $y$ is found in the {\tt Y DenseMtx} object,
$\alpha$ is real or complex in {\tt alpha[]},
$A$ is found in the {\tt A Inpmtx} object, and
$x$ is found in the {\tt X DenseMtx} object.
If any of the input objects are {\tt NULL}, an error message is
printed and the program exits.
{\tt A}, {\tt X} and {\tt Y} must all be real or all be complex.
When {\tt A} is real, then $\alpha$ = {\tt alpha[0]}.
When {\tt A} is complex, then $\alpha$ =
{\tt alpha[0]} + i* {\tt alpha[1]}.
This means that one cannot call the methods with a constant as the
third parameter, e.g.,
{\tt InpMtx\_MT\_nonsym\_mmm(A, Y, 3.22, X, nthread, msglvl, msgFile)},
for this may result in a segmentation violation.
The values of $\alpha$ must be loaded into an array of length 1 or 2.
The number of threads is specified by the {\tt nthread} parameter;
if, {\tt nthread} is {\tt 1}, the serial method is called.
The {\tt msglvl} and {\tt msgFile} parameters are used for
diagnostics during the creation of the threads' individual data
structures.
\par \noindent {\it Error checking:}
If {\tt A}, {\tt Y} or {\tt X} are {\tt NULL},
or if {\tt coordType} is not {\tt INPMTX\_BY\_ROWS},
{\tt INPMTX\_BY\_COLUMNS} or {\tt INPMTX\_BY\_CHEVRONS},
or if {\tt storageMode} is not one of {\tt INPMTX\_RAW\_DATA},
{\tt INPMTX\_SORTED} or {\tt INPMTX\_BY\_VECTORS},
or if {\tt inputMode} is not {\tt SPOOLES\_REAL} or
{\tt SPOOLES\_COMPLEX},
an error message is printed and the program exits.
%-----------------------------------------------------------------------
\item
\begin{verbatim}
void InpMtx_MT_nonsym_mmm_H ( InpMtx *A, DenseMtx *Y, double alpha[], DenseMtx *X,
                            int nthread, int msglvl, int msgFile ) ;
\end{verbatim}
\index{InpMtx_MT_nonsym_mmm_H@{\tt InpMtx\_MT\_nonsym\_mmm\_H()}}
This method computes the matrix-vector product $y := y + \alpha A^H x$,
where $y$ is found in the {\tt Y DenseMtx} object,
$\alpha$ is complex in {\tt alpha[]},
$A$ is found in the {\tt A Inpmtx} object, and
$x$ is found in the {\tt X DenseMtx} object.
If any of the input objects are {\tt NULL}, an error message is
printed and the program exits.
{\tt A}, {\tt X} and {\tt Y} must all be complex.
The number of threads is specified by the {\tt nthread} parameter;
if, {\tt nthread} is {\tt 1}, the serial method is called.
The {\tt msglvl} and {\tt msgFile} parameters are used for
diagnostics during the creation of the threads' individual data
structures.
\par \noindent {\it Error checking:}
If {\tt A}, {\tt Y} or {\tt X} are {\tt NULL},
or if {\tt coordType} is not {\tt INPMTX\_BY\_ROWS},
{\tt INPMTX\_BY\_COLUMNS} or {\tt INPMTX\_BY\_CHEVRONS},
or if {\tt storageMode} is not one of {\tt INPMTX\_RAW\_DATA},
{\tt INPMTX\_SORTED} or {\tt INPMTX\_BY\_VECTORS},
or if {\tt inputMode} is not {\tt SPOOLES\_COMPLEX},
an error message is printed and the program exits.
%-----------------------------------------------------------------------
\end{enumerate}
\par
\subsection{Multithreaded Factorization methods}
\label{subsection:FrontMtx:proto:factorMT}
\par
%=======================================================================
\begin{enumerate}
%-----------------------------------------------------------------------
\item
\begin{verbatim}
Chv * FrontMtx_MT_factorInpMtx ( FrontMtx *frontmtx, InpMtx *inpmtx,
             double tau, double droptol, ChvManager *chvmanager,
             IV *ownersIV, int lookahead, double cpus[], int stats[],
             int msglvl, FILE *msgFile ) ;
Chv * FrontMtx_MT_factorPencil ( FrontMtx *frontmtx, Pencil *pencil,
             double tau, double droptol, ChvManager *chvmanager,
             IV *ownersIV, int lookahead, double cpus[], int stats[],
             int msglvl, FILE *msgFile ) ;
\end{verbatim}
\index{FrontMtx_MT_factorInpMtx@{\tt FrontMtx\_MT\_factorInpMtx()}}
\index{FrontMtx_MT_factorPencil@{\tt FrontMtx\_MT\_factorPencil()}}
These two methods compute a multithreaded factorization for a matrix
$A$ (stored in {\tt inpmtx}) or a matrix pencil
$A + \sigma B$ (stored in {\tt pencil}).
The {\tt tau} parameter is used when pivoting is enabled, each
entry in $U$ and $L$ (when nonsymmetric) will have magnitude less
than or equal to {\tt tau}.
The {\tt droptol} parameter is used when the fronts are stored in
a sparse format, each entry in $U$ and $L$ (when nonsymmetric)
will have magnitude greater than or equal to {\tt droptol}.
The map from fronts to owning processes is found in {\tt ownersIV}.
The {\tt lookahead} parameter governs the
``upward--looking'' nature of the computations.
Choosing {\tt lookahead = 0} is usually the most conservative with
respect to working storage, while positive values increase the
working storage and sometimes decrease the factorization time.
On return, the {\tt cpus[]} vector is filled with the following
information.
\begin{itemize}
\item
{\tt cpus[0]} --- time spent managing working storage.
\item
{\tt cpus[1]} --- time spent initializing the fronts
                  and loading the original entries.
\item
{\tt cpus[2]} --- time spent accumulating updates from descendents.
\item
{\tt cpus[3]} --- time spent inserting aggregate fronts.
\item
{\tt cpus[4]} --- time spent removing and assembling aggregate fronts.
\item
{\tt cpus[5]} --- time spent assembling postponed data.
\item
{\tt cpus[6]} --- time spent to factor the fronts.
\item
{\tt cpus[7]} --- time spent to extract postponed data.
\item
{\tt cpus[8]} --- time spent to store the factor entries.
\item
{\tt cpus[9]} --- miscellaneous time.
\end{itemize}
On return, the {\tt stats[]} vector is filled with the following
information.
\begin{itemize}
\item
{\tt stats[0]} --- number of pivots.
\item
{\tt stats[1]} --- number of pivot tests.
\item
{\tt stats[2]} --- number of delayed rows and columns.
\item
{\tt stats[3]} --- number of entries in $D$.
\item
{\tt stats[4]} --- number of entries in $L$.
\item
{\tt stats[5]} --- number of entries in $U$.
\item
{\tt stats[6]} --- number of locks of the {\tt FrontMtx} object.
\item
{\tt stats[7]} --- number of locks of aggregate list.
\item
{\tt stats[8]} --- number of locks of postponed list.
\end{itemize}
\par \noindent {\it Error checking:}
If {\tt frontmtx}, {\tt inpmtxA}, {\tt cpus} or {\tt stats}
is {\tt NULL},
or if {\tt msglvl > 0} and {\tt msgFile} is {\tt NULL},
an error message is printed and the program exits.
%-----------------------------------------------------------------------
\end{enumerate}
\par
\subsection{Multithreaded $QR$ Factorization method}
\label{subsection:FrontMtx:proto:factorQR_MT}
\par
%=======================================================================
\begin{enumerate}
%-----------------------------------------------------------------------
\item
\begin{verbatim}
void FrontMtx_MT_QR_factor ( FrontMtx *frontmtx, InpMtx *mtxA,
                             ChvManager *chvmanager, IV *ownersIV, double cpus[],
                             double *pfacops,  int msglvl, FILE *msgFile ) ;
\end{verbatim}
\index{FrontMtx_MT_QR_factor@{\tt FrontMtx\_MT\_QR\_factor()}}
This method computes the
$(U^T+I)D(I+U)$ factorization of $A^TA$ if $A$ is real
or
$(U^H+I)D(I+U)$ factorization of $A^HA$ if $A$ is complex.
The {\tt chvmanager} object manages the working storage.
The map from fronts to threads is found in {\tt ownersIV}.
On return, the {\tt cpus[]} vector is filled as follows.
\begin{itemize}
\item
{\tt cpus[0]} -- time to set up the factorization.
\item
{\tt cpus[1]} -- time to set up the fronts.
\item
{\tt cpus[2]} -- time to factor the matrices.
\item
{\tt cpus[3]} -- time to scale and store the factor entries.
\item
{\tt cpus[4]} -- time to store the update entries
\item
{\tt cpus[5]} -- miscellaneous time
\item
{\tt cpus[6]} -- total time
\end{itemize}
On return, {\tt *pfacops} contains the number of floating point
operations done by the factorization.
\par \noindent {\it Error checking:}
If {\tt frontmtx}, {\tt frontJ} or {\tt chvmanager} is {\tt NULL},
or if {\tt msglvl > 0} and {\tt msgFile} is {\tt NULL},
an error message is printed and the program exits.
%-----------------------------------------------------------------------
\end{enumerate}
\par
\subsection{Multithreaded Solve method}
\label{subsection:FrontMtx:proto:solve-multithreaded}
\par
\begin{enumerate}
%=======================================================================
\item
\begin{verbatim}
void FrontMtx_MT_solve ( FrontMtx *frontmtx, DenseMtx *mtxX, DenseMtx *mtxB,
                         SubMtxManager *mtxmanager, SolveMap *solvemap,
                         double cpus[], int msglvl, FILE *msgFile ) ;
\end{verbatim}
\index{FrontMtx_MT_solve@{\tt FrontMtx\_MT\_solve()}}
This method is used to solve one of three linear systems of equations
using a multithreaded solve
---
$(U^T + I)D(I + U) X = B$,
$(U^H + I)D(I + U) X = B$ or
$(L + I)D(I + U) X = B$.
Entries of $B$ are {\it read} from {\tt mtxB} and
entries of $X$ are written to {\tt mtxX}.
Therefore, {\tt mtxX} and {\tt mtxB} can be the same object.
(Note, this does not hold true for an MPI factorization with pivoting.)
The submatrix manager object manages the working storage.
The {\tt solvemap} object contains the map from submatrices to
threads.
The map from fronts to processes that own them is given in the {\tt
ownersIV} object.
On return the {\tt cpus[]} vector is filled with the following.
The {\tt stats[]} vector is not currently used.
\begin{itemize}
\item
{\tt cpus[0]} --- set up the solves
\item
{\tt cpus[1]} --- fetch right hand side and store solution
\item
{\tt cpus[2]} --- forward solve
\item
{\tt cpus[3]} --- diagonal solve
\item
{\tt cpus[4]} --- backward solve
\item
{\tt cpus[5]} --- total time in the method.
\end{itemize}
\par \noindent {\it Error checking:}
If {\tt frontmtx}, {\tt rhsmtx}, {\tt mtxmanager},
{\tt solvemap}, {\tt cpus} or {\tt stats} is {\tt NULL},
or if {\tt msglvl} > 0 and {\tt msgFile} is {\tt NULL},
an error message is printed and the program exits.
%-----------------------------------------------------------------------
\end{enumerate}
\par
\subsection{Multithreaded $QR$ Solve method}
\label{subsection:FrontMtx:proto:QRsolve-MT}
\par
\begin{enumerate}
%=======================================================================
\item
\begin{verbatim}
void FrontMtx_MT_QR_solve ( FrontMtx *frontmtx, InpMtx *mtxA, DenseMtx *mtxX,
              DenseMtx *mtxB, SubMtxManager *mtxmanager, SolveMap *solvemap,
              double cpus[], int msglvl, FILE *msgFile ) ;
\end{verbatim}
\index{FrontMtx_MT_QR_solve@{\tt FrontMtx\_MT\_QR\_solve()}}
This method is used to minimize $\|B - AX\|_F$, where
$A$ is stored in {\tt mtxA},
$B$ is stored in {\tt mtxB},
and $X$ will be stored in {\tt mtxX}.
The {\tt frontmtx} object contains a
$(U^T+I)D(I+U)$ factorization of $A^TA$ if $A$ is real
or
$(U^H+I)D(I+U)$ factorization of $A^HA$ if $A$ is complex.
We solve the seminormal equations
$(U^T+I)D(I+U)X = A^TB$ or $(U^H+I)D(I+U)X = A^HB$
for $X$.
On return the {\tt cpus[]} vector is filled with the following.
\begin{itemize}
\item
{\tt cpus[0]} --- set up the solves
\item
{\tt cpus[1]} --- fetch right hand side and store solution
\item
{\tt cpus[2]} --- forward solve
\item
{\tt cpus[3]} --- diagonal solve
\item
{\tt cpus[4]} --- backward solve
\item
{\tt cpus[5]} --- total time in the solve method.
\item
{\tt cpus[6]} --- time to compute $A^TB$ or $A^HB$.
\item
{\tt cpus[7]} --- total time.
\end{itemize}
Only the solve is presently done in parallel.
\par \noindent {\it Error checking:}
If {\tt frontmtx}, {\tt mtxA}, {\tt mtxX}, {\tt mtxB}, {\tt mtxmanager},
{\tt solvemap} or {\tt cpus} is {\tt NULL},
or if {\tt msglvl} > 0 and {\tt msgFile} is {\tt NULL},
an error message is printed and the program exits.
%=======================================================================
\end{enumerate}


% !TeX root = ../main.tex

\section{Introduction}
The idea of the recursive nearest neighbors method came up in the process of studying
recommender systems in the framework of this thesis. The method that will be presented is an
effort to overcome the limitations of neighborhood-based approach. That is, to provide more
rating predictions than the conventional K-Nearest Neighbors method, which fails when it
cannot connect users or items directly due to sparseness constraints.

\begin{table}[H]
\centering
\begin{tabular}{ |c|c|c|c|c|c|c| }
\hline
\diagbox{$User$}{$Item$} & \textbf{$Item_1$} & \textbf{$Item_2$} & \textbf{$Item_3$} & \textbf{$Item_4$}  & \textbf{$Item_5$} & \textbf{$Item_6$} \\
\hline
\textbf{$User_1$} & 5 & 2 & 3 & \textbf{?} & 1 & 5 \\
\hline
\textbf{$User_2$} & 1 & 2 & 4 & \textbf{?} & 2 & 2 \\
\hline
\textbf{$User_3$} & 4  & 3 & 5 & \textbf{?} & 4 & 3 \\
\hline
\textbf{$User_4$} & 5 & 2 & 3 &  \textbf{?} & \textbf{?} & \textbf{?} \\
\hline
\textbf{$User_5$} & \textbf{?} & \textbf{?}  & \textbf{?} & 4 & 1 & 1 \\
\hline
\textbf{$User_6$} & \textbf{?} & \textbf{?} & \textbf{?}  & 3 & 5 & 2 \\
\hline
\textbf{$User_7$} & \textbf{?} & \textbf{?} & \textbf{?}  & 5 & 1 & 2 \\
\hline
\textbf{$User_8$} & \textbf{?} & \textbf{?} & \textbf{?}  & 5 & 4 & 4 \\
\hline
\end{tabular}
\caption{Modified Ratings Matrix}
\label{table:Modified Ratings Matrix}
\end{table}

The above table is a modification/extension of \autoref{table:Ratings Matrix}. If KNN was applied to
this rating matrix with $\mathcal{K}=4$(all users do not have 4 available NN, instead
they use the largest amount of NN available to them before 4) using user cosine similarity,
it would produce the rating predictions in the table below.

\begin{table}[H]
\centering
\begin{tabular}{ |c|c|c|c|c|c|c| }
\hline
\diagbox{$User$}{$Item$} & \textbf{$Item_1$} & \textbf{$Item_2$} & \textbf{$Item_3$} & \textbf{$Item_4$}  & \textbf{$Item_5$} & \textbf{$Item_6$} \\
\hline
\textbf{$User_1$} & 5 & 2 & 3 & {\color{red}4.3} & 1 & 5 \\
\hline
\textbf{$User_2$} & 1 & 2 & 4 & {\color{red}4.15} & 2 & 2 \\
\hline
\textbf{$User_3$} & 4  & 3 & 5 & {\color{red}4.12} & 4 & 3 \\
\hline
\textbf{$User_4$} & 5 & 2 & 3 &  {\color{green}\textbf{?}} & {\color{red}2.35} & {\color{red}3.42} \\
\hline
\textbf{$User_5$} & {\color{red}3.35} & {\color{red}2.35}  & {\color{red}4.02} & 4 & 1 & 1 \\
\hline
\textbf{$User_6$} & {\color{red}3.21} & {\color{red}2.4} & {\color{red}4.15}  & 3 & 5 & 2 \\
\hline
\textbf{$User_7$} & {\color{red}3.46} & {\color{red}2.32} & {\color{red}3.94}  & 5 & 1 & 2 \\
\hline
\textbf{$User_8$} & {\color{red}3.36} & {\color{red}2.35} & {\color{red}4.03}  & 5 & 4 & 4 \\
\hline
\end{tabular}
\caption{Modified Ratings Matrix After KNN}
\label{table:Modified Ratings Matrix after KNN}
\end{table}
\justify
It seems that KNN was unable to predict how $User_4$ would rate $Item_4$.\\
The connections from user cosine similarity that could be formed were the following:
\begin{align*}
	&cos(User_1,User_2) = 0.7659 &cos(User_1,User_3) = 0.8660 & &cos(User_1,User_4) = 0.7705\\
	&cos(User_1,User_5) = 0.1767 &cos(User_1,User_6) = 0.3041 & &cos(User_1,User_7) = 0.2510\\
	&cos(User_1,User_8) = 0.3973 &cos(User_2,User_3) = 0.9434 & &cos(User_2,User_4) = 0.6325\\
	&cos(User_2,User_5) = 0.1750 &cos(User_2,User_6) = 0.4217 & &cos(User_2,User_7) = 0.2034\\
	&cos(User_2,User_8) = 0.3935 &cos(User_3,User_4) = 0.7680 & &cos(User_3,User_5) = 0.1905\\
	&cos(User_3,User_6) = 0.4870 &cos(User_3,User_7) = 0.2108 & &cos(User_3,User_8) = 0.4282\\
	&cos(User_5,User_6) = 0.7264 &cos(User_5,User_7) = 0.9897 & &cos(User_5,User_8) = 0.8741\\
	&cos(User_6,User_7) = 0.7108 &cos(User_6,User_8) = 0.9239 & &cos(User_7,User_8) = 0.8947\\
\end{align*}
\vfill
\justify
The following figure is a graphical representation of the user connections.
\begin{figure}[H]
\centering
\includegraphics[width=0.8\textwidth]{chapter_3/user_connections.eps}
\caption{User Connections}
\label{figure:user_connections}
\end{figure}

It seems that from users who have rated $Item_4$, it is possible to create a connection to $User_4$, but in
order to do that they must use the intermediate connections they have in common. Graph-based
methods are known to utilize these connections efficiently to produce link similarities that
surpass the direct connection between users or items \citep{Ricci,Aggarwal}.
\section{Methodology}
The Recursive K-Nearest Neighbors algorithm utilizes the intermediate connections that two users
have in common in order to find a path to predict ratings that the conventional KNN could not find.
The concept of this algorithm, is to use the rating predictions produced by KNN, in order
to consider the users that have not rated the target item, as neighbors. As presented in
\autoref{figure:user_connections_with_KNN} below,
the KNN rating predictions related to $Item_4$ for $User_1$, $User_2$ and $User_3$ have been
added to the figure to indicate them as real rating values that these users gave to $Item_4$.
\begin{figure}[H]
\centering
\includegraphics[width=0.8\textwidth]{chapter_3/user_connections_with_KNN.eps}
\caption{User Connections as \autoref{figure:user_connections} with KNN predictions from \autoref{table:Modified Ratings Matrix after KNN}}
\label{figure:user_connections_with_KNN}
\end{figure}
Then, as new similarities can be formed for $User_4$ with $User_1$, $User_2$ and $User_3$ for $Item_4$, the weighted sum formula used in KNN can be
again used to compute the rating prediction of $User_4$ to $Item_4$ as shown in \autoref{figure:RKNN_prediction}.\\
\begin{figure}[H]
\centering
\includegraphics[width=0.8\textwidth]{chapter_3/RKNN_prediction.eps}
\caption{Recursive KNN Rating Prediction}
\label{figure:RKNN_prediction}
\end{figure}
The Recursive K-Nearest Neighbors methodology for predicting how $User_A$ would rate $Item_B$,
(with the assumption that, given a similarity metric, KNN would not be able to predict this rating)
consists of the following steps:
\begin{itemize}\label{RKNN}
	\item[] \textbf{Step 1:} Select users that are connected with $User_A$, and name it $Group_A$.
	\item[] \textbf{Step 2:} Out of $Group_A$, choose those users that have connections with
	users who have rated $Item_B$, and name it $Group_B$.
	\item[] \textbf{Step 3:}  Order $Group_B$ by descending similarity with $User_A$.
	\item[] \textbf{Step 4:}  Choose how many neighbors from $Group_B$ will contribute in the
	rating prediction by selecting the top $\mathcal{K}$ out of all the available
	neighbors in this group, and name it $Group_C$.
	\item[] \textbf{Step 5:} For each neighbor in $Group_C$, predict how this neighbor would
	rate $Item_B$ using the KNN algorithm. For convenience, we name the number of recursive
	neighbors each neighbor in $Group_C$ uses as, $\mathcal{M}$-Nearest Neighbors.
	\item[] \textbf{Step 6:} Use the rating predictions applied on $Group_C$ to perform
	the KNN algorithm on $User_A$ for $Item_B$.
\end{itemize}

Now that the steps for performing the Recursive K-Nearest Neighbors algorithm have been
introduced let us look at a general case as in the figure below:\\
\begin{figure}[H]
\centering
\includegraphics[width=0.8\textwidth]{chapter_3/Recursive_Nearest_Neighbors.eps}
\caption{Recursive Nearest Neighbors Algorithm}
\label{figure:recursive_algorithm}
\end{figure}
Interpretation of the figure:
\begin{enumerate}
	\item After the selection of the top $\mathcal{K}$ relevant Neighbors.
	(\textbf{Steps 1,2,3,4})
	\item For each Neighbor, name it $Neighbor_i$, out of $\mathcal{K}$'s choose $\mathcal{M}$
	Neighbors to apply KNN on $Neighbor_i$. (\textbf{Step 5})
	\item Use the rating predictions applied on $\mathcal{K}$'s to predict the requested
	User-Item rating.\\ (\textbf{Step 6})
\end{enumerate}


\chapter{Nonlinear filtering}
\label{ch:RNN}

The SWR detectors discussed up to this point -- both the band-pass and the GEVec-based filters -- calculate their output as a linear combination of input samples. This chapter explores whether a nonlinear method to calculate the output signal can improve SWR detection performance.

\input{RNNs}
\input{GRU-eqs}
\input{Optimize}
\input{Results}


\documentclass[t]{beamer}
\usetheme{Copenhagen}
\setbeamertemplate{headline}{} % remove toc from headers
\beamertemplatenavigationsymbolsempty

\usepackage{amsmath, tikz, bm, pgfplots, tcolorbox}
\pgfplotsset{compat = 1.16}

\title{Quadratic Formula}
\author{}
\date{}

\AtBeginSection[]
{
  \begin{frame}
    \frametitle{Objectives}
    \tableofcontents[currentsection]
  \end{frame}
}

\begin{document}

\begin{frame}
\maketitle
\end{frame}

\section{Solve quadratic equations using the quadratic formula}

\begin{frame}{The Quadratic Formula}
The \alert{quadratic formula} can be used to solve \underline{any} quadratic equation that is equal to 0.	\newline\\	\pause

\begin{center}
For $ax^2 + bx + c = 0$
\end{center}

\begin{tcolorbox}[colback=red!10!white, colframe=red!60!black, title=Quadratic Formula]
\[x = \frac{-b \pm \sqrt{b^2-4ac}}{2a}\]
\end{tcolorbox}
\end{frame}

\begin{frame}{Example 1}
Solve each of the following using the quadratic formula. Exact answers only.	\newline\\
(a) \quad $3x^2 + 8x - 28 = 0$		\pause
\[ a = 3 \quad b = 8 \quad c = -28 \]
\begin{align*}
\onslide<3->{x &= \frac{-8 \pm \sqrt{8^2-4(3)(-28)}}{2(3)}} \\[10pt]
\onslide<4->{x &= \frac{-8 \pm \sqrt{400}}{6}} \\[10pt]
\onslide<5->{x &= \frac{-8 \pm 20}{6}}
\end{align*}
\end{frame}

\begin{frame}{Example 1}
\[x = \frac{-8 \pm 20}{6} \]
\begin{align*}
\onslide<2->{x &= \frac{-8+20}{6} & x &= \frac{-8-20}{6}} \\[10pt]
\onslide<3->{x &= 2 & x &= -\frac{14}{3}}
\end{align*}
\end{frame}

\begin{frame}{Example 1}
(b) \quad $5x^2 + 9x - 5 = 0$ \pause
\[ a = 5 \quad b = 9 \quad c = -5 \]
\begin{align*}
\onslide<3->{x &= \frac{-9 \pm \sqrt{9^2-4(5)(-5)}}{2(5)}} \\[10pt]
\onslide<4->{x &= \frac{-9 \pm \sqrt{181}}{10}}
\end{align*}
\onslide<5->{\[x = \frac{-9 + \sqrt{181}}{10} \quad x = \frac{-9 - \sqrt{181}}{10}\]}
\end{frame}

\begin{frame}{Example 1}
(c) \quad $6x^2 - 6x - 15 = -10$ \pause
\[ 6x^2 - 6x - 5 = 0 \]	\pause
\[a = 6 \quad b = -6 \quad c = -5 \]
\begin{align*}
\onslide<4->{x &= \frac{6 \pm \sqrt{6^2-4(6)(-5)}}{2(6)}} \\[10pt]
\onslide<5->{x &= \frac{6 \pm \sqrt{156}}{12}}
\end{align*}
\end{frame}

\begin{frame}{Example 1}
\[x = \frac{6 \pm \sqrt{156}}{12} \]
\begin{align*}
\onslide<2->{x &= \frac{6 \pm 2\sqrt{39}}{12}} \\[10pt]
\onslide<3->{x &= \frac{2\left(3\pm \sqrt{39}\right)}{12}} \\[10pt]
\onslide<4->{x &= \frac{3 \pm \sqrt{39}}{6}}
\end{align*}
\end{frame}

\begin{frame}{Example 1}
(d) \quad $7x^2 + 20x - 8 = -3x^2 - 1 + 10x$	\pause
\[ 10x^2 + 10x - 7 \]	\pause
\[a = 10 \quad b = 10 \quad c = -7\]
\begin{align*}
\onslide<4->{x &= \frac{-10 \pm \sqrt{10^2-4(10)(-7)}}{2(10)}} \\[10pt]
\onslide<5->{x &= \frac{-10 \pm \sqrt{380}}{20}}
\end{align*}
\end{frame}

\begin{frame}{Example 1}
\[x = \frac{-10 \pm \sqrt{380}}{20} \]
\begin{align*}
\onslide<2->{x &= \frac{-10 \pm 2\sqrt{95}}{20}} \\[10pt]
\onslide<3->{x &= \frac{2\left(-5\pm \sqrt{95}\right)}{20}} \\[10pt]
\onslide<4->{x &= \frac{-5 \pm \sqrt{95}}{10}}
\end{align*}
\end{frame}

\section{Use the discriminant to determine the types of solutions to a quadratic equation}

\begin{frame}{The Discriminant}
The expression {\color{blue}$b^2-4ac$} in the square root is called the \alert{discriminant}. It can tell us about the solutions to a quadratic equation:	\newline\\	\pause

\begin{itemize}
	\item \textbf{Discriminant is negative:} No real values of $x$ make the original equation true. \newline\\ \pause
	\item \textbf{Discriminant is 0:} There is one value of $x$ (called a \emph{double root}). \newline\\ \pause
	\item \textbf{Discriminant is positive:} There are 2 unique answers for $x$.
\end{itemize}
\end{frame}

\begin{frame}{The Discriminant}
In addition, if $\sqrt{b^2 - 4ac}$ equals a \alert{rational number}, then the quadratic equation is factorable over the integers (only use integers in your factoring).
\end{frame}

\end{document}


Standard stereo recording practice typically considered the damping of sound with distance to not be a consideration in the effect of a stereo recording array. However, there are cases where the damping of sound between microphones may be a non-trivial consideration. This effect is typically more pronounced in the flanking microphones when used, however may be a consideration for wider-set main arrays as well.

Confounding this are issues with accurately modelling the emission and propagation of sound. As previously mentioned, the goal is not a physical model, but a practically useable abstraction. To this end, a model that includes a perceptually accurate representation of the significant effect of the phenomena is sufficient, even if the detail is lacking.

To represent an abstraction of the propagation of sound and its damping with distance, three different damping compensation arrangements have been implemented. To abstract the actual propagation of sound with respect to an real source's statistical directivity pattern and facing, an additional parameter can be introduced that affects the amount of damping with distance. Accompanying this, a Boolean parameter, $\gamma$ is introduced to allow the user to enable or disable the $\Delta{l}$ calculation.

This gives the expansion of $m(S)$ to:

\begin{equation}
m(S) = \left(\begin{cases}
\Delta{v} \cdot \Delta{l} & \; \text{if} \; \gamma = 1 \\
\Delta{v} &\; \text{if} \; \gamma = 0
\end{cases}\right)
+ \Delta{t}
\end{equation}

Noting that $\Delta{v}$ and $\Delta{l}$ should be in the form of amplitude scalars, rather than decibel amounts\footnote{Decibels amounts would need to be summed rather than multiplied.}

\subsection {Sound Damping Formula}

If there are two points in a free-field space, each a distance of $r$ from a sound source, and if we know the sound pressure level in decibels, $l$, at one of the points: then the sound pressure level at the other distance can be calculated as:

\begin{equation}
l_2 = l_1 - \left|20 \cdot \log_{10}\frac{r_1}{r_2}\right|
\end{equation}

Substituting the positions of the virtual microphone and sound source into the formula, and assuming that the microphone's signal is measured at a unit distance of one, the level at a virtual microphone can be found as:

\begin{equation}
l_m = l_S - \left|20 \cdot \log_{10}\frac{1}{d_{\vec{v}}}\right|
\end{equation}

From this, the damping amount at the microphone's distance from the sound source is simply:

\begin{equation}
\Delta{l}_m = 20 \cdot\log_{10}(d_{\vec{v}})
\end{equation}

As previously discussed, the actual damping amount displayed by a sound source in practice also depends on the directivity of the source and the acoustic environment. The most expedient method for reducing the amount of damping with distance, is to reduce the value of the multiplier for the $\log$ function in the calculation. This can be done by replacing the multiplier with a user-adjustable parameter, $\sigma$ from the multiplier, where $\sigma \in [0,20]$. To simplify the user-experience, this implementation uses $\sigma \in \{5, 10, 20\}$ which corresponds with a 1.5dB, 3dB, and 6dB amount of damping per doubling of distance.

\begin{equation}\label{distancedamping}
\Delta{l}_m = \sigma\cdot\log_{10}(d_{\vec{v}})
\end{equation}

Finally, this can be converted to an amplitude scalar value following the usual conversion\footnote{See (\ref{dbscalarconvert})}:

\begin{equation}
\Delta{l}_m= -10^{\frac{\Delta{l}_m}{20}}
\end{equation}

\subsection{Implementing $\Delta{l}$ Correction}

For aesthetic/artistic reasons, a direct modeling of the propagation of sound is likely to be undesirable. Additionally, it may even defeat the purpose in the near-capture of the real sound source. To this end there are two processing considerations made in the model: the actual distance-damping that is compensated for and the specific virtual microphones to which the $\Delta{l}$ correction is applied.

\subsubsection{Correction Amount}

It is unnecessary to apply the full amount of $\Delta{l}$ to the virtual microphones. The damping due to the distance between the source and the nearest microphone serves no artistic purpose in modelling, and will only cause the mixing engineer to have to (re)adjust the aesthetic balance of the recorded track. Thus, the compensation only needs to be applied for the distance differences between the microphones.

This can be done simply by finding the smallest value for $l$ in the set of virtual microphones, and subtracting that number from every other microphone. If $j \in M \;|\; \Delta{l}_j \leq \Delta{l}_i, \forall i \in M$, then the distance-damping formula (\ref{distancedamping}) is redefined as the intermediate value $\Delta{l}_m$, and the function $\Delta{l}(m)$ becoming:

\begin{equation}
\Delta{l}(m) = \Delta{l}_m - \Delta{l}_j
\end{equation}

\subsubsection{Microphone relationships}

Depending on the musical context, it may or may not be desirable to consider the damping effect on the full microphone array. Three different arrangements are considered by breaking the microphone array into two parts: $M = W \cup U \;|\; W = \left\{m_c, m_{mL}, m_{mR}\right\}, U = \left\{m_{fL}, m_{fR}\right\}$. These four options are (1) damping applied to $M$, (2) damping applied to $W$ and $F$ independently, and (3) damping only applied to $F$. To facilitate this, the user-settable parameter can be defined so that $\gamma \in \{0, 1, 2, 3\}$, and $\Delta{l}_j$ is taken from the same subset as $\Delta{l}_m$:

\begin{equation}
\Delta{l}(m) = \begin{cases}
\text{for}\; \gamma = 0:\Delta{l}_m \\
\text{for}\; \gamma = 1:\Delta{l}_m - \Delta{l}_j\\
\text{for}\; \gamma = 2:\begin{cases}
\Delta{l}_m - \Delta{i}_j \; &\text{if}\; m\land{}j\in{}W\\
\Delta{l}_m - \Delta{i}_j \; &\text{if}\; m\land{}j\in{}U
\end{cases}\\
\text{for}\; \gamma = 3:\begin{cases}
\Delta{l}_m \; &\text{if}\;\Delta{l}_m\in{}W\\
\Delta{l}_m - \Delta{l}_j \; &\text{if}\;m\in{}U \;|\; j\in{}U
\end{cases}
\end{cases}
\end{equation}


\section{Superconductivity}
\label{s:superconductivity}

We consider two approaches to realizing a superconducting state.
First, we assume a proximity induced state obtained by
layering a TMD on an $s$-wave superconductor.
Second, we study an intrinsic correlated phase arising
from density-density interactions.

We use $d^ν_{τ {\s}} \ofK$ as the annihilation operator
for tight-binding $d$-orbital states,
and $c^n_{τ {\s}} \ofK$ for the eigenstates of the non-interacting Hamiltonian,
$λ_{\vK}$ for the energy dispersion for Bogoliubov quasiparticles,
and $Δ_{\vK}$ for the superconducting gap function.

\subsection{Induced State}

A proximity $s$-wave superconductor will inject Cooper pairs
according to
\begin{equation}
  H^V
  = ∑_{\vK, ν, τ} \cc{B}_ν
    d^ν_{-τ ↓} \ofMK d^ν_{τ ↑} \ofK + \frac{ε}{2} + \hc
\end{equation}
The coupling constants $B_ν$ and the overall constant $ε$
depend on the material interface %
\footnote{%
  Note that all sums over $\vK$ are restricted to $\left| \vK \right|$
  less than some cutoff that restricts the momentum to a single valley.
}.
Using the abbreviated notation
$c_{\vK α} = c^-_{τ {\s}} \ofK$,
with $α =\ ↑↓$ for $τ = {\s} = ±$,
projecting onto the upper valence bands yields,
\begin{multline}
  \label{eq:induced}
  P_{τ = {\s}}^{n = -} \left( H^0 + H^V - μ N \right)
  = ∑_{\vK, α} ξ_{\vK} c_{\vK α}^† c_{\vK α} \\
  - \sumK \left( \cc{Δ}_{\vK} c_{-\vK ↓} c_{\vK ↑}
  + Δ_{\vK} c_{\vK ↑}^† c_{-\vK ↓}^† \right)
  + ε,
\end{multline}
where $ξ_{\vK} = E_{+ ↑}^- \of{\abs{\vK}} - μ$ and
the effective BCS gap function is
\begin{equation}
  Δ_{\vK}
  = \frac{1}{2} \left( B_+ + B_- \right)
  + \frac{1}{2} \left( B_+ - B_- \right)
    \cos{θ_{\vK}},
\end{equation}
with $θ_{\vK} = θ_{+↑}^- \of{\abs{\vK}}$.
This form is identical to the standard BCS Hamiltonian with
an effective spin index $α$.
However, the spin state of the Cooper pair is an equal superposition
of the singlet and the $m = 0$ component of spin triplet.
The corresponding quasiparticle eigenstates are
$γ_{\vK α}
= α \cos{β_{\vK}} c_{\vK α} + \sin{β_{\vK}} c_{-\vK, -α}^†$,
with energies
$λ_{\vK} = ± \sqrt{ξ_{\vK}^2 + Δ_{\vK}^2}$,
where $\cos{2 β_{\vK}} = ξ_{\vK} / λ_{\vK}$.
Note that if $B_+ = B_-$,
then $Δ_{\vK}$ is a constant and independent of $\vK$.
Even when $B_+$ and $B_-$ are different,
the constant term dominates.
Before exploring the nature of this state,
we analyze the case of intrinsic superconductivity,
and show that the same state is energetically preferred.

\subsection{Intrinsic Phase}

For a local attractive density-density interaction
(e.g.\ one mediated by phonons), the potential is
$V ⋍ \frac{1}{2} ∑_{\vR, \vR'} v_{\vR \vR'}
\normalorder{n_{\vR} n_{\vR'}}$,
with $v_{\vR \vR'} = v_0 δ_{\vR \vR'}$
and $n_{\vR}$ the total Wannier electron density at lattice vector $\vR$.
Projecting onto states near the chemical potential gives
\begin{multline}
  \label{eq:channels}
  P_{τ = {\s}}^{n = -} \left( H^V \right)
  = \sumKK v \of{\vK' - \vK} \\
  × \left(
    A_{\vK \vK'}^2 c_{\vK' ↑}^† c_{-\vK' ↑}^† c_{-\vK ↑} c_{\vK ↑}
  + A_{\vK' \vK}^2 c_{\vK' ↓}^† c_{-\vK' ↓}^† c_{-\vK ↓} c_{\vK ↓}
    \right. \\ + \left.
      2 \abs{A_{\vK \vK'}}^2
      c_{\vK' ↑}^† c_{-\vK' ↓}^† c_{-\vK ↓} c_{\vK ↑}
    \vphantom{2 \abs{V_{\vK \vK'}}^2} \right),
\end{multline}
where
\begin{equation}
  A_{\vK \vK'}
  = e^{i \left( ϕ_{\vK'} - ϕ_{\vK} \right)}
    \sin{\frac{θ_{\vK'}}{2}} \sin{\frac{θ_{\vK}}{2}}
  + \cos{\frac{θ_{\vK'}}{2}} \cos{\frac{θ_{\vK}}{2}}.
\end{equation}
The first two terms in \cref{eq:channels} lead to intravalley pairing,
and the third to intervalley pairing.
We analyze the possible states within mean field theory.
The BCS order parameter is
\begin{equation}
  χ
  = v_0 \sumK \cc{g}_{\vK} \ev{c_{-\vK α'} c_{\vK α}},
\end{equation}
where the form of $g_{\vK}$ depends on the particular pairing channel.
The resulting Hamiltonian has the same form as the BCS Hamiltonian in
\cref{eq:induced}
but with an effective $Δ_{\vK} = g_{\vK} · χ$.
The intravalley pairing has three symmetry channels,
with the couplings given by
$2 g_{\vK} = 1 +  \cos{θ_{\vK}}$,
$\sqrt{2} e^{- i ϕ_{\vK}} g_{\vK} = \sin{θ_{\vK}}$
and $2 e^{- 2 i ϕ_{\vK}} g_{\vK} = 1 - \cos{θ_{\vK}}$.
For these channels, since
$\ev{c_{-\vK α} c_{\vK α}} = - \ev{c_{\vK α} c_{-\vK α}}$,
relabeling $\vK → -\vK$ in the sum gives $χ = 0$ %
\footnote{%
  For odd parity interactions, where $v \ofMK = -v \ofK$, the
  intravalley pairing is not excluded by symmetry.
  Specifically, repeating the calculation with this assumption,
  the intervalley terms fully cancel, and one obtains \cref{eq:channels}
  without the intervalley term on the third line.
}.
The intervalley pairing also has three symmetry channels:
$g_{\vK} = \sqrt{2}$,
$g_{\vK} = \sqrt{2} \cos{θ_{\vK}}$,
and $g_{\vK} = \sqrt{2} \sin{θ_{\vK}} \vc{\hat{k}}$.
Of the three,
the constant valued channel is dominant %
\footnote{%
  For example, using the values for \ce{WSe2},
  $\sin^2 {θ_{\vK}} = 0.44$ and $\cos^2 {θ_{\vK}} = 0.56$
  at the chemical potential.
}.
This is to be expected, as the local density-density interaction
leads to the largest pairing for electrons of opposite spins.
Since the intravalley processes have the same spin,
they are disfavored as compared to the intervalley pairing.

The key features of the intrinsic superconducting state
are identical to the proximally induced case when density-density
interactions dominate.
We restrict further analysis to that case,
and turn to the question of pair-breaking phenomena
induced either by optical or magnetic fields.


%!TEX root = ../notes.tex
\section{April 27, 2022}
\subsection{GGH Cryptosystem: Public-Key Cryptosystem}
\recall last time we talked about GGH digital signatures.

We're going to use similar ideas to construct a public-key cryptosystem. As before, we'll have the same public/private key setup as last time.

\ul{Alice}: will choose a random basis $\{\bvec{v}_i\}$ which will be her private key, which is a \emph{sufficiently good} basis. Alice will then compute $\{\bvec{w}_i\}$ which is a bad basis (by multiplying by some $U\in\mathsf{SL}_n(\ZZ)$) which is her public key.

\ul{Bob}: will encrypt message $\{m_i\}$ by computing
\[\bvec{c} = \sum m_i \bvec{w}_i + \bvec{r}\]
where $\bvec{r}$ is a randomly generated short vector.

\ul{Alice}: Find the closest lattice point to $\bvec{c}$ using Babai's algorithm, and express it in the public basis $\{\bvec{w}_i\}$.

Code in \textsf{lattices.ipynb}.

\subsection{Lattice Reduction}
\emph{Warm-up}: Gaussian Lattice Reduction.

We'll see how to find the shortest vector in a 2-dimensional lattice.

With Gram-Schmidt, we made an orthgonal basis.
\begin{center}
    \begin{tikzpicture}
        \draw[->, thick](0,0) node[left]{$O$} -- node[above]{$\bvec{v}_2$} (4, 1);
        \draw[->, thick](0,0) -- node[below]{$\bvec{v}_1$} (3, 0);
        \draw[->, densely dotted](4,1) -- node[above]{$\mu\cdot \bvec{v}_1$} (0,1);
        \draw[->, thick, red](0,0) -- node[left, red]{$\bvec{v}_2'$} (0,1);
    \end{tikzpicture}
\end{center}

Using Gram-Schmidt, we have $\bvec{v}_2' = \bvec{v}_2 - \mu\cdot \bvec{v}_1$ where $\mu = \frac{\bvec{v}_1\cdot \bvec{v}_2}{\bvec{v}_1\cdot \bvec{v}_1}$.

With lattice reduction, we round $\mu$ to subtract by an integer multiple of $\bvec{v}_2$ instead.

\begin{center}
    \begin{tikzpicture}
        \draw[->, thick](0,0) node[left]{$O$} -- node[above]{$\bvec{v}_2$} (4, 1);
        \draw[->, thick](0,0) -- node[below]{$\bvec{v}_1$} (3, 0);
        \draw[->, densely dotted](4,1) -- node[above]{$1\cdot \bvec{v}_1$} (1,1);
        \draw[->, thick, red](0,0) -- node[above left, red]{$\bvec{v}_2'$} (1,1);
    \end{tikzpicture}
\end{center}

Lattice reduction gives us
\[\bvec{v}_2' = \bvec{v}_2 - \lfloor\mu\rceil\cdot \bvec{v}_1\]

We do this again and again.

Code in \textsf{lattices.ipynb}.

We should prove that this gives us a reasonable basis when this algorithm finishes.
\begin{proposition}
    This algorithm terminates.
\end{proposition}
\begin{proof}
    Integer vectors $||\bvec{v}_1||$ and $||\bvec{v}_2||$ always decrease, and there are only \emph{finitely many} lattice vectors that strictly decrease.
\end{proof}

\begin{proposition}
    When this algorithm terminates, $\bvec{v}_1$ is the shortest vector in the lattice.
\end{proposition}
\begin{proof}
    At the end, we know that $||\bvec{v}_2||\geq ||\bvec{v}_1||$ and that
    \[-\frac{1}{2}\leq \mu = \frac{\bvec{v}_1\cdot \bvec{v}_2}{\bvec{v}_1\cdot \bvec{v}_1} \leq \frac{1}{2}.\]
    Any vector $\bvec{w} = a_1\bvec{v}_1 + a_2\bvec{v}_2$. So
    \begin{align*}
        ||\bvec{w}||^2 & = a_1^2\cdot ||\bvec{v}_1||^2 + 2a_1a_2(\bvec{v}_1\cdot \bvec{v}_2) + a_2^2||\bvec{v}_2||^2 \\
                       & \geq a_1^2\cdot ||\bvec{v}_1||^2 + a_1a_2||\bvec{v}_1||^2 + a_2^2||\bvec{v}_2||^2           \\
                       & = (a_1^2 + a_1a_2 + a_2^2)||\bvec{v}_1||^2
    \end{align*}
    And $a_1^2 + a_1a_2 + a_2^2 = \frac{3}{4}(a_1 - a_2)^2 + \frac{1}{4}(a_1 + a_2)^2 > 0$. \textsc{otoh} $a_1, a_2\in\ZZ$ so $a_1^2 + a_1a_2 + a_2^2\geq 1$.

    So any $||\bvec{w}||^2 \geq ||\bvec{v}_1||^2$.
\end{proof}


\documentclass{segabs}
\usepackage{mathrsfs,amsmath,url,xspace}

% An example of defining macros
\newcommand{\rs}[1]{\mathstrut\mbox{\scriptsize\rm #1}}
\newcommand{\rr}[1]{\mbox{\rm #1}}
% My equations
%-----------------------------------------------------------
\renewcommand{\div}{\nabla\cdot}
\newcommand{\grad}{\vec \nabla}
\newcommand{\curl}{{\vec \nabla}\times}
\renewcommand{\H}{{\vec H}}
\newcommand {\J}{{\vec J}}
\newcommand {\E}{{\vec E}}
\newcommand{\siginf}{\sigma_\infty}
\newcommand{\dsig}{\triangle\sigma}
\newcommand{\dcurl}{{\mathbf C}}
\newcommand{\dgrad}{{\mathbf G}}
\newcommand{\Acf}{{\mathbf A_c^f}}
\newcommand{\Ace}{{\mathbf A_c^e}}
\renewcommand{\S}{{\mathbf \Sigma}}
\newcommand{\St}{{\mathbf \Sigma_\tau}}
\newcommand{\T}{{\mathbf T}}
\newcommand{\Tt}{{\mathbf T_\tau}}
\newcommand{\diag}{\mathbf{diag}}
\newcommand{\M}{{\mathbf M}}
\newcommand{\MfMui}{{\M^f_{\mu^{-1}}}}
\newcommand{\MfMuoi}{{\M^f_{\mu_0^{-1}}}}
\newcommand{\dMfMuI}{{d_m (\M^f_{\mu^{-1}})^{-1}}}
\newcommand{\dMfMuoI}{{d_m (\M^f_{\mu_0^{-1}})^{-1}}}
\newcommand{\MeSig}{{\M^e_\sigma}}
\newcommand{\MeSigInf}{{\M^e_{\sigma_\infty}}}
\newcommand{\MeSigInfEtab}{{\M^e_{\sigma_\infty \bar{\eta}}}}
\newcommand{\MeSigInfEtat}{{\M^e_{\sigma_\infty \peta}}}
\newcommand{\MedSig}{{\M^e_{\triangle\sigma}}}
\newcommand{\MeSigO}{{\M^e_{\sigma_0}}}
\newcommand{\Me}{{\M^e}}
\newcommand{\Js}{\mathbf{J}^s}
\newcommand{\Mes}[1]{{\M^e_{#1}}}
\newcommand{\Mee}{{\M^e_e}}
\newcommand{\Mej}{{\M^e_j}}
\newcommand{\BigO}[1]{\mathcal{O}\bigl(#1\bigr)}
\newcommand{\bE}{\mathbf{E}}
\newcommand{\bEp}{\mathbf{E}^p}
\newcommand{\bB}{\mathbf{B}}
\newcommand{\bBp}{\mathbf{B}^p}
\newcommand{\bEs}{\mathbf{E}^s}
\newcommand{\bBs}{\mathbf{B}^s}
\newcommand{\bH}{\mathbf{H}}
\newcommand{\B}{\vec{B}}
\newcommand{\D}{\vec{D}}
\renewcommand{\H}{\vec{H}}
\newcommand{\s}{\vec{s}}
\newcommand{\bfJ}{\bf{J}}
\newcommand{\vecm}{\vec m}
\renewcommand{\Re}{\mathsf{Re}}
\renewcommand{\Im}{\mathsf{Im}}
\renewcommand {\j}  { {\vec j} }
\newcommand {\h}  { {\vec h} }
\renewcommand {\b}  { {\vec b} }
\newcommand {\e}  { {\vec e} }
\renewcommand {\d}  { {\vec d} }
\renewcommand {\u}  { {\vec u} }

\renewcommand {\dj}  { {\mathbf{j} } }
\renewcommand {\dh}  { {\mathbf{h} } }
\newcommand {\db}  { {\mathbf{b} } }
\newcommand {\de}  { {\mathbf{e} } }

\newcommand{\vol}{\mathbf{v}}
\newcommand{\I}{\vec{I}}
\newcommand{\A}{\mathbf{A}}
\newcommand{\bI}{\mathbf{I}}
\newcommand{\bus}{\mathbf{u}^s}
\newcommand{\brhss}{\mathbf{rhs}_s}
\newcommand{\bup}{\mathbf{u}^p}
\newcommand{\brhs}{\mathbf{rhs}}
%%-------------------------------
\newcommand{\bon}{b^{on}(t)}
\newcommand{\bp}{b^{p}}
\newcommand{\dbondt}{\frac{db^{on}(t)}{dt}}
\newcommand{\dfdt}{\frac{df(t)}{dt}}
\newcommand{\dbdt}{\frac{\partial \b}{\partial t}}
\newcommand{\dfdtdsiginf}{\frac{\partial\frac{df(t)}{dt}}{\partial\siginf}}
\newcommand{\dfdsiginf}{\frac{\partial f(t)}{\partial\siginf}}
\newcommand{\dbgdsiginf}{\frac{\partial b^{Impulse}(t)}{\partial\siginf}}
\newcommand{\digint}{\frac{2}{\pi}\int_0^{\infty}}
\newcommand{\Gbiot}{\mathbf{G}_{Biot}}
%%-------------------------------
\newcommand{\peta}{\tilde{\eta}}
\newcommand{\petadt}{\frac{\partial \tilde{\eta}}{\partial t}}
\newcommand{\eFmax}{\e^{F}_{max}}
\newcommand{\dip}{d^{IP}}
\newcommand{\sigpert}{\delta\sigma}

\newcommand{\SimPEG}{\textsc{SimPEG}\xspace}
\newcommand{\simpegEM}{\textsc{simpegEM}\xspace}

\begin{document}

\title{Moving between dimensions in electromagnetic inversions}

\renewcommand{\thefootnote}{\fnsymbol{footnote}}

\author{Seogi Kang\footnotemark[1], Rowan Cockett, Lindsey J. Heagy, \& Douglas W. Oldenburg, Geophysical Inversion Facility, University of British Columbia}

\footer{Example}
\lefthead{Kang et al.}
\righthead{Moving between dimensions in EM inversions}

\maketitle
\begin{abstract}
Electromagnetic (EM) methods are used to characterize the electrical conductivity distribution of the earth. Recently, due in part to computational advances, EM geophysical surveys are increasingly being simulated and inverted in 3D. However, the availability of computational resources does not invalidate the use of lower dimensional formulations and methods, which can be useful depending on the geological complexity as well as the survey geometry. For example, a progressive procedure can be used to invert EM data, starting with 1D inversion, then moving to multi-dimensional inversions. As such, we require a set of tools that allow a geophysicists to easily move between dimensions of the EM problem. In this study, we suggest a mapping function, which transforms the inversion model to physical property model for forward modeling. Using this general framework, we apply EM inversion with a suite of models from 1D to 3D and suggests the importance of choosing a proper model based on the task you have in the EM inversion.
\end{abstract}
\renewcommand{\figdir}{Fig} % figure directory
% In this presentation, we will share examples as well as our experience from creating a range of simulation and inversion tools for EM methods that span dimensions (1D, 2D and 3D). The flexibility and consistency in our EM package allows us to be methodical so that we have the capacity to tackle a spectrum of problems in EM geophysics.
% This is the motivation behind the open source software package \simpegEM which is part of a software ecosystem for Simulation and Parameter Estimation in Geophysics (\SimPEG).
\section{Introduction}
Using electromagnetic (EM) waves, we excite the earth and measure signals from the earth.
This signal includes conductivity distribution of the earth. By solving Maxwell's
equations, we can compute forward response of the system with known conductivity
distribution.
Using the EM inversion technique, we recover a conductivity model, which explains the
measured EM response.
This model can be discretized voxel of the 3D conductivity.
To proceed this 3D inversion, we need to compute forward response from the 3D earth.
Therefore a natural choice of the inversion model can be 3D distribution of the conductivity.
Recently, 3D EM inversion technique using gradient based optimiztion has actively been
developed and interrogated on various applications (\cite{Doug2013,Gribenko2007,Chung2014}).

The gradient based geophysical inversion technique includes several pieces in general:
uncertainty, data misfit, sensitivity, model and regularization.
Our focus in this paper is the inversion model.
In most cases, the inversion model has been considered as 3D distribution of the conductivity.
However, our model can be more general. For example, let us assume we have 3D conductivity
model for sewatuer intrusion as shown in Figure ~\ref{fig:mapping123D}.
Although physical property model can be in 3D, inversion model can be either 1D or 2D
as shown in Figure ~\ref{fig:mapping123D}.
Realization of this is possible using model mapping function, which can be defined as
\begin{equation}
  \sigma  = \mathcal{M}[m],
\end{equation}
where $\sigma$ is the electrical conductivity (S/m). This mapping function
($\mathcal{M}[\cdot]$) transforms the space from the inversion model to physical property
model. Moving our spatial dimensions from 1D to 3D or 2D to 3D can be possible using this
mapping function. On top of that, we can use a geometric function like sphere or
ellipsoid to parameterize 3D structure with few parameters (\cite{MikeParam2014}).
Implementation of this is done through \simpegEM which is part of a software ecosystem
for Simulation and Parameter Estimation in Geophysics (\cite{SimPEG}).
\simpegEM provides forward and inverse problem of EM methods in both frequency and time domain (\cite{SimPEGEM}).

In this study, we exploit seawater intrusion problem with ground loop EM survey to visit
suite of model spaces that we can use in the EM inversion. We use time domain EM (TEM)
methods. To setup a survey design, we use 1D seawater intrusion model and perform feasibility test. Based on this, we compute forward response from 3D seawater intrusion
model. 1D stitched and 2D inversion to a line profile data are going to be applied to
restore the 2D conductivity model. Using multiple line profile data, we perform 3D EM
inversion to restore 3D conductivity model. Based on the knowledge from 1D 2D and 3D inversion, parameterization of seawater intrusion model with arbitrary geometric function
is possible, and this may allow us to answer specialized question like ``where is the
interface between seawater and freshwater''.

\plot{mapping123D}{width=0.8\columnwidth}
{Conceptual diagram of 1D, 2D and 3D models for the seawater intrusion problem.}

\section*{Methodology}
EM inversion is gearing towards recovering a model, which explains measured response. EM response is governed by Maxwell's equations.  In time domain we have
\begin{equation}
  \curl \e = -\dbdt,
\end{equation}
\begin{equation}
  \curl \mu^{-1}\b -\sigma \e = \j_s,
\end{equation}
where $\e$ is electrical field, $\b$ is magnetic flux density, $\j_s$ is the source term, $\sigma$ is conductivity and $\mu$ is magnetic susceptibility.
% \begin{equation}
%   \curl \E = -\imath \omega \B,
% \end{equation}
% \begin{equation}
%   \curl \mu^{-1}\B -\sigma \E = \J_s.
% \end{equation}
We consider electrical conductivity ($\sigma$) as a physical model that we want to recover from the EM inversion, and this can be 3D distribution: $\sigma(x, y, z)$. We excite the earth by putting time varying current through source term: $\j_s$, and measure EM response form the earth on receiver locations. By discretizing above Maxwell's equations for both TD and FD, we can compute forward response, which can be simply written as
\begin{equation}
  d^{pre} = F[\sigma],
\end{equation}
where $F[\cdot]$ is Maxwell's operator and $d^{pre}$ is computed EM response on receiver locations for corresponding source.
A major goal of EM survey is to recover distribution of the conductivity. To achieve this goal, we use geophysical inversion technique based on gradient based optimization. Objective function of the inversion can be written as
\begin{equation}
  \phi(m) = \phi_d(m) + \beta\phi_m(m),
\end{equation}
where $\phi$ is the objective function, $\phi_d=\frac{1}{2}\|d^{pred}-d^{obs}\|^2_2$ is data misfit, $\phi_m$ is regularization term, $\beta$ is trade-off term between $\phi_d$ and $\phi_m$, and $m$ is the inversion model. Recalling we defined model mapping function: $\sigma = \mathcal{M}[m]$, we can transform the inversion model to conductivity in 3D. The core of the gradient based optimization is the sensitivity function:
\begin{equation}
  J = \frac{\partial F[\sigma]}{\partial m} = \frac{\partial d^{pred}}{\partial \sigma}\frac{\partial \sigma}{\partial m}.
\end{equation}
Assuming that we know how to compute $\frac{\partial F[\sigma]}{\partial \sigma}$, we can proceed EM inversion with the knowledge of derivative of the mapping function($\frac{\partial \sigma}{\partial m} = \frac{\partial \mathcal{M}(m)}{\partial m}$).
This mapping does not necessarily has to be a single function, but can be a combination of multiple functions, and computation of derivative can be defined using chain-rule. For example, conventionally in EM inversion, we use logarithmic conductivity ($m = log(\sigma)$) as our model, and we do not include air cells in our forward modeling domain. Therefore, in this case, our mapping can be expressed as a combination of two different maps:
\begin{equation}
  \sigma = \mathcal{M}_{exp}[\mathcal{M}_{active}[m]],
  \label{eq:combomap1}
\end{equation}
where $\mathcal{M}_{exp}[m]=exp(m)$ is exponential map and $\mathcal{M}_{active}[m]$ is active map. Here, the active maps transforms our model parameter, which is only defined inside of the earth:
\begin{equation}
  \sigma = \mathcal{M}_{active}[m] = Q_{active}m + m_{inactive},
\end{equation}
where $Q_{active}$ is a mapping matrix composed of 0 and 1, which maps active cells to entire cells in the domain. $m_{inactive}$ is a model for inactive cells, and this has same dimension with entire cells. Computating the derivative of mapping $w.r.t$ $m$ for these maps are straightforward. Similarly, we can have 1D or 2D maps ($\mathcal{M}_{1D}[m]$ and $\mathcal{M}_{2D}[m]$), which take 1D or 2D model and transform to 3D model. Therfore combined model with equation (\ref{eq:combomap1}), can be written as
\begin{equation}
  \sigma = \mathcal{M}_{exp}[\mathcal{M}_{1D \ or \ 2D}[\mathcal{M}_{active}[m]]].
  \label{eq:combomap2}
\end{equation}
For this case, with 1D map in vertical direction, our model can be logarithmic conductivity of subsurface layers, but the output of the combined map is 3D conductivity of the earth including air cells. Implementation of a geometircal model such as ellipsoid and arbitrary plane to the inversion is straightforward, once we have knowledge to evaluate mapping function and its derivative.

\section*{Seawater intrusion example}
In coastal area, seawater intrusion is a serious problem due to the contamination of groundwater (Figure \ref{fig:concept}). One of the key to treat this problem is to recognizing the distribution of highly saturated zone by seawater. Ground loop EM survey has been used to detect intruded seawater, because of highly conductive nature of the seawater (\cite{Mills1988}). Figure \ref{fig:concept} shows typical ground loop TEM survey geometry and hydorological model on coastal area. By putting time-varying current through the transmitter loop, we excite the earth. We use EM induction phenomenon to excite the earth in this case, which is highly sensitive to conductive structure. 3D conductivity model shown in Figure \ref{fig:sigtrue} clearly shows intruded seawater distribution in 3D. As a geophyscist, we may want to suggest possible region where we have serious seawater intrusion. Therefore, recovering conductivity distribution, which has high correlation with seawater saturation is a principal task. More specifically, interface between freshwater and seawater is an important information.
\plot{concept}{width=0.8\columnwidth}
{Conceptual diagram of sea water intrusion and geometry of ground loop EM survey.}

\plot{sigtrue}{width=1.0\columnwidth}
{Plan and section views of 3D conductivity model for seawater intrusion.}

\subsection*{Feasibility test: anomalous response}
To measure EM response from the intruded seawater, we need to design a proper survey parameter. Figure \ref{fig:geometry} shows survey geometry of ground loop EM survey. We have two circular loops, which has 250 m radius. We use simple layered earth model (1D) to make this analyses simple. Because ground loop source is circular thus, survey parameters are distance from the center of the loop ($r$) and time. We compute two forward responses due to the layered model with seawater layer and without seawater layer, and compute amplitude ratio between them. This 1D model is shown in the right panel of Figure \ref{fig:ampratio_time}. Because we measure vertical component of magnetic flux density ($b_z$), amplitude ratio that we compute can be written as $\Big|\frac{b_z[\sigma_{seawater}]|}{b_z[\sigma_{background}]}\Big|$. In the right panel of Figure \ref{fig:ampratio_time}, we provide amplitude ratio in 2D plane of which axes are time and $r$. Contours on high amplitude ratios clearly shows measured response at time range 1-10 ms are sensitive to the seawater. At the center of the loop ($r$=0), we have maximum ratio, and it decreases $r$ increases. Based on this feasibility test, we designed ground loop EM survey geometry as shown in Figure \ref{fig:geometry}, and the time range we measure EM response is 0.1-10 ms.

\plot{geometry}{width=0.8\columnwidth}
{Ground loop EM survey geometry. Blue and red color indicate corresponding Tx and Rx pairs. Black dots show a line profile data used for 1D and 2D inversion. }

\plot{ampratio_time}{width=1.0\columnwidth}
{Layered-earth model for seawater intrusion (left panel). Amplitude ratio of vertical magnetic flux density with seawater and without seawater (right panel).}

\subsection*{1D and 2D inversion}
Conventionally for ground loop EM survey, we only measure one or two profile lines of the data in the loop (CITE). And for the interpretation of this data, we use 1D inversion, which assume layered-earth structure; here 1D inversion for each datum is separate. After 1D inversion for each datum, we stitch recovered 1D conductivity model together to make a 2D-like section images. We generated synthetic ground TEM data set using conductivity model shown in Figure \ref{fig:sigtrue} with survey geometry shown in Figure \ref{fig:geometry}. Using mappting function for 1D and 2D inversion (equation (\ref{eq:combomap2})), we can proceed EM inversion. For 2D case, the forward modeling is performed in 3D, although our inversion model is in 2D. Applying same procedure to 1D stitched case is possible, but this will be expensive. We use 2D cylinderical mesh by exploiting azimuthal symmetry of the system. For this case, thus conductivity is defined on 2D mesh, although the inversion model is 1D layered-earth.
Considering typical field configuration, we only used a profile line in two loops for 1D and 2D inversions, which are expressed as black dots in Figure \ref{fig:geometry}.
Recovered 1D stitched inversion model shown on the left panel of Figure \ref{fig:1DinvTD} shows reasonable layering on the east-side. However, on the west-side we can recognize artifacts in 1D stitched inversion due to 3D effect. On the right panel of Figure \ref{fig:1DinvTD}, we have also shown recovered conductivity model from 2D inversion. This shows better horizontal resolution then 1D inversion results, whereas layering show more spreaded distribution compared to 1D case. Comparison of observed and predicted data for these 1D and 2D inversions are shown in Figure \ref{fig:1D2Dobspred}. Although both predicted data from 1D and 2D inversion results show reasonable match with the observed data, we can recognize some discrepancy between observed and predicted data, which may be caused by 3D effect that we cannot explain with 1D or 2D model.

\plot{1DinvTD}{width=1.0\columnwidth}
{Vertical sections of recovered conductivity. Left and right panel show 1D stitched and 2D inversion.}

\plot{1D2Dobspred}{width=1.0\columnwidth}
{Comparisons of observed and predicted data for 1D and 2D inversions. }

\subsection*{3D inversion}
In reality, the distribution of intruded seawater is in 3D, thus restoration of 3D conductivity model is one of the important tasks to characterize seawater intruded region in the subsurface. For 1D and 2D inversions, we used a profile line data, which were located in the loops. However, for 3D inversion, having more measurement points aside from the center line is be crucial to have reasonable sensitivity for the 3D volume. We used all receivers shown in Figure \ref{fig:geometry}. Using mapping function shown in equation \ref{eq:combomap1}, we perform 3D EM inversion. Figure \ref{fig:3DinvTD} shows plan and section views of the recovered conductivity model from the 3D inversion. Interface between fresh and seawater is nicely imaged in both horizontal and vertical directions. We fit the observed data well as shown in Figure \ref{fig:3Dobspred}. We also provide cut-off 3D volume of conductivity distribution in Figure \ref{fig:final}.

\plot{3DinvTD}{width=1.0\columnwidth}
{Plan and section views of recovered 3D conductivity.}

\plot{3Dobspred}{width=1.0\columnwidth}
{A comparison of observed and predicted response for transmitter one.}

\section*{Conclusions}
Using mapping function in our geophysical inversion, we decoupled inversion model space from physical model space. This enables us to set an arbitrary inversion model, although our forward modeling space can be in 3D. We set three different inversion models, which were 1D, 2D and 3D using mapping function, and performed TEM inversions for seawater intrusion problem. Each inversion showed reasonable recovered model based on the used mapping for each case. Although we treated limited subsets of inversion models such as 1D, 2D and 3D, general definition of mapping function that we suggested can be extended to a parametric inversion model such as geometry of interfaces. For instance, we can ask a specific question: ``where is the boundary of freshwater and seawater?'' in the EM inversion using this mapping function. We believe this separation of inversion model from physical property model will be a powerful concept in the geophysical inversion because the capability to resolve a certain geological feature of the earth system  will accelerate communications with other disciplines in geoscience.

\plot{final}{width=1.0\columnwidth}
{Cut-off 3D volume of true and recovered conductivity distribution of seawater intrusion.}

% \plot{model}{width=0.75\columnwidth, height=0.22\textheight}
% {Planal and sectional views of 3D complex conductivity model based on Cole-Cole representation. Dashed line in contours the boundary of the conductive IP body.}

% \multiplot{2}{resp_ch1,resp_ch2}{width=0.5\textwidth, height=0.18\textheight}
% {Responses of $EMIP$ (black line), $EM$ (blue line) at $t=6$ (a) and $t=24$ $ms$ (b). Top-left panels of (a) and (b) show time decay curves at center sounding location and dashed circles here show that corresponding time for other figures. Bottom pannels of (a) and (b) show that responses from all the sounding in the survey geometry at specific time channel and solid circles here indicate sounding locations. Red dashed line indicates the profile lines, which are shown at top-right panels of (a) and (b).}

\section{Acknowledgement}
Thank you for Klara Steklova for helpful discussion about hydrological problem and  \SimPEG developers. Generating 3D distribution of seawater intrusion model was performed using GIFtools.

\twocolumn
\onecolumn
% \append{The source of the bibliography}
% \verbatiminput{example.bib}
\bibliographystyle{seg}  % style file is seg.bst
\bibliography{example}

\end{document}


\documentclass{beamer}

\title{Raven Comparison Statistics}
\author{Josh Cogliati\\ (and this would not have happened without\\ Ivan Rinaldi and Cristian Rabiti.  \\Thanks also to Andrea Alfonsi and Diego Mandelli)}

\begin{document}

\begin{frame}
  \titlepage
\end{frame}

\begin{frame}
  \frametitle{Outline}
  \tableofcontents
\end{frame}

\section{Motivation}

\begin{frame}
  \frametitle{Why are we doing this?}
  We have codes that we need to compare to each other and to experiments.
\end{frame}

\begin{frame}
  \frametitle{Example}
  \includegraphics[height=6cm]{example}
\end{frame}

\section{Comparisons}

%cdf area difference
\begin{frame}
  \frametitle{CDF difference area}
  This calculates the difference in area between the two CDFs
  \begin{equation}
    cdf\_area\_difference = \int_{-\infty}^{\infty}{\|CDF_a(x)-CDF_b(x)\|dx}
  \end{equation}
  \begin{columns}
    \column{.5\textwidth}
    \includegraphics[height=3cm]{example_cdf_area}
    \column{.5\textwidth}
    Note that this area will have the same units as x.
  \end{columns}
\end{frame}

%common pdf area
\begin{frame}
  \frametitle{Common PDF area}
  This calculates the common area between the two PDFs.
  \begin{equation}
    pdf\_common\_area = \int_{-\infty}^{\infty}{\min(PDF_a(x),PDF_b(x))}dx
  \end{equation}
  \begin{columns}
    \column{.5\textwidth}
    \includegraphics[height=3cm]{example_pdf_common}
    \column{.5\textwidth}
    This will range from 0\% to 100\%, with 100\% being a complete match.
  \end{columns}
\end{frame}

%difference between pdfs
\begin{frame}
  \frametitle{Difference between PDFs}
  This calculates a difference between the PDFs.
  \begin{equation}
    f_Z(z) = \int_{-\infty}^{\infty}f_X(x)f_Y(x-z)dx
  \end{equation}
  \begin{columns}
    \column{0.5\textwidth}
    \includegraphics[height=3cm]{f_z}
    \column{0.5\textwidth}
    This generates a new pdf, with mean related
    to the average difference, and variance depending on a variety of
    factors.
  \end{columns}
\end{frame}

\begin{frame}
  \frametitle{Use of Differences between PDFs}
  This calculates the average:
  \begin{equation}
    \bar{z} = \int_{-\infty}^{\infty}{z f_Z(z)dz}
  \end{equation}
  This calculates the variance:
  \begin{equation}
    var = \int_{-\infty}^{\infty}{(z-\bar{z})^2 f_Z(z)dz}
  \end{equation}
\end{frame}

\section{Implementation}

%getting bins
\begin{frame}
  \frametitle{Getting the Numeric CDF and PDF}
  \begin{enumerate}
  \item Get the data and sort it
  \item Choose bins boundaries, and count the number of points in each bin
  \item Normalize the number of bins, and then calculate the running total to get the CDF
  \item Take the derivative of the CDF to get the PDF.
  \end{enumerate}
\end{frame}

%creating interpolation functions
\begin{frame}
  \frametitle{Interpolation functions}
  \begin{itemize}
  \item Using scipy's intererpolate.interp1d with the numeric data
  \item For the pdf, force the numbers outside the data to be zero
  \item For the cdf, force the numbers lower that the data to zero and higher to one
  \end{itemize}
\end{frame}

%integrating
\begin{frame}
  \frametitle{Integrating functions}
  \begin{itemize}
  \item Use Simpson method for calculating numbers
  \item For the pdfs and cdfs, use $-3\sigma+\mu$ to $3\sigma+\mu$ as
    the bounds (and the min and max of these if there are multiple
    ones)
  \item For the $f_Z$, the midpoint is $\mu_X-\mu_Y$ and the lower and
    upper bounds are $3\sigma_{max}$ away (where the largest $\sigma$
    is used).
  \end{itemize}
\end{frame}

\section{Future Directions}

\begin{frame}
  \frametitle{Future things to do}
  \begin{itemize}
  \item Multidimensional data
  \item Correlated data (input and output correlated)
  \item Flexibility for statistics (plugins or interfaces)
  \end{itemize}
\end{frame}

\section{Comments}

\begin{frame}
  \frametitle{Comments, complaints, concerns, contraindications, contributions \ldots ?}
\end{frame}

\end{document}


\chapter{Formalism}
\label{chap:cpv:theory}

The measurement of \ARaw, as defined in \cref{eqn:cpv:introduction:araw}, can
be contaminated by production and detection asymmetries.
By reconstructing \LcTopKK\ and \LcToppipi\ decays from
\decay{\PLambdab}{\PLambdac\Pmuon X}\ decays, \ARaw\ can include the effects of
the \PLambdab/\APLambdab\ production asymmetry, the \Pmuon/\APmuon detection
asymmetry, and the detection asymmetry of the \PLambdac\ final state
$f$/$\bar{f}$.

The \PLambdab\ production asymmetry is predicted to be non-zero due to the \pp\
collision environment~\cite{PhysRevD.90.014023}, and indeed \lhcb\ has found
evidence of such an asymmetry as a function of \PLambdab\
rapidity~\cite{Aaij:2015fea}.
The two detection asymmetries are also expected to be non-zero, due to the
known differences between the hadron/anti-hadron and muon/anti-muon
cross-sections with matter~\cite{PDG2014}.
The final state detection asymmetry can be broken down into two terms: one due
to the detection asymmetry of the proton; and another due to the detection
asymmetry of the \KmKp pair and the \pimpip\ pair.
If the meson kinematics are equal within a given mode, for example if the
\PKminus kinematics are identical to those of the \PKplus\ in the \pKK\ data,
then the final state asymmetry reduces to the proton detection asymmetry.

Both the \PLambdab\ production and the muon detection asymmetries should be
independent of the \PLambdac\ final state, given the same \PLambdac\
kinematics.
Different acceptance efficiencies between \pKK\ and \ppipi\ can create unequal
\PLambdac\ kinematics, but the kinematics can be weighted to equalise them
between the modes.

It will now be shown how the background asymmetries entering \ARaw\ can be
removed in the difference \dACP\@.
The number of reconstructed \LcTof\ decays can be expressed as the product of
several effective probabilities
\begin{equation}
  N(f) = \prob(\PLambdab)\cdot
         \Gamma(\LbToLcmuX)\cdot
         \Gamma(\LcTof)\cdot
         \eff(\Pmuon)\cdot
         \eff(f),
  \label{eqn:cpv:theory:yield}
\end{equation}
where $\prob(\PLambdab)$ is the probability of producing a $\PLambdab$ baryon
given a \pp\ collision, and $\eff(\Pmuon)$ and $\eff(f)$ are the muon and
$\PLambdac$ final-state detection efficiencies.
A similar expression exists for $N(\bar{f})$, where are particles are replaced
by their charge conjugates.
It is assumed that the \LbToLcmuX\ decay is \CP-symmetric, but that all other
factors may not be, for example $\eff(\Pmuon) \neq \eff(\APmuon)$.

To express \ARaw\ in terms of its component asymmetries, the notation of a
general asymmetry parameter $X$ is defined, which describes the asymmetry
between two quantities $x$ and $\bar{x}$
\begin{equation}
  X = \frac{x - \bar{x}}{x + \bar{x}}.
  \label{eqn:cpv:theory:generic_asym}
\end{equation}
This can be rearranged as
\begin{align}
  x &= \frac{1}{2}(x + \bar{x})(1 + X),\ \text{and}\label{eqn:cpv:theory:asym_form_one}\\
  \bar{x} &= \frac{1}{2}(x + \bar{x})(1 - X).\label{eqn:cpv:theory:asym_form_two}
\end{align}
An asymmetry parameter like that in \cref{eqn:cpv:theory:generic_asym} can be defined for each of the relevant terms in
\cref{eqn:cpv:theory:yield}
\begin{align*}
  \APLb(f) &= \frac{%
    \prob(\PLambdab) - \prob(\APLambdab)
  }{%
    \prob(\PLambdab) + \prob(\APLambdab)
  },\\
  \ADmu(f) &= \frac{%
    \eff(\Pmuon) - \eff(\APmuon)
  }{%
    \eff(\Pmuon) + \eff(\APmuon)
  },\ \text{and}\\
  \ADf(f)  &= \frac{%
    \eff(f) - \eff(\bar{f})
  }{%
    \eff(f) + \eff(\bar{f})
  },
\end{align*}
and the asymmetry in $\Gamma(\LcTof)$ is \ACP\ as in
\cref{eqn:cpv:introduction:acp}.
Each parameter is, at least implicitly, dependent on the detected \PLambdac\
final state, as each parameter can vary in quantities that may also vary
between \PLambdac\ decay modes.
Substituting Equation~\ref{eqn:cpv:theory:yield} into
Equation~\ref{eqn:cpv:introduction:araw}
\begin{equation*}
  \ARaw(f) = \frac{%
    \prob(\PLambdab)\Gamma(f)\eff(\Pmuon)\eff(f) -
    \prob(\APLambdab)\Gamma(\bar{f})\eff(\APmuon)\eff(\bar{f})
  }{%
    \prob(\PLambdab)\Gamma(f)\eff(\Pmuon)\eff(f) +
    \prob(\APLambdab)\Gamma(\bar{f})\eff(\APmuon)\eff(\bar{f})
  },
\end{equation*}
and then substituting each quantity for its equivalent form as in
\cref{eqn:cpv:theory:asym_form_one,eqn:cpv:theory:asym_form_two}, all factors
of $\sfrac{1}{2}$ and all factors of the form $(x - \bar{x})$ cancel, leaving
\begin{equation}
  \ARaw(f) = \frac{Y}{Z}.
\end{equation}
where (dropping the final state parameter temporarily for compactness)
\begin{align}
  Y = \APLb\ADmu\ADf &+ \APLb\ADmu\ACP + \APLb\ADf\ACP + \ADmu\ADf\ACP \nonumber\\
                     &+ \APLb +  \ADmu + \ADf + \ACP,
\end{align}
and
\begin{align}
  Z = 1 &+ \APLb\ADmu + \APLb\ADf + \APLb\ACP + \ADmu\ADf + \ADmu\ACP \nonumber\\
        &+ \ADf\ACP + \APLb\ADmu\ADf\ACP.
\end{align}
Assuming that the individual asymmetries are small, of the order of
\SI{1}{\percent}, the product of two or more asymmetries is negligible with
respect to the leading order, and so
\begin{equation}
  \ARaw(f) \approx \ACP(f) + \APLb(f) + \ADmu(f) + \ADf(f).
  \label{eqn:cpv:theory:araw_approx}
\end{equation}
By assuming that these background asymmetries are mode-independent, that is to
say $\AD(f) = \AD(g)$ and $\AP(f) = \AP(g)$, the difference between \ARaw\ for
the \pKK\ and \ppipi\ will only have contributions from \ACP
\begin{align}
  \dACP &= \ARaw(\pKK) - \ARaw(\ppipi),\label{eqn:cpv:theory:dacp}\\
        &\approx \ACP(\pKK) - \ACP(\ppipi)\nonumber.
\end{align}

The assumption that the production and detection asymmetries in
\cref{eqn:cpv:theory:araw_approx} are mode independent is not true in general.
This can been seen by first making a weaker assumption that the background
asymmetries are dependent only on the kinematics of the representative
particles.
Different final states will in general have different acceptance,
reconstruction and selection efficiencies as a function of \PLambdac\
kinematics.
The kinematics of the \PLambdac\ are correlated to those of the muon and the
\PLambdab, and so two samples with different \PLambdac\ kinematics will likely
also have different \PLambdab\ and muon kinematics.
Hence, there can still be net production and detection asymmetries in \dACP\@.

The assumption that the background asymmetries depend only on particle
kinematics is not unreasonable.
The production asymmetry, for example, is a difference in cross-sections, which
are usually parameterised by the kinematics of the produced particle (\pT\ and
either \Eta\ or rapidity).
Similarly, a detection asymmetry describes the differences of material
interactions between matter and antimatter, and these are dependent on the
momentum of the particle in question and, assuming a non-uniform material
distribution, its flight path.

As it is not given that the \PLambdac\ kinematics are the same between
\LcTopKK\ and \LcToppipi\ decays in the data, the data can be weighted to
equalise the \PLambdac\ kinematics.
The background asymmetries \AP\ and \ADmu\ will then cancel in the difference
\dACP\@.
The proton kinematics will not necessarily agree after such a weighting, as the
energy release in the \pKK\ and \ppipi\ decays is different.
These considerations govern the analysis strategy: measure the number of
\PLambdac\ candidates in the \pKK\ and \ppipi\ samples after weighting them
such that the \PLambdac\ kinematics look alike, such that the \PLambdab\ and
\Pmuon kinematics also agree.
Additional weighting may be required to equalise the proton kinematics.

\section{Decay phase space}
\label{chap:cpv:theory:phsp}

The phase space of a decay is the set of variables which fully parameterises
all possible dynamics.
Although a three-body decay requires 12 parameters to describe the kinematics,
under the assumptions of four-momentum conservation and that the masses of the
three decay products are known, the number of free parameters is only five.
When all particles involved have zero spin, the distribution of the momenta of
the decay products is isotropic, such that there are only 2 degrees of freedom.
These are usually taken to be two child-pair squared masses, which can be
visualised as a Dalitz plot.
In the case of \LcTophh, the spin \sfrac{1}{2} of the proton means that the
three-body system is no longer rotationally symmetric, and the full five
degrees of freedom are required to describe the phase space.

For a meaningful comparison of the measurement of \dACP\ with theoretical
predictions, which are not presently available, the efficiency of the
\PLambdac\ selection across the five-dimensional phase space must be known.
The definition of ``selection'' includes the effects of the \lhcb\ acceptance
and the trigger, stripping, and offline requirements.
The efficiency model can either be provided to theorists so that they can apply
the same efficiencies to their phase space models, or it can be used to correct
the data before the \dACP\ measurement is made.

The five dimensions of the phase space are defined here in a similar way to the
\LcTopKpi\ amplitude analysis performed by the \esno\
collaboration~\cite{Aitala:1999uq}.
This defines two child-pair squared masses, of the proton and
oppositely-charged child \msqphm\ and of the two opposite-sign pseudo-scalars
\msqhh, and three decay angles.
The child-pair squared masses are invariant under Lorentz transformations, but
the decay angles are not and so a definition of the frame in which they are
computed is required.

The \esno\ analysis defines a coordinate system in the \PLambdac\ rest frame.
The $z$-axis, also called the quantisation axis or polarisation axis \polzlcp,
is perpendicular to the plane of production
\begin{equation}
  z = \polzlcp = \phatbeam \times \phatlcp,
\end{equation}
where \phatbeam\ is the direction of the beam\footnotemark\ and \phatlcp\ is
the direction of the \PLambdac\ measured in the laboratory frame.
\footnotetext{%
  E791 was a fixed-target experiment, colliding a \SI{500}{\GeVc} pion beam
  with metal foils.
}
The $x$-axis of the \PLambdac\ rest frame is \phatlcp.
As the \PLambdac\ candidates in this analysis are not produced directly from
the \pp\ collision but in the decays of \PLambdab\ baryons, here the `beam
direction' is defined as the direction of the \PLambdab\ momentum vector, which
is equal to the direction vector pointing from the \pp\ primary vertex
$v_{\pp}$ to the $\PLambdac\Pmuon$ vertex $v_{\PLambdac\Pmuon}$
\begin{equation}
  \phatbeam = \phatlbz = v_{\PLambdac\Pmuon} - v_{\pp}.
\end{equation}
With this coordinate system and inertial frame, the three decay angles are
defined as:
\begin{enumerate}
  \item The angle \thetap\ between the proton momentum vector and the $z$-axis;
  \item The angle \phip\ between the proton momentum vector and the $x$-axis;
    and
  \item The angle \phihh\ between the plane containing the proton momentum
    vector and the $z$-axis and the plane containing the two pseudo-scalar
    meson momentum vectors.
\end{enumerate}
These definitions are illustrated in \cref{fig:cpv:theory:phsp:angles}

The distributions of the five phase space variables will be presented in
\cref{chap:cpv:phsp}, along with the evaluation of the efficiency as a function
of the position in phase space.

\begin{figure}
  \begin{subfigure}{0.5\textwidth}
    \resizebox{\textwidth}{!}{%
      \input{figures/cpv/theory/phase_space_angles}
    }
  \end{subfigure}
  \begin{subfigure}{0.5\textwidth}
    \resizebox{\textwidth}{!}{%
      \input{figures/cpv/theory/phase_space_planes}
    }
  \end{subfigure}
  \caption{%
    Definition of inertial reference frame axes and \LcTophh\ phase space decay
    angles.
    Adapted from Figure~1 in the \esno\ \LcTopKpi\ amplitude analysis
    paper~\cite{Aitala:1999uq}.
  }
  \label{fig:cpv:theory:phsp:angles}
\end{figure}


\subsection{Analysis of Rapid Environmental Fluctuations}
In this article, to analyze the interaction of the mixed growth of multiple fungi, we establish Multi-groups Logistic Model. However, we do not make a detailed analysis of the environmental changes. Hence, we are going to examine the sensitivity of our model to rapid fluctuations in the environment.
\par
In the real natural environment, disasters that are not conducive to the survival and reproduction of living things happen from time to time. When a disaster occurs, the natural environment fluctuates rapidly, and the survival of organisms in the area is threatened and restricted. Combining our model and the characteristics of fungi, we find that when the environment fluctuates rapidly, the inherent growth rate of fungi will change rapidly in a short time. Meanwhile, the natural maximum capacity of fungi will be reduced accordingly.


\chapter{Introduction}
\label{chap:introduction}

\section{Motivation and the research needs}
Boolean satisfiability (SAT)~\cite{SATHandbook} has been successfully applied to numerous research fields
including artificial intelligence~\cite{Nilsson2014,Russell2020},
electronic design automation~\cite{Marques2000,Wang2009},
software verification~\cite{Jhala2009, Berard2013}, etc.
The tremendous benefits have encouraged the development of more advanced decision procedures
for satisfiability with respect to more complex logics beyond pure propositional.
For example,
solvers for majority SAT (MAJSAT) decide whether the majority of the assignments satisfy a propositional formula,
and its functional problem is known as model counting~\cite{SATHandbook-ModelCounting};
quantified Boolean formula (QBF)~\cite{Narizzano2006,SATHandbook-QBF} allows both existential and universal quantifiers;
stochastic Boolean satisfiability (SSAT)~\cite{Littman2001,SATHandbook-SSAT} models uncertainty with randomized quantification;
dependency QBF (DQBF)~\cite{Balabanov2014,Scholl2018} equips Henkin quantifiers to describe multi-player games with partial information;
and solvers of the satisfiability modulo theories (SMT)~\cite{Moura2011,HBMC-SMT} accommodate first order logic fragments.
Due to their simplicity and generality,
various satisfiability formulations are under active investigation.

Among various generalizations of Boolean satisfiability,
\textit{stochastic Boolean satisfiability} (SSAT)~\cite{SATHandbook-SSAT} is a logical formalism
for problems endowed with randomness.
First formulated by Papadimitriou,
SSAT is interpreted as \textit{games against nature}~\cite{Papadimitriou1985}.
Nondeterministic factors are introduced into the world of propositional logic
through the creation of the \textit{randomized quantifier}.
A Boolean variable $x$ can be randomly quantified with a probability $p\in[0,1]$ in an SSAT formula
by a randomized quantifier $\random{p}$ that requires $x$ to take the Boolean value
\true with probability $p$ and
\false with probability $1-p$.
Via randomized quantifiers,
a variety of computational problems inherent with uncertainty can be encoded into SSAT formulas,
such as propositional probabilistic planning~\cite{Littman1998},
Bayesian-network inference~\cite{Cooper1990,Jensen1996,Bacchus2003},
and the analysis of partially observable Markov decision process (POMDP)~\cite{Majercik2003}.

While SSAT has been employed to solve various AI problems,
to the best of our knowledge,
it has not yet been applied to analyze VLSI systems,
and how VLSI systems would benefit from the probabilistic reasoning of SSAT remains unclear.
Conventionally, uncertain system behavior is undesirable and
would be mitigated by employing techniques such as
error detection~\cite{Constantinescu2003} and error correction~\cite{Mitra2006}.
Nevertheless, in the post-Moore's era,
the variability and uncertainty of manufacturing at the atomic level
make devices under miniaturization sensitive to process variation and environmental fluctuation.
As a result, the manufactured ICs may exhibit uncertain probabilistic behavior,
which imposes serious challenges to the design of reliable systems.

Recent research efforts have been made to accept the inevitable imperfection of devices
based on the notions of \textit{approximate design} and \textit{probabilistic design}.
In both notions, a system's behavior may deviate from its expected specification;
however, this deviation is deterministic in the former case but probabilistic in the latter case.
Despite the advancements made by prior endeavors,
the analysis and synthesis of probabilistic design have gained relatively less attention.
Hence,
\textbf{there is a research need of a framework to evaluate probabilistic design},
and SSAT stands up as a suitable logical formalism to address the need.
(In the following,
the term ``design'' is used as a general term to refer to a single design instance,
a set of design instances,
or design process;
the term ``synthesis" is referred to as the design automation process
transforming a system under design from high-level system specification to low-level circuit implementation.)

SSAT is closely related to two generalizations of Boolean satisfiability:
\textit{model counting} of propositional formulas and \textit{quantified Boolean formulas} (QBFs).
Given a propositional formula, model counting asks to compute the number of its satisfying assignments.
In the weighted version, weights are assigned to the Boolean variables in the formula,
and the goal is to compute the summation of weights of the satisfying assignments.
Algorithms for model counting are under active development in recent years.
In addition to \textit{exact} model counting~\cite{Sang2004,Sang2005ModelCounting},
\textit{approximate} model counting~\cite{Gomes2006,Gomes2007,Chakraborty2016}
has been investigated to improve scalability by relaxing exactness.
On the other hand, from the perspective of the computational complexity,
solving an SSAT formula lies in the PSPACE-complete~\cite{Stockmeyer1973} complexity class,
the same as solving a QBF.
Many endeavors have been invested in the algorithmic improvement~\cite{SATHandbook-QBF}
and solver evaluation~\cite{Narizzano2006} for QBF.

Nevertheless, in spite of its broad applications and profound theoretical values,
SSAT has drawn relatively little attention compared to SAT, model counting, or QBF.
Most prior efforts for SSAT solving are based on the conventional
Davis-Putnam-Logemann-Loveland (DPLL) search~\cite{Davis1962},
which suffers from the scalability issue when problem sizes grow.
Therefore, \textbf{there is a research need to develop novel algorithms to enhance the scalability of SSAT solving},
and the recent advancements of SAT/QBF solving and model counting can be leveraged to help the algorithm design.

In spite of its rich expressiveness to encode problems ranging from AI to VLSI,
SSAT is limited by its descriptive power within the PSPACE complexity class.
More complex problems with nondeterminism might not be succinctly modeled as SSAT formulas.
As a result, \textbf{there is a research need of a logical formalism for problems beyond PSPACE and with uncertainty.}

Finally, most research work regarding SSAT solving was done
before the year 2010~\cite{Majercik1998,Majercik2003,Majercik2004,Majercik2005,Teige2010,SATHandbook-SSAT}.
Open-source implementations and SSAT instances for testing are barely available,
which hinder the understanding of the algorithmic details and empirical solver comparison.
Consequently, \textbf{there is a need to provide open-source implementations and databases of SSAT instances to facilitate convenient evaluation of different algorithms and drive further advancements.}

\section{Our contributions}
\begin{figure}[t]
      \centering
      \includegraphics{fig/build/nutshell.pdf}
      \caption{The contributions of this dissertation in a nutshell}
      \label{fig:intro-nutshell}
\end{figure}

This dissertation aims at contributing to the aforementioned research needs.
Our achievements positioned in the hierarchy of various complexity classes beyond NP are visualized in~\cref{fig:intro-nutshell}.
In a nutshell, we investigate the application of SSAT to VLSI analysis,
leverage the advancements of SAT, MAJSAT, and QBF to design new decision procedures for SSAT,
and combine SSAT and DQBF to propose a new formulation, called DSSAT, for NEXPTIME problems with uncertainty.
In the following, we will explain each contribution in more detail.

First, we approach the analysis of probabilistic design by
formalizing the problem of \textit{probabilistic property evaluation}.
Different computational solutions are provided for the problem.
Particularly, random-exist and exist-random quantified SSAT formulas are exploited
to solve the average-case and worst-case analyses, respectively.
To the best of our knowledge,
this is the first attempt that analyzes VLSI systems with SSAT.
(In the following,
the terms ``analysis'' and ``evaluation'' are used interchangeably as general terms
referring to the process of determining qualitative or quantitative properties of a design.
We will formulate the problem of \textit{probabilistic property evaluation},
and refer to the term ``evaluation" as computing the satisfying probability of
certain properties of a probabilistic design.)

Second, in contrast to the previous DPLL-based algorithms,
we utilize modern techniques of SAT/QBF solving and model counting to improve SSAT solving.
Motivated by the new VLSI applications,
we focus on random-exist and exist-random quantified fragments of SSAT formulas.

The random-exist quantified SSAT formula is of the form $\Qf=\random{}X,\exists Y.\pf$,
which is the counterpart of the forall-exist QBF.
It has applications in Bayesian-network inference~\cite{Cooper1990,Bacchus2003}.
We propose an algorithm that uses modern SAT solvers~\cite{Een2003Solver,Een2003Incremental} as plug-in engines.
In addition to SAT solving,
we also incorporate weighted model counting,
which has been widely used in probabilistic inference~\cite{Sang2005BayesianInference,Chavira2008},
to tackle randomized quantifiers.
The randomized quantification in an SSAT formula can be approached with weighted model counting
by assigning the weight of a variable quantified by $\random{p}$ to be $p$.
The proposed algorithm uses an SAT solver and a model counter in a \textit{stand-alone} manner,
leaving the internal structures of these solvers intact.
Due to the stand-alone usage of these solvers,
the proposed algorithm may directly benefit from the advancement of the solvers without any modification.

The exist-random quantified SSAT formulas has the form $\Qf=\exists X,\random{}Y.\pf$,
which is also known as \textit{E-MAJSAT}~\cite{Littman1998}.
Computational problems, such as computing a maximum-a-posteriori (MAP) hypothesis or
a maximum-expected-utility (MEU) solution~\cite{Dechter1998} in Bayesian networks,
and searching an optimal plan for probabilistic conformant planning domains~\cite{Littman1998},
can be formulated with E-MAJSAT.
Inspired by the \textit{clause-selection}~\cite{Janota2015,Rabe2015} technique,
which is recently devised for QBF solving and becomes the state-of-the-art,
we propose a learning method based on the \textit{clause-containment principle} to solve E-MAJSAT.
To the best of our knowledge,
this is the first attempt to adopt QBF approaches for SSAT solving.

Moreover, the proposed algorithms solve an SSAT formula in a gradual manner
that converges from approximate bounds of the satisfying probability to the exact answer.
Therefore, they are able to provide useful information even if the exact answer is unavailable (e.g., due to limited computational resources).

Third, to provide a logical formalism for more complex problems with uncertainty,
we extend \textit{dependency QBF} (DQBF)~\cite{Balabanov2014,Scholl2018} to the stochastic domain
in view of the close relation between QBF and SSAT.
DQBF is a representative problem in the NEXPTIME-complete~\cite{Peterson2001} complexity class.
It equips QBF with Henkin quantifiers to describe multi-player games with partial information.
We formalize the problem of \textit{dependency SSAT} (DSSAT) as a generalization for SSAT.
We prove that DSSAT has the same NEXPTIME-complete complexity as DQBF,
and therefore it can succinctly encode decision problems with uncertainty in the NEXPTIME complexity class.
We demonstrate the potential applications of DSSAT to the synthesis of probabilistic and approximate design and the encoding of decentralized POMDP (Dec-POMDP)~\cite{Oliehoek2016} problems.
Our theoretical results would encourage the solver development.

Fourth, our implementation of the proposed SSAT algorithms
and formula instances used in the experiments are open-source,
which will help other researchers to understand the details of the approaches and
facilitate convenient empirical evaluation of different algorithms.

\section{An overview of the dissertation}
The structure of this dissertation is outlined as follows.
\begin{itemize}
      \item
            In~\cref{chap:related-work}, a brief survey of the literature is provided to highlight the advancements made in this dissertation.
      \item
            In~\cref{chap:background}, background knowledge required throughout the dissertation is discussed.
            Specific material for an individual chapter will be introduced when it is needed.
      \item
            In~\cref{chap:prob-design-eval}, a formal framework to evaluate properties of probabilistic design is proposed.
            Especially, random-exist and exist-random quantified SSAT formulas are exploited to solve the formulation.
            This chapter is based on our conference paper~\cite{LeeICCAD14ProbDesign} published at ICCAD\,'14 and journal paper~\cite{LeeTC18ProbDesign} published in IEEE Transactions on Computers.
      \item
            In~\cref{chap:random-exist-ssat}, modern SAT-solving and model-counting techniques are combined to solve random-exist quantified SSAT formulas.
            This chapter is based on our conference paper~\cite{LeeIJCAI17RESSAT} published at IJCAI\,'17.
      \item
            In~\cref{chap:exist-random-ssat}, a clause-learning technique inspired by \textit{clause selection}, a prevailing method recently invented for QBF, is devised to solve exist-random quantified SSAT formulas.
            This chapter is based on our conference paper~\cite{LeeIJCAI18ERSSAT} published at IJCAI\,'18.
      \item
            In~\cref{chap:dependency-ssat}, SSAT is lifted from the PSPACE-complete complexity class to the NEXPTIME-completeness.
            We show the applicability of the lifted formalism to the analysis of probabilistic design and decentralized POMDP.
            This chapter is based on our conference paper~\cite{LeeAAAI21DSSAT} published at AAAI\,'21.
      \item
            In~\cref{chap:conclusion-future-work}, we give concluding remarks and point out some potential directions for future investigation.
\end{itemize}

\section{Data availability statement}
To improve the reproducibility of the results presented in this dissertation,
we provide a reproduction package on Zenodo~\cite{dissertation-artifact},
including the source code of the proposed solvers,
the pre-compiled binaries of the evaluated tools,
the used benchmark sets,
the scripts to perform experiments,
and the raw data generated from our experiments.
Current versions of the proposed SSAT solvers are available at~\url{\ssatabcurl}.
The collection of SSAT instances is hosted at~\url{\ssatbenchmarkurl}.
The \LaTeX~code for this dissertation as well as the slides used in the oral defense is also made public at~\url{\thesisurl}.