\documentclass[12pt]{article}

\usepackage[utf8]{inputenc}

\usepackage{amsmath,amsthm,amssymb}
\usepackage{mathrsfs}
\usepackage{authblk}

\theoremstyle{plain}
\newtheorem{theorem}{Theorem}
\newtheorem{lemma}{Lemma}
\newtheorem{proposition}{Proposition}
\theoremstyle{definition}
\newtheorem{corollary}{Corollary}
\theoremstyle{remark}
\newtheorem{remark}{Remark}
\newtheorem*{remark*}{Remark}

\numberwithin{equation}{section}

\usepackage[margin=25mm]{geometry}

\usepackage{fancyhdr}
\rfoot{\thepage}

\begin{document}

\title{Stable subspaces of positive maps of matrix algebras}

\author[1]{Marek Miller\thanks{marek.miller@ift.uni.wroc.pl}}
\author[1]{Robert Olkiewicz\thanks{robert.olkiewicz@ift.uni.wroc.pl}}
\affil[1]{Institute of Theoretical Physics, Uniwersytet Wroc{\l}awski, Poland}

\date{}

\maketitle

% Abstract and Introduction
\abstract{
We study stable subspaces of positive extremal maps of finite dimensional
matrix algebras that preserve trace and matrix identity
(so-called bistochastic maps).
We have established the existence of the isometric-sweeping
decomposition for such maps.
As the main result of the paper,
we have shown that all extremal bistochastic maps
acting on the algebra of matrices of size 3x3
fall into one of the three possible categories,
depending on the form of the stable subspace of
the isometric-sweeping decomposition.
Our example of an extremal atomic positive map
seems to be the first one that handles the case
of that subspace being non-trivial.
Lastly, we compute the entanglement witness associated with the extremal map
and specify a large family of entangled states detected by it.

\vspace{0.1cm}
{\scriptsize \noindent \textbf{Keywords.}
positive maps, extremal, exposed, atomic,
entanglement witness
}

{\scriptsize \noindent \textbf{MSC2010 codes.}
47H07  15B48  81P40}
}

\section*{Introduction}
\label{sec:Introduction}

\paragraph{}
Positive maps of operator algebras is an increasingly
popular subject of research,
both as a mathematical theory interesting in itself,
as well as a prominent domain of applications to quantum theory
\cite{stormer2013positive}.
Started in the pioneering work of Kadison
\cite{kadison1952generalized},
and Stinespring
\cite{stinespring1955positive},
the theory reached its first major breakthrough,
when St{\o}rmer and Woronowicz presented a structure theorem
for positive maps of low dimensional matrix algebras
\cite{stormer1963positive,woronowicz1976positive}.
It is also necessary to mention the work of \mbox{M.-D.\,Choi} here,
as the major contribution to the theory at every stage
\mbox{\cite{choi1975completely,choi1980some,choi1977extremal}}.
The second turning point came in 1990s,
when Peres and P.\,M.\,R.\,Horodeckis pointed out at the intrinsic relation
between separable states of composite quantum systems
and positive maps of algebras of observables
\cite{peres1996separability,horodecki1996separability}.
It turns out that there is a one-to-one correspondence between
positive maps and entanglement witnesses
\cite{chruscinski2014entanglement},
and the Peres-Horodecki criterion,
whether a quantum state is separable,
is computationally feasible as long as a structure theorem
similar to that proven by St{\o}rmer and Woronowicz holds true.
Unfortunately,
whereas that correspondence does exists even for
the most general infinite-dimensional quantum systems
\mbox{\cite{stormer2009separable,miller2014horodeckis}},
higher dimensional situation lacks
the complete description of positive maps
and one needs a deeper understanding of their highly nontrivial structure.
Because the set of positive maps forms a convex cone,
its elements can be characterised as convex combinations of extremal ones.
This is a consequence of the celebrated Krein-Milman theorem
\cite{krein1940extreme}, as for every positive number $r > 0$,
the set of positive maps such that their operator norm: $||S|| \leq r$,
is compact.
This is certainly true for maps on finite-dimensional matrix algebras,
but applies also to the general setting of von Neumann algebras \cite{miller2014horodeckis}.
Despite considerable effort,
examples of extremal positive maps,
even in the low-dimensional case,
are scarce
\cite{choi1977extremal,osaka1992class,ha2011entanglement,chruscinski2011exposed}.
In this paper, we deal exclusively with extremal maps as extreme points in
the cone of all positive maps on matrix algebras (see below).

In order to facilitate the further study of extremal positive maps,
we propose to take a closer look at their stable subspaces.
In general, by a 'stable subspace' of a positive map
$S \! : M_{n} \rightarrow M_{n}$,
where $M_{n}$ stands for the algebra of square complex matrices
of size $n$,
we mean a particular subspace $K_{S} \subset M_{n}$
(in fact, a JB$^{*}$-algebra, see
\mbox{Corollary \ref{cor:KisJordanAlgebra}}
below),
such that the map is a Jordan automorphism on $K_{S}$ and
$S^{k} \rightarrow 0$ strongly
on the orthogonal complement of $K_{S}$,
as $k \rightarrow \infty$
(see the more precise definition below).
We say that the map $S$ is strongly ergodic,
if $K_{S}$ is isomorphic to the set of complex numbers.
Adapting the previous results in this matter from
\cite{olkiewicz1999environment},
we establish the existence of the isometric-sweeping
decomposition for a positive map that preserves trace and
the matrix identity
(so-called bistochastic maps).
Such decomposition says precisely that $S$ must be
a Jordan automorphism of $K_{S}$,
and its powers tend strongly to $0$ for any matrix orthogonal to $K_{S}$.
What is interesting in this respect,
is that if we narrow our interest to the maps acting on $M_{3}$,
it turns out that there are only three possible
forms the algebra $K_{S}$ can have.
Moreover, it seems that all previously known examples of extremal positive
maps of $M_{3}$ fall into only two of the three possible categories:
in particular,
it is easy to see that for a Jordan automorphism $S(A) = U^{*} A \, U$,
or $S(A) = U^{*} A^{t} \, U$,
where $U$ is unitary,
$K_{S} = M_{3}$;
whereas the Choi map
\cite{osaka1992class,choi1977extremal}
is strongly ergodic.
The remaining possibility among those three,
namely the two dimensional commutative subalgebra,
requires from us to expand on an example of a positive map
that cannot be classified as belonging to one of the types
previously encountered in the literature.
One of the main results of this paper is the proof
that the map provided by us as the example is indeed extremal and atomic
\cite{ha1998atomic}.
Moreover, we show that the map is also exposed.
This fact gives immediately a useful entanglement witness
that the authors hope could serve as a prototypic case in further study
of the entanglement of three-level quantum systems
\cite{bertlmann2005optimal,caves2000qutrit}.

The structure of the paper is as follows.
In Section \ref{sec:Preliminaries},
we introduce some basic notions and notation.
In Section \ref{sec:Decomposition},
following \cite{olkiewicz1999environment},
we establish the existence of the isometric-sweeping
decomposition of bistochastic maps of finite dimensional
matrix algebra $M_{n}$.
Next, in Section \ref{sec:ExtremalMaps},
we provide the main result of this paper and prove that
for bistochastic map of $M_{3}$
the stable subspace of the decomposition takes only one of three
possible forms.
We end the paper with an original example of an extremal positive map of
the algebra $M_{3}$;
we compute the entanglement witness associated with the extremal map
and specify a large family of entangled states detected by it.

% Preliminaries
\section{Preliminaries}
\label{sec:Preliminaries}

\paragraph{}
Let $n \in \mathbb{N}$.
The complex linear space $\mathbb{C}^{n}$ consists of column vectors:
$\eta, \xi$, etc.; the respective row vectors are denoted
$\eta^{t}, \xi^{t}$, etc.
The bar over a number, vector or a matrix always denotes
the element-wise complex conjugation: e.g.
$\overline{z}$, $\overline{\eta}$, $\overline{A}$, etc.
The space $\mathbb{C}^{n}$ is equipped with the inner product
$\langle \eta, \xi \rangle = \eta^{*} \xi$,
where $\eta^{*} = \overline{\eta}^{\,t}$,
and $||\eta||^{2} = \eta^{*} \eta$.
To avoid confusion when two different spaces,
say $\mathbb{C}^{m}$ and $\mathbb{C}^{n}$, are involved,
we distinguish vectors belonging to one of them with an arrow:
e.g. $\vec{\eta}$, $\vec{\xi}$.
Let $M_{n} = M_{n}(\mathbb{C})$ be the algebra
of square complex matrices of size $n$.
We will use letters $A, B, C$, etc. to specify a matrix of $M_{n}$.
The norm of $A$, denoted by $||A||$, is understood as the operator
norm of $A$ as a linear map acting on $\mathbb{C}^{n}$.
For a vector $\eta \in \mathbb{C}^{n}$, $\eta \neq 0$,
by $P_{\eta}$ or $P({\eta}) \in M_{n}$,
we denote the rank-one operator
$P_{\eta}  =  \eta \eta^{*}$.
Of course, when $||\eta|| = 1$,
$P_{\eta}$ is the orthogonal projection onto one-dimensional space
spanned by $\eta$.
For $A \in M_{n}$,
we denote its trace by $\text{Tr} A$;
and by $A^{t}$ and $A^{*} = \overline{A}^{\,t}$
its transpose and conjugate transpose, respectively.
We say that a matrix $A$ is positive-semidefinite,
or simply \emph{positive},
if $\eta^{*} A \eta \geq 0$ for any $\eta \in \mathbb{C}^{n}$
(i.e. $A = A^{*}$ and $A$ has a non-negative spectrum).

A linear map $S\!: M_{n} \rightarrow M_{n}$ is said to be positive,
indicated as $S \geq 0$,
if for any $A \in M_{n}$ such that $A \geq 0$,
we have $S(A) \geq 0$.
For a positive map $S$,
its operator norm is given by $||S|| = S(\mathbf{1})$,
where $\mathbf{1}_{n}$, or simply $\mathbf{1}$,
is the identity matrix of $M_{n}$.
Any positive map is Hermitian,
i.e.  $S(A^{*}) = S(A)^{*}$, for all $A \in M_{n}$.
The identity map of $M_{n}$ is labelled $I_{n}$,
or simply $I$.
The convex cone of all positive maps of $M_{n}$ is denoted
by $\mathcal{P}(M_{n})$.
For $k \in \mathbb{N}$, a map $S \in \mathcal{P}(M_{n})$,
such that the map
$I_{k} \otimes S :  M_{k} \! \otimes \! M_{n}
 \rightarrow  M_{k} \! \otimes \! M_{n}$
is positive,
is called $k$-positive.
If a map is a $k$-positive map for every $k$,
it is called completely positive.
Similarly, a map is $k$-\emph{co}positive,
or completely copositive,
if $I_{k} \otimes (S \circ t)$ is positive for
some $k$, or for every $k$, respectively,
where $t \! : A \mapsto A^{t}$,
$A \in M_{n}$, is the transposition map.
A positive map $S$ is called decomposable,
if it can be written in the form
$S(A) = \Lambda_{1}(A) + \Lambda_{2} (A^{t})$,
where both maps $\Lambda_{1}, \Lambda_{2}$ are completely positive,
possibly zero
(see \cite{choi1975completely} for more details on completely positive maps).
It is called atomic \cite{ha1998atomic},
if it cannot be written as a sum of 2-positive and 2-copositive maps.
A positive map $S$ is extremal,
if for any positive map $T: M_{n} \rightarrow M_{n}$ such that
$S - T \in \mathcal{P}(M_{n})$,
i.e. $0 \leq T \leq S$,
we have $T = \alpha S$ for some number $0 \leq \alpha \leq 1$.
We denote the set of extremal maps of $\mathcal{P}(M_{n})$
by $\text{Ext}(M_{n})$.
It is true that every positive map
can be written as a convex combination of extremal ones.
Nevertheless, it could be of use to specify a dense subset
of $\text{Ext}(M_{n})$,
such that it is easier to handle its elements instead of
general extremal maps.
Hence, we say that a positive map $S$ of the matrix algebra
$M_{n}$ is exposed
\cite{marciniak2013rank},
if for all $T \in \mathcal{P}(M_{n})$ such that
$\text{Tr}\, P_{\xi} \, T(P_{\eta}) = 0$,
where $\mathbb{C}^{n} \ni \eta, \xi \neq 0$ is any pair for which
$\text{Tr}\, P_{\xi} \, S(P_{\eta}) = 0$,
we have that $T = \alpha S$, $\alpha \geq 0$.
Due to the Straszewicz theorem \cite{straszewicz1935exponierte},
the set of exposed maps of $M_{n}$ is indeed dense in $\text{Ext}(M_{n})$.

By a JB$^{*}$-algebra $K$ we understand a complex Banach space
which is also a complex Jordan algebra.
We always assume that $\mathbf{1} \in K$.
See
\cite{hanche1984jordan}
for the overview of the theory of JB$^{*}$-algebras.

% Isometric-sweeping of S
\section{Decomposition of bistochastic maps}
\label{sec:Decomposition}

\paragraph{}
Let $S\!: M_{n} \rightarrow M_{n}$ be a positive map such that
$S(\mathbf{1}) = \mathbf{1}$,
$\text{Tr} S(A) = \text{Tr} A$,
for any $A \in M_{n}$.
We call such a map \emph{bistochastic}.
It is easy to see that $S$ is a contraction in
the Hilbert-Schmidt norm (\emph{HS-norm}) on $M_{n}$,
defined as
$||A||_{HS} = \left( \text{Tr} \, A^{*} A \right)^{1/2}$.
Indeed,
since $S$ fulfils the Kadison-Schwarz inequality,
\begin{equation}
\label{eq:SchwarzInequality}
    S(A^{*}) \, S(A) \: \leq \: S(A^{*} A),
\end{equation}
for any normal element $A \in M_{n}$ (see Prop.\,3.6 of \cite{choi1980some}),
assuming at first that $A = A^{*}$,
we have
\begin{equation}
\label{RandomLabel:712874}
    || S(A) ||_{HS}^{2} \: = \: \text{Tr} S(A)^{2}
    \: \leq \:  \text{Tr} S(A^{2}) \: = \:
        \text{Tr} A^{2} \: = \: ||A||_{HS}^{2}.
\end{equation}
By representing a general element $A \in M_{n}$ as a sum
$A = A_{1} + i A_{2}$,
where both $A_{1}, A_{2}$ are self-adjoint,
and repeating essentially the same calculation as in
\eqref{RandomLabel:712874},
we obtain the assertion.

Next,
we are going to define an isometric splitting of $S$,
drawing from the ideas presented in \cite{olkiewicz1999environment}.
Because $S$ is a contraction in the HS-norm on the Hilbert space $M_{n}$,
equipped with the Hilbert-Schmidt inner product,
that space can be decomposed into a direct sum of a space $K_{S}$,
defined as
\begin{equation}
\label{def:definitionofK}
    K_{S} \: = \: \left\{
        A \in M_{n}: \,\,
            || S^{k} A ||_{HS} = || S^{* k} A ||_{HS} = || A ||_{HS}, \:\:
            \forall k \in \mathbb{N}
        \right\},
\end{equation}
and its orthogonal complement $K_{S}^{\perp}$.
By $S^{*}$, we denote the bistochastic map of $M_{n}$,
which is the adjoint of $S$ as a linear operator on the Hilbert space $M_{n}$,
i.e. $\text{Tr}\, S^{*} (A)\, B = \text{Tr} A \, S(B)$,
for every $A, B \in M_{n}$.
It is true that $A \in K_{S}$,
if and only if
$S^{* k} S^{k} A = S^{k} S^{* k} A = A$,
for any $k \in \mathbb{N}$.
The following proposition,
taken with slight modification from
\cite{olkiewicz1999environment},
puts together some of the characteristics of $K_{S}$.

\begin{proposition}
\label{prop:propertiesofK}
Suppose $S$ is a bistochastic map of $M_{n}$,
and the subspace $K_{S}$ is defined as in \eqref{def:definitionofK}.
Then:

% Enumerate the list like: a), b), c) etc.
\let \oldlabelenumi \labelenumi
\renewcommand{\labelenumi}{\alph{enumi})}
\begin{enumerate}
\item $\mathbf{1} \in K_{S}$;
\item $A \in K_{S}$ implies that $A^{*} \in K_{S}$;
\item  $A  \in K_{S}$ implies that
$|A| = (A^{*}A)^{1/2} \in K_{S}$;
\item if $A, B \in K_{S}$, then $AB + BA \in K_{S}$;
\item if $A = A^{*} \in K_{S}$ and $A = \sum_{i=1}^{k} \lambda_{i} P_{i}$,
where each $\lambda_{i} \neq 0$ is different,
and each $P_{i}$ is a orthogonal projection in $M_{n}$,
then $P_{i} \in K_{S}$ for any $i = 1,2,\ldots,k$;
\item if $P \in K_{S}$ is an orthogonal projection,
then $S(P)$ and $S^{*}(P)$ are orthogonal projections as well,
and $\mathrm{dim} \, S(P) = \mathrm{dim} \, S^{*}(P) = \mathrm{dim} \, P$;
\item if $P, Q \in K_{S}$ are orthogonal projections such that $P Q = 0$,
then $S(P) S(Q) = S^{*}(P) S^{*}(Q) = 0$.
\end{enumerate}
% Return to the old enumaration style
\let \labelenumi \oldlabelenumi
\end{proposition}

\begin{proof}
a) obvious, since $S$ is bistochastic;
b), c) as in Prop. 5\,a) and 5\,b) of \cite{olkiewicz1999environment}.

d)  Suppose at first that $A = A^{*} \in K_{S}$.
Now, $S^{*k} S^{k}(A) = S^{k} S^{*k}(A) = A$,
and, as a result of the Kadison-Schwarz inequality applied to the map
$S^{*k} S^{k}$,
\begin{equation}
A^{2} \: = \: \left( S^{*k} S^{k}(A) \right) \left( S^{*k} S^{k}(A) \right)
    \: \leq \: S^{*k} S^{k}(A^{2}).
\end{equation}
Hence
\begin{equation}
||A^{2}||_{HS} \: \leq \: || S^{*k} S^{k}(A^{2}) ||_{HS} \: \leq \:
    || S^{k}(A^{2}) ||_{HS} \: \leq \: ||A^{2}||_{HS},
\end{equation}
i.e. $|| S^{k}(A^{2}) ||_{HS} = ||A^{2}||_{HS}$.
By a similar argument
$|| S^{*k}(A^{2}) ||_{HS} = ||A^{2}||_{HS}$,
and thus $A^{2} \in K_{S}$.
Now, for any $A, B \in K_{S}$, such that $A = A^{*}$, $B = B^{*}$,
we have
$AB + BA = (A + B)^{2} - A^{2} - B^{2} \in K_{S}$.
For a general $A \in K_{S}$, we write
$A = A_{1} + i A_{2}$, where $A_{1}, A_{2}$ are both Hermitian.
Then
$A^{2} = A_{1}^{2} - A_{2}^{2} + i(A_{1} A_{2} + A_{2} A_{1}) \in K_{S}$.
It is now evident that $AB+BA \in K_{S}$ for general $A,B \in K_{S}$.

e) as in Prop. 5\,d);
f), g) as in Prop. 6\,a) and 6\,c) of
\cite{olkiewicz1999environment}.
\end{proof}

From what has been said above,
follows immediately the next observation.

\begin{corollary}
\label{cor:KisJordanAlgebra}
The space $K_{S}$, with the matrix norm $|| \cdot ||$,
and the multiplication $A \circ B = \frac{1}{2}(AB + BA)$,
is a JB$^{*}$-algebra.
The map $S$ is a Jordan automorphism on $K_{S}$ and
\begin{equation}
\label{eq:SGoesTo0OnKOrth}
    \lim \limits_{k\rightarrow \infty} S^{k}(A)  \: = \:
    \lim \limits_{k\rightarrow \infty} S^{*k}(A) \: = \: 0,
\end{equation}
for any $A \in K_{S}^{\perp}$.
\end{corollary}

\begin{proof}
It is obvious that $K_{S}$ is a complex Banach space.
From Proposition \ref{prop:propertiesofK}\,b),
we have that $K_{S}$ is equipped with involution,
and from point d)
that $K_{S}$ is a Jordan algebra.
Since the map $S$ is invariant with respect to the subspaces
$K_{S}$ and $K_{S}^{\perp}$,
and of course $M_{n} = K_{S} \oplus K_{S}^{\perp}$,
we see that $S$ splits into direct sum
$S = S_{1} \oplus S_{2}$,
where $S_{1} = S_{| K_{S}}$, $S_{2} = S_{| K_{S}^{\perp}}$.
From Prop. 7a) of
\cite{olkiewicz1999environment},
we have that $S(A^{*} A) = S(A)^{*} S(A)$,
i.e. $S$ is a Jordan homomorphism on $K_{S}$.
Moreover,
because $S^{*} S = S S^{*} = I$ on $K_{S}$,
the map $S_{1}$ is invertible,
and thus it is a Jordan automorphism
(see Definition 3.2.1(6) in \cite{bratteli2003operator}).
From the definition \eqref{def:definitionofK} of the space $K_{S}$,
follows easily that
eq. \eqref{eq:SGoesTo0OnKOrth} holds.
\end{proof}

\begin{theorem}
\label{thm:FromESbook}
Let $K \subset M_{n}$ be a JB$^{*}$-subalgebra of $M_{n}$.
There is a bistochastic map
$S \! : M_{n} \rightarrow M_{n}$ such that $K = K_{S}$.
\end{theorem}
\begin{proof}
We consider the space $M_{n}$ to be a Hilbert space equipped
with the Hilbert-Schmidt inner product.
Let $S\!: M_{n} \rightarrow K \subset M_{n}$ be the
orthogonal projection onto $K$.
It is evident that $S(\mathbf{1}) = \mathbf{1}$,
and because $S = S^{*}$,
the map $S$ also preserves trace and
the space $K$ is a stable subspace for $S$,
provided $S$ is a positive map.
Let then $A \in M_{n}$ be a positive matrix.
Since $K$ is JB$^{*}$-algebra,
$(SA)^{*} \in K$.
Because
$|| A - SA ||_{HS} = || A - (SA)^{*} ||_{HS}$,
and $SA$ is the best approximation of $A$ in the space $K$,
we have that $(SA)^{*} = SA$.
We write then $SA = B_{+} - B_{-}$,
where both $B_{+}, B_{-}$ are positive and
$B_{+} B_{-} = 0$.
We have assumed that $\mathbf{1} \in K$,
and because $(SA)^{k} \in K$ for any $k \in \mathbb{N}$,
we have that also the modulus $|S A| \in K$
(compare the explicit formula for
the square-root of a positive matrix in \cite{bratteli2003operator}, p. 34).
Hence both $B_{+}, B_{-} \in K$.
We compute
\begin{multline}
|| A - SA ||_{HS}^{2} \: = \: \text{Tr} \, ( A - SA )^{2} \: = \:
    \text{Tr} \, ( A - B_{+} + B_{-} )^{2} \: = \: \\
    \text{Tr} \, ( A - B_{+} )^{2} +
        2 \, \text{Tr} \, ( A - B_{+} ) B_{-} + \text{Tr} \, B_{-}^{2}
            \: = \: \\
    || A - B_{+} ||_{HS}^{2} +
        2 \, \text{Tr} \,  A \, B_{-}+ \text{Tr} \, B_{-}^{2}
    \: \geq \: || A - B_{+} ||_{HS}^{2}.
\end{multline}
Again, since $SA$ is the best approximation of $A$ in $K$,
we have $SA = B_{+}$, i.e. $SA \geq 0$, which ends the proof.
\end{proof}

From the above,
we know that $K_{S}$ has additional structure of a JB$^{*}$-algebra.
We will see in the following that,
with additional assumption imposed on S,
this algebra must necessarily
have a specific structure,
at least for low dimensional matrices.

\section{Extremal positive maps}
\label{sec:ExtremalMaps}

\paragraph{}
In this section, we focus on maps of the algebra $M_{3}$.
For convenience, let us label four orthogonal projections:
\begin{equation}
\label{def:OrthogonalProjections}
    P_{1} = \begin{pmatrix}
        1 & 0 & 0 \\
        0 & 0 & 0 \\
        0 & 0 & 0
    \end{pmatrix} , \quad \quad
    P_{2} = \begin{pmatrix}
        0 & 0 & 0 \\
        0 & 1 & 0 \\
        0 & 0 & 0
    \end{pmatrix} , \quad \quad
    P_{3} = \begin{pmatrix}
        0 & 0 & 0 \\
        0 & 0 & 0 \\
        0 & 0 & 1
    \end{pmatrix},
\end{equation}
and $P_{12} = P_{1} + P_{2}$.

It is of importance to us that
Theorems 5.3.8 and 6.2.3 of \cite{hanche1984jordan}
imply that every JB$^{*}$-algebra contained in $M_{3}$ is
isomorphic to one of the following:
$\mathbb{C}\mathbf{1}$,
$\mathbb{C} P_{12} \oplus \mathbb{C} P_{3}$,
$\mathbb{C} P_{1} \oplus \mathbb{C} P_{2} \oplus \mathbb{C} P_{3}$,
$M_{2} \oplus \mathbb{C} P_{3}$,
$M_{2}^{s} \oplus P_{3}$,
$M_{3}^{s}$,
and
$M_{3}$ itself,
where $M_{n}^{s}$ is the Jordan algebra of symmetric matrices of
size $n$: $M_{2}^{s} = \{ A \in M_{n}: A = A^{t} \}$.

\begin{theorem}
\label{thm:ExposedMaps}
Let $S\!: M_{3} \rightarrow M_{3}$ be an extremal bistochastic map.
Then the JB$^{*}$-algebra $K_{S}$ is isomorphic to one of the following:
$\mathbb{C}\mathbf{1}$, $\mathbb{C} P_{12} \oplus \mathbb{C} P_{3}$,
or
$M_{3}$.
\end{theorem}

\begin{proof}
1. We proof the assertion by excluding all other possible forms of
$K_{S}$ in the first place.
Let $K_{S}$ be one of the following JB$^{*}$-algebras:
$\mathbb{C} P_{1} \oplus \mathbb{C} P_{2} \oplus \mathbb{C} P_{3}$,
$M_{2} \oplus \mathbb{C} P_{3}$,
$M_{2}^{s} \oplus P_{3}$, or $M_{3}^{s}$.
Then $K_{S}$ contains the projections $P_{1}, P_{2}, P_{3}$,
and because $S$ is a Jordan automorphism on $K_{S}$:
\begin{multline}
    \text{Tr} \, S(P_{i}) S(P_{j}) = \\
= \frac{1}{2} \text{Tr} \, \left( S(P_{i}) S(P_{j}) + S(P_{j}) S(P_{i}) \right)=
\frac{1}{2} \text{Tr} \, S(P_{i} P_{j} + P_{j} P_{i})=
\text{Tr} \, P_{i} P_{j} = \delta_{ij},
\end{multline}
where $i,j = 1,2,3$ and $\delta_{ij}$ is the Kronecker delta.
Hence, $\left\{S(P_{i})\right\}_{i=1}^{3}$
is a triple of rank-one, mutually orthogonal projections.
There is a unitary matrix $U \in M_{3}$, such that
$U^{*} S(P_{i}) U = P_{i}$, for $i = 1,2,3$.
Let us define $\tilde{S}(A) = U^{*} S(A) U$.
Then $\tilde{S}$ is an extremal
\cite[Lemma 3.1.2b, p.\,27]{stormer2013positive}
bistochastic map such that
$\tilde{S}(P_{i}) = P_{i}$, $i = 1,2,3$.
By \cite[Theorem 4.1]{kye1995positive},
$\tilde{S}$ is decomposable,
which contradicts either the fact that $S$ is extremal
or $K_{S} \neq M_{3}$.

2.
While it is easy to see that there are extremal maps for which
$K_{S}=M_{3}$ (take e.g. $S(A) = U A U^{*}$ for a unitary matrix $U$),
or $K_{S}=\mathbb{C} \mathbf{1}$
(take the celebrated Choi map
\cite{choi1977extremal});
it is not that straightforward to provide an example of
an extremal bistochastic map which has
$K_{S}= \mathbb{C} P_{12} \oplus \mathbb{C} P_{3}$.

Let then $S\!: M_{3} \rightarrow M_{3}$ be a linear map defined as
\begin{equation}
\label{eq:DefinitionOfS}
S(A) \:=\: \begin{pmatrix}
        \frac{1}{2}(a_{11} + a_{22}) & 0 & \frac{1}{\sqrt{2}} a_{13} \\
        0 & \frac{1}{2}(a_{11} + a_{22}) & \frac{1}{\sqrt{2}} a_{32} \\
        \frac{1}{\sqrt{2}} a_{31} & \frac{1}{\sqrt{2}} a_{23} & a_{33}
        \end{pmatrix},
\end{equation}
for
$A = \left( a_{ij} \right)_{i,j=1}^{3}
        \in M_{3}$.
If we use the notation
$A = \left( \begin{smallmatrix}
    B & \vec{u} \\
    \vec{w}^{t} & z
    \end{smallmatrix} \right)$,
for $B \in M_{2}$,
$\vec{u},\vec{w} \in \mathbb{C}^{2}$ are column vectors,
and $z \in \mathbb{C}$,
the map $S$ acts by
\begin{equation}
    S(A) \:=\: S \begin{pmatrix}
    B & \vec{u} \\
    \vec{w}^{t} & z
    \end{pmatrix} \: = \:
    \begin{pmatrix}
        \frac{1}{2} (\text{Tr} B) \, \mathbf{1}_{2} &
            \frac{1}{\sqrt{2}}(\hat{P}_{1} \vec{u} + \hat{P}_{2} \vec{w}) \\
        \frac{1}{\sqrt{2}}(\hat{P}_{1} \vec{w} + \hat{P}_{2} \vec{u})^{t} & z
    \end{pmatrix},
\end{equation}
where
$\hat{P}_{1} = \left( \begin{smallmatrix} 1 & 0 \\ 0 & 0 \end{smallmatrix} \right)$,
$\hat{P}_{2} = \left( \begin{smallmatrix} 0 & 0 \\ 0 & 1 \end{smallmatrix} \right)$,
and $\mathbf{1}_{2}$ is the identity matrix of $M_{2}$.
Provided the next Lemma \ref{lem:SIsExtremal} is true,
this example ends the proof.
\end{proof}

\begin{lemma}
\label{lem:SIsExtremal}
$S$ is an bistochastic, extremal and atomic map.
\end{lemma}

\begin{proof}
In order to prove that $S$ is a positive map,
it is enough to show that for any $\eta \in \mathbb{C}^{3}\backslash\{0\}$,
$SP_{\eta} \geq 0$,
where $P_{\eta}$ is a rank-one operator,
$P_{\eta} = \eta \eta^{*}$.
Let us then take
$\eta = (\eta_{1}, \eta_{2}, \eta_{3}) = (\vec{\eta}, \eta_{3})$,
$\vec{\eta} = (\eta_{1}, \eta_{2}) \in \mathbb{C}^{2}\backslash\{0\}$,
$\eta_{3} \in \mathbb{C}$.
We have then
\begin{multline}
 SP_{\eta} \:=\:  S \begin{pmatrix}
    \vec{\eta} \vec{\eta}^{\,*} & \overline{\eta}_{3} \vec{\eta} \\
    \eta_{3} \vec{\eta}^{\,*}   & |\eta_{3}|^{2}
 \end{pmatrix} \: = \: \\
 = \begin{pmatrix}
  \frac{||\vec{\eta}||^{2}}{2} \mathbf{1}_{2} &
        \frac{1}{\sqrt{2}} \left ( \overline{\eta}_{3} \hat{P}_{1} \vec{\eta} +
          \eta_{3} \hat{P}_{2} \overline{\vec{\eta}} \right) \\
\frac{1}{\sqrt{2}} \left ( \overline{\eta}_{3} \hat{P}_{1} \vec{\eta} +
          \eta_{3} \hat{P}_{2} \overline{\vec{\eta}} \right)^{*} &
        |\eta_{3}|^{2}
 \end{pmatrix}.
\end{multline}
If $\eta_{3} = 0$, then of course $SP_{\eta} \geq 0$.
In the case when $\eta_{3} \neq 0$,
taking the Schur complement
(see \cite[Theorem 1.12, p.34]{zhang2006schur}),
we have that $SP_{\eta} \geq 0$, if and only if
\begin{equation}
\label{ieq:SchurForS}
   \left ( \overline{\eta}_{3} \hat{P}_{1} \vec{\eta} +
    \eta_{3} \hat{P}_{2} \overline{\vec{\eta}} \right)
   \left ( \overline{\eta}_{3} \hat{P}_{1} \vec{\eta} +
    \eta_{3} \hat{P}_{2} \overline{\vec{\eta}} \right)^{*}
    \: \leq \:
        |\eta_{3}|^{2} \, ||\vec{\eta}||^{2} \, \mathbf{1}_{2},
\end{equation}
but it is easy to see that this inequality is fulfilled:
\begin{multline}
   \left ( \overline{\eta}_{3} \hat{P}_{1} \vec{\eta} +
    \eta_{3} \hat{P}_{2} \overline{\vec{\eta}} \right)
   \left ( \overline{\eta}_{3} \hat{P}_{1} \vec{\eta} +
    \eta_{3} \hat{P}_{2} \overline{\vec{\eta}} \right)^{*} \: \leq \:
|| \overline{\eta}_{3} \hat{P}_{1} \vec{\eta} +
    \eta_{3} \hat{P}_{2}\overline{\vec{\eta}} ||^{2} \, \mathbf{1}_{2}
    \: = \: \\
\left( || \overline{\eta}_{3} \hat{P}_{1} \vec{\eta} ||^{2} +
    || \eta_{3} \hat{P}_{2} \overline{\vec{\eta}} ||^{2} \right) \, \mathbf{1}_{2}
    \: = \:
|\eta_{3}|^{2} \, ||\vec{\eta}||^{2} \, \mathbf{1}_{2}.
\end{multline}
Thus, $S$ is a bistochastic map.
We also have
$K_{S}= \mathbb{C} P_{12} \oplus \mathbb{C} P_{3}$.
Indeed,
one computes immediately that for $A \in M_{3}$:
\begin{equation}
\lim \limits_{k \rightarrow \infty} S^{k}(A) \:=\:
\frac{1}{2} (\text{Tr} \, P_{12} A )\, P_{12} +
    (\text{Tr} \, P_{3} A)\, P_{3} \, \in K_{S}.
\end{equation}
From that and from the definition \eqref{def:definitionofK},
follows the particular form of the JB$^{*}$-algebra $K_{S}$.

We are going to show now that $S$ is extremal.
Let $S_{0}: M_{3} \rightarrow M_{3}$ be a positive map such that
$0 \leq S_{0} \leq S$.
We have $S_{0}(P_{3}) \leq S(P_{3}) = P_{3}$,
and hence $S_{0}(P_{3}) = \alpha P_{3}$ for some $0 \leq \alpha \leq 1$.
Remembering about the embedding \eqref{RandomLabel:450031},
we want to show that $S_{0}(A) \in M_{2} \! \subset \! M_{3}$
for any $A \in M_{2} \! \subset \! M_{3}$.
Let $B \in M_{2}$ and suppose at first that $B \geq 0$.
Then
\begin{equation}
\label{eq:SMapsM2intoM2}
 0 \:\leq\: S_{0} \begin{pmatrix}
               B & \vec{0} \\ \vec{0}^{t} & 0
              \end{pmatrix} \: = \:
 \begin{pmatrix}
  \hat{S}_{0}(B) & \vec{u} \\ \vec{w}^{t} & r
 \end{pmatrix},
\end{equation}
for some vectors $\vec{u}, \vec{w} \in \mathbb{C}^{2}$ and $r \geq 0$.
The map $\hat{S}_{0}:B \mapsto \hat{S}_{0}(B) \in M_{2}$ must be a positive
map of $M_{2}$ such that $\hat{S}_{0}(B) \leq \frac{1}{2} (\text{Tr} B) \mathbf{1}_{2}$.
On the other hand,
\begin{equation}
 0 \: \leq \:
 \begin{pmatrix}
  \hat{S}_{0}(B) & \vec{u} \\ \vec{w}^{t} & r
 \end{pmatrix} \: \leq \:
            S \begin{pmatrix}
               B & \vec{0} \\ \vec{0}^{t} & 0
              \end{pmatrix} \: = \:
 \begin{pmatrix}
  \frac{1}{2} (\text{Tr} B) \, \mathbf{1}_{2} & \vec{0} \\ \vec{0}^{t} & 0
 \end{pmatrix},
\end{equation}
and hence $r=0$, $\vec{u}=\vec{w}=\vec{0}$.
Because any matrix $B \in M_{2}$ is a complex combination of four positive
matrices, we have that indeed $S_{0}(A) \in M_{2} \! \subset \! M_{3}$
for any $A \in M_{2} \! \subset \! M_{3}$.

Let $\{e_{i}\}_{i=1}^{3}$ be the standard orthonormal basis of $\mathbb{C}^{3}$
and $\{ E_{jk} \}_{j,k=1}^{3}$ be the set of matrix units in $M_{3}$,
$E_{jk} = e_{j} e_{k}^{*}$.
We show that for $i = 1,2,3$ and $j=1,2$;
$\langle e_{i}, S_{0}(E_{j3}) e_{i} \rangle = 0$,
and $\langle e_{1}, S_{0}(E_{j3}) e_{2} \rangle =
    \langle e_{2}, S_{0}(E_{j3}) e_{1} \rangle = 0$.
Fix $i,j$, and take
$X = |z_{1}|^{2} P_{j} + z_{1} \overline{z_{2}} E_{j3} +
\overline{z_{1}} z_{2} E_{3j} + |z_{2}|^{2} P_{3}$,
for some $z_{1}, z_{2} \in \mathbb{C}$.
It is evident that $X \geq 0$.
Hence, since $S_{0}(E_{j3}) = S_{0}(E_{3j})^{*}$,
\begin{equation}
0 \: \leq \: \langle e_{i}, S_{0}(X) e_{i} \rangle \: = \:
|z_{1}|^{2} \, \delta_{ij} +
2 \, \text{Re} \, z_{1} \overline{z_{2}} \,
    \langle e_{i}, S_{0}(E_{j3}) e_{i} \rangle +
|z_{2}|^{2} \, \delta_{i3},
\end{equation}
where $\delta_{ij}$ is the Kronecker delta.
Because the above equation is true for every $z_{1}, z_{2} \in \mathbb{C}$,
and $j \neq 3$,
it follows that necessarily
$\langle e_{i}, S_{0}(E_{j3}) e_{i} \rangle =0$.
Now, since $X \geq 0$, then so is $Y = P_{12} \, S_{0}(X) P_{12}$.
From what has been just shown,
$Y_{jj} = |z_{1}|^{2}$,
but the second diagonal element of $Y$ equals 0, and
hence $Y_{12} = Y_{21} = 0$,
which means that
$\langle e_{1}, S_{0}(E_{j3}) e_{2} \rangle
    = \langle e_{2}, S_{0}(E_{j3}) e_{1} \rangle = 0$.

Therefore, we can write that for any
$A  =   \left( \begin{smallmatrix}
    B & \vec{u} \\
    \vec{w}^{t} & z
    \end{smallmatrix} \right) \in M_{3}$,
\begin{equation}
    S_{0}(A) \:=\: S_{0} \begin{pmatrix}
    B & \vec{u} \\
    \vec{w}^{t} & z
    \end{pmatrix} \: = \:
    \begin{pmatrix}
        \hat{S}_{0}(B) & S_{1} \vec{u} + S_{2} \vec{w} \\
        (\overline{S}_{1} \vec{w} + \overline{S}_{2} \vec{u})^{t} & \alpha z
    \end{pmatrix},
\end{equation}
and $S_{1}, S_{2} \in M_{2}$, with matrix elements given by
\begin{equation}
(S_{1})_{ij} = \langle e_{i}, S(E_{j3}) e_{3} \rangle, \quad \quad
(S_{2})_{ij} = \langle e_{i}, S(E_{3j}) e_{3} \rangle.
\end{equation}

Suppose now that $\alpha = 0$.
Then, since $S_{0} P_{\eta} \geq 0$ for every
$\eta \in \mathbb{C}^{3}\backslash\{0\}$,
we have that $S_{1} = S_{2} = 0$.
Because
$0 \leq (S - S_{0}) P(1,1,1)$,
\begin{equation}
0 \: \leq \: \hat{S}_{0} \begin{pmatrix}
    1 & 1 \\ 1 & 1
    \end{pmatrix} \: \leq \:
    \mathbf{1}_{2} - \frac{1}{2} \begin{pmatrix}
                1 & 1 \\ 1 & 1
                \end{pmatrix} \: = \:
    \frac{1}{2}
    \begin{pmatrix}
    1 & -1 \\ -1 & 1
    \end{pmatrix},
\end{equation}
i.e. for some $\beta \geq 0$,
$
\hat{S}_{0} \left( \begin{smallmatrix}
    1 & 1 \\ 1 & 1
    \end{smallmatrix} \right) =
    \beta \left(
    \begin{smallmatrix}
    1 & -1 \\ -1 & 1
    \end{smallmatrix} \right)
$.
Repeating the same calculation, but this time for $P(i,i,1)$,
we obtain that for some $\beta' \geq 0$,
$
\hat{S}_{0} \left( \begin{smallmatrix}
    1 & 1 \\ 1 & 1
    \end{smallmatrix} \right) =
    \beta' \left(
    \begin{smallmatrix}
    1 & 1 \\ 1 & 1
    \end{smallmatrix} \right)
$,
and so
$
\hat{S}_{0} \left( \begin{smallmatrix}
    1 & 1 \\ 1 & 1
    \end{smallmatrix} \right) = 0
$.
Similarly,
$
\hat{S}_{0} \left( \begin{smallmatrix}
    1 & -1 \\ -1 & 1
    \end{smallmatrix} \right) = 0
$, and hence
$\hat{S}_{0}(\mathbf{1}_{2}) = 0$, i.e. $\hat{S}_{0} = 0$.
Therefore,  we can assume in the following that $\alpha > 0$.

Next, by direct computation, one proves that for any
$\vec{\eta} \in \mathbb{C}^{2}$:
\begin{equation}
 \label{eq:ZeroTrace}
 \text{Tr} \, P(-2\vec{\upsilon}, ||\vec{\eta}||^{2}) \, S P(\vec{\eta},1)
     \:=\: 0,
\end{equation}
where $\vec{\upsilon} =
 \frac{1}{\sqrt{2}} \left(
  \hat{P}_{1} \vec{\eta} + \hat{P}_{2} \overline{\vec{\eta}}
 \right)$,
$||\vec{\upsilon}||^{2} = \tfrac{||\vec{\eta}||^{2}}{2}$.
Because $0 \leq S_{0} \leq S$, the eq.
\eqref{eq:ZeroTrace} holds also for $S_{0}$.
Writing out the equation, and assuming from now on that
$||\vec{\eta}|| = 1$,
we get
\begin{equation}
 \label{eq:ZeroTraceExplicit}
 4 \, \vec{\upsilon}^{\,*} \hat{S}_{0}(\vec{\eta} \vec{\eta}^{\,*}) \vec{\upsilon} -
 4 \, \text{Re} \, \vec{\upsilon}^{\,*} \vec{\upsilon}_{0} + \alpha \: = \: 0,
\end{equation}
where $\vec{\upsilon_{0}} = S_{1} \vec{\eta} + S_{2} \overline{\vec{\eta}}$.
To keep the notation simple,
we remember that $\vec{\upsilon}$ and $\vec{\upsilon}_{0}$ depend on $\vec{\eta}$,
without signifying it explicitly.

Since $S_{0} P(\vec{\eta},1)$ is a positive matrix,
using again the Schur complement,
$\vec{\upsilon}_{0} \vec{\upsilon}_{0}^{\,*} \leq  \alpha \hat{S}_{0}(\vec{\eta} \vec{\eta}^{\,*})$,
and thus
$|\vec{\upsilon}^{\,*} \vec{\upsilon}_{0}|^{2} \leq
  \alpha \vec{\upsilon}^{\,*} \hat{S}_{0}(\vec{\eta} \vec{\eta}^{\,*}) \vec{\upsilon}$.
Therefore
\begin{equation}
4 \left( \text{Im} \, \vec{\upsilon}^{\,*} \vec{\upsilon}_{0} \right)^{2} +
\left( 2 \, \text{Re} \, \vec{\upsilon}^{\,*} \vec{\upsilon}_{0} - \alpha \right)^{2}
 \: \leq \:
4 \alpha \, \vec{\upsilon}^{\,*} \hat{S}_{0}(\vec{\eta} \vec{\eta}^{\,*}) \vec{\upsilon}
    - 4 \alpha \, \text{Re} \, \vec{\upsilon}^{\,*} \vec{\upsilon}_{0} + \alpha^{2}  = 0,
\end{equation}
i.e. $\vec{\upsilon}^{\,*} \vec{\upsilon}_{0} = \frac{\alpha}{2}$.
Substituting both $\vec{\upsilon}$ and $\vec{\upsilon}_{0}$,
we obtain:
\begin{equation}
\label{eq:ComplicatedForEtaPlus}
\vec{\eta}^{\,*} \left( \hat{P}_{1} S_{1} + S_{2}^{t} \hat{P}_{2} \right) \vec{\eta}
    + \vec{\eta}^{\,*} \hat{P}_{1} S_{2} \overline{\vec{\eta}}
    + \vec{\eta}^{\,t} \hat{P}_{2} S_{1} \vec{\eta} \: = \: \frac{\alpha}{\sqrt{2}}.
\end{equation}
Because this holds true for any $\vec{\eta} \in \mathbb{C}^{2}$,
we can repeat the whole argument,
but this time changing $\vec{\eta} \mapsto i \vec{\eta}$,
to obtain:
\begin{equation}
\label{eq:ComplicatedForEtaMinus}
\vec{\eta}^{\,*} \left( \hat{P}_{1} S_{1} + S_{2}^{t} \hat{P}_{2} \right) \vec{\eta}
    - \vec{\eta}^{\,*} \hat{P}_{1} S_{2} \overline{\vec{\eta}}
    - \vec{\eta}^{\,t} \hat{P}_{2} S_{1} \vec{\eta} \: = \: \frac{\alpha}{\sqrt{2}}.
\end{equation}
Adding together \eqref{eq:ComplicatedForEtaPlus} and \eqref{eq:ComplicatedForEtaMinus},
we have
$
\vec{\eta}^{\,*} \left( \hat{P}_{1} S_{1} + S_{2}^{t} \hat{P}_{2} \right) \vec{\eta} =
    \frac{\alpha}{\sqrt{2}},
$
for any $\vec{\eta}$.
Hence
\begin{equation}
\label{eq:S1PlusS2EqualsOne}
\hat{P}_{1} S_{1} + S_{2}^{t} \hat{P}_{2} \: = \:
     \frac{\alpha}{\sqrt{2}} \mathbf{1}_{2}.
\end{equation}
Subtracting \eqref{eq:ComplicatedForEtaMinus} from \eqref{eq:ComplicatedForEtaPlus},
we get
\begin{equation}
    \vec{\eta}^{\,*} \hat{P}_{1} S_{2} \overline{\vec{\eta}}
    + \vec{\eta}^{\,t} \hat{P}_{2} S_{1} \vec{\eta} \: = \: 0.
\end{equation}
Let  $\vec{\eta}$ be each of the following vectors:
$(1,0)$, $(0,1)$,
$(i,0)$, $(0,i)$,
$(\frac{1}{\sqrt{2}},\frac{1}{\sqrt{2}})$,
$(\frac{1}{\sqrt{2}},\frac{i}{\sqrt{2}})$,
then we can see that $\hat{P}_{1} S_{2} = \hat{P}_{2} S_{1} = 0$.
Combining this with  \eqref{eq:S1PlusS2EqualsOne},
we obtain
\begin{equation}
S_{1} = \begin{pmatrix}
    \frac{\alpha}{\sqrt{2}} & z_{0} \\ 0 & 0
\end{pmatrix}, \quad
S_{2} = \begin{pmatrix}
     0 & 0 \\ - z_{0} & \frac{\alpha}{\sqrt{2}}
\end{pmatrix}, \quad
z_{0} \in \mathbb{C}.
\end{equation}

Putting $\vec{\upsilon}^{\,*} \vec{\upsilon}_{0} = \frac{\alpha}{2}$
into \eqref{eq:ZeroTraceExplicit}, we get that
$
\vec{\upsilon}^{\,*} \hat{S}_{0}(\vec{\eta} \vec{\eta}^{\,*}) \vec{\upsilon} =
\frac{\alpha}{4}
$.
Hence
\begin{equation}
 \vec{\upsilon}^{\,*} \left(
    \alpha \, \hat{S}_{0}(\vec{\eta} \vec{\eta}^{\,*}) -\vec{\upsilon}_{0} \vec{\upsilon}_{0}^{\,*}
  \right) \vec{\upsilon} \: = \: 0,
\end{equation}
and since
$\vec{\upsilon}_{0} \vec{\upsilon}_{0}^{\,*} \leq  \alpha \hat{S}_{0}(\vec{\eta} \vec{\eta}^{\,*})$,
it must be that
$ \alpha \, \hat{S}_{0}(\vec{\eta} \vec{\eta}^{\,*}) \vec{\upsilon} =
\left( \vec{\upsilon}_{0}^{\,*} \vec{\upsilon} \right)  \vec{\upsilon}_{0}$,
or simply
$ \hat{S}_{0}(\vec{\eta} \vec{\eta}^{\,*}) \vec{\upsilon} = \frac{1}{2} \vec{\upsilon}_{0}$.
Again,
we can repeat the whole argument,
changing $\vec{\eta} \mapsto i \vec{\eta}$,
adding the obtained result to and subtracting from the previous one,
and we arrive at:
\begin{subequations}
    \begin{align}
\label{eq:SZeroIsAlmostOneA}
\eta_{1} \, \hat{S}_{0}(\vec{\eta} \vec{\eta}^{\,*}) \vec{e}_{1} \: = \:
   \left( \frac{\alpha}{2} \eta_{1} + \frac{\sqrt{2}}{2} z_{0} \eta_{2} \right) \, \vec{e}_{1}, \\
\label{eq:SZeroIsAlmostOneB}
\overline{\eta}_{2} \, \hat{S}_{0}(\vec{\eta} \vec{\eta}^{\,*}) \vec{e}_{2} \: = \:
   \left(- \frac{\sqrt{2}}{2} z_{0} \overline{\eta}_{1} + \frac{\alpha}{2} \overline{\eta}_{2} \right)
       \, \vec{e}_{2},
    \end{align}
\end{subequations}
where $\vec{\eta} = (\eta_{1}, \eta_{2})$, and
$\vec{e}_{1} = (1,0), \vec{e}_{2} = (0,1) \in \mathbb{C}^{2}$.
Taking e.g. \eqref{eq:SZeroIsAlmostOneA}
and multiplying it by $\overline{\eta}_{1} \vec{e}_{1}^{\,*}$,
we have
\begin{equation}
0 \: \leq \:
 |\eta_{1}|^{2} \, \vec{e}_{1}^{\,*} \, \hat{S}_{0}(\vec{\eta} \vec{\eta}^{\,*}) \vec{e}_{1}
 \: = \:
\frac{\alpha}{2} |\eta_{1}|^{2} + \frac{\sqrt{2}}{2} z_{0} \overline{\eta}_{1} \eta_{2},
\end{equation}
for every $\vec{\eta} \in \mathbb{C}^{2}$, $||\vec{\eta}|| =1$.
Therefore $z_{0} = 0$, and
$S_{1} = \frac{\alpha}{2} \hat{P}_{1}$,
$S_{2} = \frac{\alpha}{2} \hat{P}_{2}$.
As a consequence of
\eqref{eq:SZeroIsAlmostOneA} and \eqref{eq:SZeroIsAlmostOneB},
$\hat{S}_{0} (\vec{\eta} \vec{\eta}^{\,*}) = \frac{\alpha}{2} \mathbf{1}_{2}$
for every $\vec{\eta}$ such that $\eta_{1} \neq 0$ and $\eta_{2} \neq 0$.
For $0 \!<\!\epsilon \!<\! 1$,
take $\vec{\eta}_{\epsilon} = (\sqrt{1 - \epsilon^{2}}, \epsilon)$.
Then $\hat{S}_{0} (\hat{P}_{1}) =
\lim_{\epsilon \rightarrow 0} \hat{S}_{0}
    (\vec{\eta}_{\epsilon} \vec{\eta}_{\epsilon}^{\,*}) =
\frac{\alpha}{2} \mathbf{1}_{2}$.
Similarly,
$\hat{S}_{0} (\hat{P}_{2}) = \frac{\alpha}{2} \mathbf{1}_{2}$,
which results in
$\hat{S}_{0} (\vec{\eta} \vec{\eta}^{\,*}) = \frac{\alpha}{2} \mathbf{1}_{2}$
for every $\vec{\eta} \in \mathbb{C}^{2}$,
$||\vec{\eta}|| = 1$.
This is sufficient to say that
$\hat{S}_{0}(B) = \frac{\alpha}{2} (\text{Tr} B) \mathbf{1}_{2}$
for any $B \in M_{2}$.
We have shown that for an arbitrary positive map such that
$0 \leq S_{0} \leq S$,
$S_{0} = \alpha S$ for $0 \leq \alpha \leq 1$,
which means that $S$ is an extremal positive map of $M_{3}$.

It is of interest to note that $S$ is not 2-positive.
Indeed,
we can prove even more and say that
the map $S$ does not fulfil the Kadison-Schwarz inequality
for any matrix $B \in M_{3}$
(see Prop.\,4.1 of \cite{choi1980some}).
Take the matrix
$B = P_{12} + E_{32}$.
Then it is easy to verify that
$S(B^{*} B) - S(B)^{*} S(B)$
is not positive.
Obviously, the map $S$ is
not 2-\emph{co}positive either:
to see this, take $B = P_{12} + E_{31}$.
That, together with the fact that $S$ is extremal,
makes the map atomic, and ends the proof.
\end{proof}

\begin{remark*}
In order to prove extremality of $S$,
we showed that $S_{0} = \alpha S$,
for every $0 \leq S_{0} \leq S$.
But a only weaker assumption is in fact needed.
Indeed, let us assume that $S_{0} \in \mathcal{P}(M_{3})$ and
$\text{Tr} P_{\xi} \, S_{0}(P_{\eta}) = 0$,
for every $\mathbb{C}^{3} \ni \xi,\eta \neq 0$
such that $\text{Tr} P_{\xi} \, S(P_{\eta}) = 0$.
Then $\text{Tr} P_{12} \, S_{0}(P_{3}) = 0$ and
$\text{Tr} P_{3} \, S_{0}(P_{12}) = 0$.
Because $S_{0}$ is positive, so $S_{0}(P_{3}) = \alpha P_{3}$
and $S_{0}(P_{12}) \in M_{2} \! \subset \! M_{3}$.
Then the rest of the proof goes exactly the same as in
Lemma \ref{lem:SIsExtremal},
beginning with \eqref{eq:SMapsM2intoM2} onward.
This proofs that the map $S$
is not only extremal, but also \emph{exposed}.
\end{remark*}

For the map $S$ specified in \eqref{eq:DefinitionOfS}, we have
$K_{S}= \mathbb{C} P_{12} \oplus \mathbb{C} P_{3}$.
To the best of the authors' knowledge,
all the examples of the extremal maps of $M_{3}$
that are not completely or co-completely positive,
which have been so far specified in the literature,
have $K_{S} = \mathbb{C} \, \mathbf{1}$.
The map $S$ would be the first one
with a two-dimensional commutative stable algebra.

\vspace{0.5cm}

Given a positive map $S: M_{n} \rightarrow M_{n}$,
the entanglement witness associated with $S$ is a matrix $W_{S}$
of the tensor matrix algebra $M_{n^{2}} = M_{n} \! \otimes \! M_{n}$,
defined by
\begin{equation}
\label{def:entanglement-witness}
    W_{S} = \sum \limits_{i,j =1}^{n} E_{ij} \otimes S(E_{ij}),
\end{equation}
where $\{ E_{ij}\}_{i,j=1}^{n}$ are standard matrix units.
The theorem by Choi and Jamiołkowski \cite{choi1975completely,jamiolkowski1974effective}
states that the matrix $W_{S}$ is a positive element of $M_{n^{2}}$,
if and only if $S$ is completely positive.
Therefore, for a positive, non-completely positive map $S$
there is at least one density matrix $\rho \in M_{n^{2}}$
such that $\text{Tr}\, W_{S} \rho < 0$.
This density matrix cannot be separable \cite{werner1989quantum},
and hence we say that the entanglement witness \emph{detects} the
entangled state $\rho$.

It would be of interest to provide the explicit form of the entanglement
witness associated with the map $S$ of eq. \eqref{eq:DefinitionOfS},
and the family of states on the composite quantum system space
$M_{9} = M_{3} \! \otimes \! M_{3}$, detected by $S$.
It is easy to see, that in this case:
\begin{equation}
\label{WS-C}
 W_S =  \left( \begin{array}{ccc|ccc|ccc}
 \frac{1}{2} &  \cdot& \cdot& \cdot& \cdot& \cdot& \cdot& \cdot& \frac{1}{\sqrt{2}} \\
 \cdot& \frac{1}{2} &\cdot& \cdot& \cdot& \cdot& \cdot& \cdot& \cdot\\
 \cdot& \cdot& \cdot & \cdot& \cdot& \cdot& \cdot& \cdot& \cdot  \\ \hline
 \cdot& \cdot& \cdot& \frac{1}{2} & \cdot& \cdot& \cdot& \cdot&  \cdot \\
 \cdot& \cdot& \cdot& \cdot& \frac{1}{2} & \cdot& \cdot& \cdot&  \cdot \\
 \cdot& \cdot& \cdot& \cdot& \cdot& \cdot& \cdot & \frac{1}{\sqrt{2}}& \cdot  \\ \hline
 \cdot& \cdot& \cdot & \cdot& \cdot& \cdot& \cdot& \cdot& \cdot  \\
 \cdot & \cdot& \cdot& \cdot& \cdot& \frac{1}{\sqrt{2}}& \cdot& \cdot& \cdot \\
 \frac{1}{\sqrt{2}}& \cdot& \cdot& \cdot& \cdot & \cdot& \cdot& \cdot& 1
  \end{array} \right),
\end{equation}
where dots mean matrix elements equal to zero.
$W_{S}$ is not a positive matrix of $M_{9} = M_{3} \! \otimes \! M_{3}$.
Let $U \in \text{U}(9)$ be a unitary matrix such that
$U^{*} W_{S} U = W_{S}^{(2)} \oplus W_{S}^{(7)}$,
where
\begin{equation}
\label{WS-DirectSum}
 W_{S}^{(2)} = \left(\begin{array}{cc}
    0 & \frac{1}{\sqrt{2}}  \\ \frac{1}{\sqrt{2}}  & 0
  \end{array}\right) \in M_{2}, \quad
 W_S^{(7)}\ = \  \left( \begin{array}{ccccccc}
 \frac{1}{2} &  \cdot& \cdot& \cdot& \cdot& \cdot& \frac{1}{\sqrt{2}} \\
 \cdot& \frac{1}{2} &\cdot& \cdot& \cdot& \cdot& \cdot\\
 \cdot& \cdot& \cdot & \cdot& \cdot& \cdot& \cdot \\
 \cdot& \cdot& \cdot& \frac{1}{2} & \cdot&  \cdot& \cdot \\
 \cdot& \cdot& \cdot& \cdot& \frac{1}{2} & \cdot& \cdot \\
 \cdot& \cdot& \cdot & \cdot& \cdot& \cdot& \cdot  \\
 \frac{1}{\sqrt{2}}& \cdot& \cdot& \cdot& \cdot& \cdot& 1
  \end{array} \right) \in M_{7}.
\end{equation}
It is evident that $W_{S}^{(7)} \geq 0$.
Let also $\vec{v}$ be one of the eigenvectors of $W_{S}^{(2)}$:
$\vec{v} = \frac{1}{\sqrt{2}} (1,-1)^{t} \in \mathbb{C}^{2}$,
$W_{S}^{(2)} \vec{v} = - \frac{1}{\sqrt{2}} \vec{v}$, and
$P_{\vec{v}} = \vec{v} \vec{v}^{*}$
be the orthogonal projection onto the space spanned by $\vec{v}$.
We define
$\rho = \frac{1}{2} U ( P_{\vec{v}} \oplus \rho_{0} ) U^{*}$,
for a density matrix $\rho_{0} \in M_{7}$,
$\rho_{0} \geq 0$, $\text{Tr} \rho_{0} = 1$,
such that
$\text{Tr}\, W_{S}^{(7)} \rho_{0} < \frac{1}{\sqrt{2}}$.
Then $\rho \geq 0$ and $\text{Tr} \rho = 1$,
i.e. $\rho$ is a density matrix.
Moreover,
\begin{multline}
\label{RandomLabel:851252}
    \text{Tr}\, W_{S} \rho =
\frac{1}{2} \text{Tr}\, W_{S} U (P_{\vec{v}} \oplus \rho_{0}) U^{*} =
\frac{1}{2} \text{Tr}\, (W_{S}^{(2)} \oplus W_{S}^{(7)}) (P_{\vec{v}} \oplus \rho_{0}) = \\ =
\frac{1}{2} \text{Tr}\, W_{S}^{(2)} P_{\vec{v}} + \frac{1}{2} \text{Tr}\, W_{S}^{(7)} \rho_{0}
< 0,
\end{multline}
which means that $W_{S}$ detects the entangled state $\rho$.
In particular, the state $\rho$ given by
\begin{equation}
\label{PPTstate}
 \rho =  \frac{1}{7} \left( \begin{array}{ccc|ccc|ccc}
 1 &  \cdot& \cdot& \cdot& \cdot& \cdot& \cdot& \cdot& -1 \\
 \cdot& \cdot& \cdot& \cdot& \cdot& \cdot& \cdot& \cdot& \cdot\\
 \cdot& \cdot& 1 & \cdot& \cdot& \cdot& \cdot& \cdot& \cdot  \\ \hline
 \cdot& \cdot& \cdot& \cdot& \cdot& \cdot& \cdot& \cdot&  \cdot \\
 \cdot& \cdot& \cdot& \cdot& 1 & \cdot& \cdot& \cdot&  \cdot \\
 \cdot& \cdot& \cdot& \cdot& \cdot& 1 & \cdot & -1 & \cdot  \\ \hline
 \cdot& \cdot& \cdot & \cdot& \cdot& \cdot& 1& \cdot& \cdot  \\
 \cdot & \cdot& \cdot& \cdot& \cdot& -1 & \cdot& 1 & \cdot \\
 -1 & \cdot& \cdot& \cdot& \cdot & \cdot& \cdot& \cdot& 1
  \end{array} \right)
\end{equation}
is a PPT state, meaning that $(I \otimes t)\rho$ is still a density matrix,
but $\text{Tr}\, W_{S} \rho = \frac{2}{7} - \frac{2\sqrt{2}}{7} < 0$.

\paragraph{Acknowledgements.}
The authors would like to express their gratitude to Prof. Erling Størmer
for rightfully pointing out that the statement of Theorem \ref{thm:FromESbook}
is a direct consequence of Proposition 2.2.10 from
\cite{stormer2013positive}.
Moreover, he helped us complete the list of all possible Jordan subalgebras
of $M_{3}$, which has greatly simplified the proof
of Theorem \ref{thm:ExposedMaps}.

%%%%%%%%%%%%%%%%%%%%%%%%
%%% End of the paper %%%
%%%%%%%%%%%%%%%%%%%%%%%%

% References
\bibliographystyle{abbrv}
\bibliography{./biblio}

\end{document}


% !TEX root=/home/tavant/these/manuscript/src/manuscript.tex

\section{Realistic heating and ionization}
  \label{sec-realistic_1D}
  In the study of \cref{{sec-1DPIC}}, the ionization and the heating mechanism are not self-consistent, but allowed us to obtain quickly a steady-state as in the simulations of \cref{ch-1}.
  We now study the impact of the wall absorption in a case of self-consistent heating and ionization.
  The electrons are heated "inductively" with a radio-frequency (RF) electric field in the direction normal to the simulation grid \cite{meige2006a, lucken2018, turner1993}.
  The electrons are heated in the $y$ direction, and momentum is transferred to the $x$ and $z$ axis via electron-neutral collisions.
  The heating electric field $\vec{E_{rf}} = E_{rf} \vec{e_y}$ is independent of $x$ in the simulation domain, its frequency is $13.56$\,MHz, and its amplitude is adjusted in order to obtain the desired absorbed power $P_{abs} = < \vec{J_e} \cdot  \vec{E_{rf}}>$.

  \begin{table}[!htb]
    \ra{1.3}
    \centering
    \begin{tabular}{@{} r l l @{}}
    \toprule
      Parameter & value & unit \\ \midrule
      Pressure & $0.1$ & mTorr\\
      $P_{abs}$ & $0.25$ & W/m$^{-3}$\\
      Length $L$&10&cm\\
      \bottomrule
    \end{tabular}
    \caption{Input parameters for the simulation using the self-consistent model.}
    \label{tab-PIC2}
  \end{table}

  \begin{figure}[!htbp]
    \center
    \includegraphics[width=0.9\textwidth]{ICP_results.pdf}
    \caption{Results of the PIC simulation for the self-consistent model, using RF inductive heating.}
    \label{fig-icpresults}
  \end{figure}

  \Cref{fig-icpresults} presents the simulation results for the electron density, plasma potential and electron temperature using the parameters of \Cref{tab-PIC2}.
  We can see that the different variables (density, electron temperature and the plasma potential) are not much affected compared to the results of \cref{sec-1DPIC}.

  \begin{figure}[!htbp]
    \centering
    \includegraphics[width=\defaultwidth]{ICP_polyfit2.pdf}
    \caption{Estimation of the polytropic index in the sheath and in the whole domain in the PIC simulation using the self-consistent model.}
    \label{fig-icpfit}
  \end{figure}

  \Cref{fig-icpfit} presents the electron pressure as a function of the electron density measured in the simulation in log scale.
  We see that the trend is not purely linear. Hence, the linear regression used in order to obtain the polytropic index is conducted twice\string:
  \begin{itemize}
    \item In the whole domain\string: $\gamma=1.5$
    \item Only in the sheath\string: $\gamma=1.6$
  \end{itemize}
  The linear relation conducted on the whole domain is less accurate than for the simulation result of \cref{sec-1DPIC} ($R^2=0.992$).
  However, we can see that the linear relation still describes quite well the electron evolution in the sheath.
  The polytropic indexes obtained with the self-consistent model are close to the one of the simulation of \cref{sec-1DPIC} at the same pressure.

  \begin{figure}[!htbp]
    \centering
    \includegraphics[width = 0.9\textwidth]{FluidComparisonICP.pdf}
    \caption{Comparison of the electron temperature and plasma potential measured in the PIC simulation with the prediction of the fluid model with $\gamma = 1.5$ (average index in the domain) and $\gamma=1.6$ (index in the sheath).}
    \label{fig-comp2}
  \end{figure}

  \Cref{fig-comp2} shows the comparison of the electron temperature and the plasma potential in the PIC simulation using the self-consistent model with the prediction of the fluid model of \cref{sec-fluid}.
  We can see that the agreement between the PIC results and the fluid models is less satisfactory than in \cref{fig-comp} but it is still significantly better than the isothermal model.
  Hence, even with a self-consistent heating and ionization in the plasma, the polytropic model stands as a better model for the sheath and the pre-sheaths.


% !TeX root = ../main.tex

\chapter{Discussion of Results}
\label{ch:discussion}
In this chapter the performance of different food image classification methods is evaluated. In addition the impact of important classifier parameters is compared.

\section{Hyper Parameter Optimization}
The hyper parameter optimization is done using a simplified grid search and random search. An exhaustive grid search tests every parameter value by using a cartesian product with the other parameters. Due to the high dimensionality of classifier parameters and the high computational cost of classifier training, exhaustive grid search is not possible in a feasible amount of time and Bergstra and Bengio even showed that random search can outperform grid search \cite{Bergstra2012}. Therefore, parameters are tested individually in addition to random searches on important parameters. This is an acceptable tradeoff between accuracy and time since the goal is not to get optimal parameters but to get a general direction of good parameters for this problem. The following section will first focus on the impact of common parameters like SVM kernels or image size on the performance and then attend to more classifier specific parameters like the number of image segments for color histogram features.

	\subsection{SVMs and K-nearest Neighbors}
	\begin{table}[htb]
		\begin{tabular*}{\columnwidth}{@{\extracolsep{\stretch{1}}}*{6}{c}@{}}
			\toprule
			Model	 & Color & SIFT  & SURF  & ORB	 & LBP \\ \midrule
			Linear	 & 0.418 & 0.444 & 0.407 & 0.285 & 0.312\\
			Poly	 & 0.494 & 0.347 & 0.339 & 0.282 & \underline{0.519} \\
			RBF		 & 0.125 & 0.523 & 0.455 & 0.263 & 0.364\\
			$\chi^2$ & \underline{0.593} & \underline{0.648} & \underline{0.606} & \underline{0.423} & 0.391 \\
			KNN 	 & 0.412 & 0.294 & 0.364 & 0.258 & 0.431  \\ \bottomrule
		\end{tabular*}
		\caption{Results of classifiers with linear SMV kernel, Polynomial SVM kernel, \gls{rbf} SVM kernel, additive $\chi^2$ SVM kernel and \gls{knn}. Best results are underlined. Test details: HI-4, SI-7, SU-7, O-1, LBP-1}
		\label{tab:resultModels}
	\end{table}
	For classifiers, the model that they are trained on, is the most important parameter. Color histograms, SIFT, SURF, ORB and LBP were tested on the k-nearest Neighbors model and SVMs with four different kernels:
	\begin{itemize}
		\item Linear kernel {(OpenCV)}
		\item Polynomial kernel with degree 2 {(OpenCV)}
		\item \gls{rbf} kernel {(OpenCV)}
		\item Additive $\chi^2$ kernel {(sklearn)}
	\end{itemize}
	The results are shown in table \ref{tab:resultModels}. The classifiers were not trained with optimal parameters so it is not possible to deduct a classifier ranking based on this evaluation.

	Not surprisingly, the $\chi^2$ SVM kernel performs best over all feature classifiers {(except LBP)} because in general, $\chi^2$ kernels are best suited for histogram style feature vectors and those classifiers are all histogram classifiers. However, it should be noted that training and predicting a classifier with a $\chi^2$ kernel can take more than 2 times longer than the same process with a polynomial kernel. Interestingly, the results for \gls{knn} were better than expected considering the fact that \gls{knn} is extremely overfitting on this dataset even for a high k. \gls{knn} achieves an accuracy of 0.960 on the training partition and only 0.363 on the test partition for SURF features for example. Even the worst SVM kernel do not overfitt that much.

	\subsection{Image Resolution}
	\begin{figure}[htb]
		\centering
		\includegraphics[scale=0.6]{figures/results_resolution}
		\caption{Impact of image size on histogram, SIFT and SURF classifier performance. Test details: HI-6, SI-6, SU-6}
		\label{fig:resultsResolution}
	\end{figure}
	Different image resolutions were tested on SURF, SIFT and color histograms to determine if a higher image resolution automatically means a higher accuracy. Intuitively, image size or resolution should be a classical tradeoff between computational cost and classification performance. To test if higher resolutions yield better accuracies, 6 resolutions were tested from 1024 pixels {(equals a $32 \times 32$ image)} to 1,048,576 pixels {($1024 \times 1024$)}. The results are visualized in figure \ref{fig:resultsResolution}.

	Up to a certain point the accuracy of SIFT and SURF gets better until it drops and levels out. Since for every test run the number of extracted descriptors for the classification was the same, it is not the quantity of keypoints that affects the performance but the quality. SURF extracts fewer keypoints on small images. For the 1024 image size SURF was not able to detect even one keypoint for most of the images which means that for smaller images the algorithm has to sample more random keypoints which are lower quality keypoints and decrease performance. SIFTs keypoint detector seems to have less problems with smaller images and increasing the image size only slightly increases performance. For big images the accuracy is decreasing again which may be due to fact that the number of extracted keypoints increases but the actual number of used keypoints remains the same so potentially more stable keypoints are filtered out.

	Just changing the image size does not impact performance for histograms since the number of image segments does not change so the extracted histogram is always the same regardless of the image size. This is further proven by 40 random tests {(HI-7)} on the histogram parameters: number of histogram bins, image segments and the image size. Figure \ref{fig:resultsResolutionHistogram}a shows that even with different numbers of bins or image segments the image size has no impact on performance at all. However, there is a significant positive correlation {(correlation coefficient: $+0.538$, p-value: $0.00034$)} between the length of the feature vector and the accuracy {(fig. \ref{fig:resultsResolutionHistogram}b)}.

	\begin{figure}[htb]
		\centering
		\subfloat[Image size]{\includegraphics[width=75mm]{figures/results_h7ImageSize}}
		\subfloat[Feature vector length]{\includegraphics[width=75mm]{figures/results_h7FeatureVector}}
		\caption{Histogram classifier performance under the impact of number of bins, image segments and image size. Test details: H-7}
		\label{fig:resultsResolutionHistogram}
	\end{figure}

	\subsection{Number of Extracted Keypoints}
	\begin{figure}[htb]
		\centering
		\includegraphics[scale=0.4]{figures/results_keypoints}
		\caption{Impact of keypoint quantity on SIFT and SURF accuracy. The red circle denotes the number of mean extracted keypoints for this classifier. Test details: SI-1, SU-1, R-1}
		\label{fig:resultsKeypoints}
	\end{figure}
	The number of extracted keypoints is basically the length of the extracted feature vector. Each keypoint produces a 128 dimensional vector in case of SIFT and a 64 dimensional vector for SURF.

	Deciding on a fixed number of keypoints is a very difficult problem because the quality and quantity of extractable keypoints is dependent on many various parameters like contrast and edge thresholds or image size. Figure \ref{fig:resultsKeypoints} shows the change in accuracy for changes in the number of used keypoints. Other parameters are the same over all iterations. There is a positive correlation for both SIFT and SURF between number of keypoints and accuracy which means that up to a certain point adding more keypoints helps to improve performance.

	Intuitively, the performance degrades after a certain point because the keypoint detectors can't extract enough relevant points of the region of interest {(food item)} so more irrelevant points of background objects have to be included. After the background points are all included the missing points have to be randomly augmented which should decrease performance even more.

	The tests were performed with an image resolution of 16,384 pixels which corresponds to a size of $128 \times 128$. For this specific image size and the 8-class Food-100 subdataset SURF detects a mean of 105.3 keypoints per image {(red circle)} which means that after 105 keypoints in this test most of the other points were randomly sampled but the accuracy increased nonetheless. For SIFT the mean number of detected keypoints per image is 160.9. So the prior assumption that randomly sampled keypoints decrease performance is not completely correct. Though the gradient of the performance increment is much less after this point than the increment with real sampled keypoints before.

	To compare the two keypoint extractors and further proof this assumption, a third and fourth test were performed. In these tests all keypoints were randomly sampled around the image center so no edge detection was performed. For keypoint description SURF was used in the third test and SIFT was used in the fourth test {(not shown in figure \ref{fig:resultsKeypoints})}. The gray dotted line in figure \ref{fig:resultsKeypoints} shows the random test with the SURF feature descriptor. These tests make it possible to derive the following assumptions:

	\begin{enumerate}
		\item Detected keypoints allow for a higher accuracy than randomly sampled keypoints because it takes a long time for the random keypoint sampler to catch up with the performance of the SURF or SIFT classifier.
		\item The random sampler does not use an edge detector. Only the SURF/SIFT descriptors are used. This makes it possible to compare the performance of the descriptors since it takes the detectors out of the equation. For this specific task it seems that SURF is not only the faster descriptor but also more accurate in describing an image.
		\item Random keypoint sampling is a positive alternative for images with low contrast values were detectors are not able to sample many keypoints.
	\end{enumerate}

	\subsection{Keypoint Filtering}
		\begin{table}[htb]
			\centering
			\begin{tabular}{@{}ccc@{}}
				\toprule
							 & SIFT  & SURF  \\ \midrule
				Filtering    & 0.568 & 0.568 \\
				No filtering & 0.440 & 0.599 \\ \bottomrule
			\end{tabular}
			\caption{Results of keypoint filtering for SURF and SIFT. Test details: SU-3, SI-3}
			\label{tab:resultFiltering}
		\end{table}

	The algorithm proposed in section \ref{subsub:keypointFiltering} filters keypoints by weighting their response values with the distance to the image center. As table \ref{tab:resultFiltering} shows, this dramatically improves the performance of SIFT from 0.44 to 0.57. For SURF, however, the filtering does even reduce the accuracy although filtering SURF keypoints should also be applicable since the SURF keypoint detector produces even more false positive keypoints than SIFT which is shown in figure \ref{fig:ResultsKeypointFiltering}. So while this feature may not useful for SURF keypoints it is still effective for SIFT.

	\begin{figure}[htb]
		\centering
		\hspace{\fill}%
		\subfloat[1102 unfiltered \gls{surf} keypoints]{\includegraphics[width=35mm]{data/images/results/resultsSURF_noFiltering}}
		\hspace{\fill}%
		\subfloat[500 filtered \gls{surf} keypoints]{\includegraphics[width=35mm]{data/images/results/resultsSURF_filtering}}
		\hspace{\fill}%
		\subfloat[835 unfiltered SIFT keypoints]{\includegraphics[width=35mm]{data/images/results/resultsSIFT_noFiltering}}
		\hspace{\fill}%
		\subfloat[500 filtered SIFT keypoints]{\includegraphics[width=35mm]{data/images/results/resultsSIFT_filtering}}
		\hspace{\fill}%
		\caption{Comparison of \gls{sift} and \gls{surf} keypoint filtering.}
		\label{fig:ResultsKeypointFiltering}
	\end{figure}

	\subsection{Bag of Words Dimension}
	\begin{figure}[htb]
		\centering
		\includegraphics[width=\linewidth]{figures/results_bow}
		\caption{Impact of bow vocabulary size on SIFT and SURF classifier performance. Test details: SI-2, SU-2}
		\label{fig:resultsBow}
	\end{figure}
	The size of the bag of words vocabulary is a very important parameter because the \gls{bow} histogram is the actual feature vector that is used for classification and not the feature vector from classifiers like SIFT or SURF. A bad \gls{bow} vocabulary can lead to poor classification performance even if the input feature vectors are good. One way to influence the \gls{bow} vocabulary is its size. Figure \ref{fig:resultsBow} visualizes the impact of the vocabulary size on the overall performance of the classifier. The best accuracy was achieved with a vocabulary size of 2250 for SIFT and 2500 for SURF. For SURF there is a significant positive correlation {(correlation: 0.695, p-value: 0.018)} between the vocabulary size and the accuracy in the interval $[250, 2750]$. The correlation of SIFT is not significant enough {(p-value: 0.063)}. Although the classifier performance for bigger vocabularies is higher, it is not feasible to use huge vocabularies since the training time also increases with an increasing \gls{bow} size.

	\subsection{Neural Networks}

	Training and performance of neural networks hugely depends on the selected architecture. In the course of this thesis 9 models were evaluated on small datasets. On the one hand, small datasets allow for fast training but on the other hand, neural networks need as many samples as possible and the dataset the neural nets were tested on were 8 classes from the 50-data dataset which only contains 100 images per class. The result of a relatively small convolutional neural network is shown in figure \ref{fig:overfittingNet}a and could serve as a perfect example of overfitting. The training and validation error both decrease till epoch 80. After the 80th epoch the training error continues to decrease but the validation error stagnates and even begins to increase after the 250th epoch.

	\subsubsection*{Dropout}
	\begin{figure}[htb]
		\centering
		\subfloat[No dropout]{\includegraphics[width=75mm]{figures/resultsCIFAR10_trainingLoss}}
		\subfloat[Two different dropout values]{\includegraphics[width=75mm]{figures/resultsCIFAR10_dropout}}
		\caption{Three different dropout settings on a small net which was originally used for training on CIFAR-10.}
		\label{fig:overfittingNet}
	\end{figure}
	A way to reduce overfitting is dropout {(see section \ref{subsec:overfittingDropout})}. Figure~\ref{fig:overfittingNet}b shows the training loss of two networks with same architecture as in figure \ref{fig:overfittingNet}b only this time with dropout applied before and after the dense layers. The blue lines correspond to a network with 0.5 dropout applied and the red and orange lines represent a network with 0.6 dropout applied. This time the network overfits much later than before and until epoch 1000 the validation loss for the second dropout setting is even less than the training loss. This is due to the fact that the dropout is only applied on the training data and not on the validation data.

	\subsubsection*{Data Augmentation}

	To further reduce overfitting and improve performance, augmentation on the data is performed {(see section \ref{subsec:dataAugmentation})}. Similar to the network with dropout in figure \ref{fig:overfittingNet}b, the validation loss is significantly lower than the testing loss. This is caused, because data augmentation is only applied on the training data. Depending on the \gls{cpu} and \gls{gpu} the additional time per epoch for data augmentation may vary but on the Azure virtual machine {(see section \ref{sec:hardware})} the average duration for each epoch increased from 5.41 to 24.1 seconds. Image value modifying operations like brightness or saturation adjustments are very time consuming. Disabling these operations can decrease the duration for each epoch from 24.1 back to 9.3 seconds and since this does not decrease the performance by that much {(in this specific example the loss even decreased. This could be caused by a better weight initialization.)}, the tradeoff between performance and epoch duration is acceptable.

	The training error for the network with no augmentation might not be that much higher but even after 1000 iterations the accuracy did not get better than the null score which indicates that the network did not learn at all and only predicted the majority class.

	\begin{table}[htbp]
		\centering
		\caption{Impact of data augmentation on the training of a small neural net on a 8-class dataset. All values are taken after 240 epochs of training.}
		\label{tab:result_augmentation}
		\begin{tabular}{lccc}
			\hline
			\multicolumn{1}{c}{} 				& train loss {(\gls{ace})}  & valid loss {(\gls{ace})}  & duration {(seconds)} \\ \hline
			Augmentation    				& 2.069	 	& 2.066		& 24.116 			\\
			Augmentation, no value changes  & 2.022		& 2.015     & 9.262
			    			\\
			No Augmentation                		& 2.295	& 2.295 	& 5.412		        \\ \bottomrule
		\end{tabular}
	\end{table}

\section{Results for Food Classification}
\begin{figure}[htbp]
	\centering
	\begin{tabular}{cc}
		\subfloat[SIFT]{\includegraphics[width=50mm]{figures/results_SIFT_confMatrix}} &
		\subfloat[SURF]{\includegraphics[width=50mm]{figures/results_SURF_confMatrix}} \\

		\subfloat[ORB]{\includegraphics[width=50mm]{figures/results_ORB_confMatrix}} &
		\subfloat[LBP]{\includegraphics[width=50mm]{figures/results_LBP_confMatrix}} \\

		\subfloat[Color Histograms]{\includegraphics[width=50mm]{figures/results_HIST_confMatrix}} &
		\\
	\end{tabular}
	\caption{Confusion matrix for Top-1 performance on the 50-data dataset validation segment.}
	\label{fig:results_conv}
\end{figure}
In this section the classifiers {(except neural nets)} are tested on the 50-data dataset and table \ref{tab:results} shows the results of this evaluation.

\begin{table}[htbp]
	\centering
	\caption{Evaluation results for feature classifier training on the 50-data dataset.}
	\label{tab:results}
	\begin{tabular}{lccc}
		\hline
		\multicolumn{1}{c}{} 					& Top-1 accuracy  & Top-5 accuracy 	\\ \hline
		\gls{sift} + \gls{bow} + $\chi^2$ \gls{svm}	& 0.3576	 		  & 0.7203			\\
		\gls{surf} + \gls{bow} + $\chi^2$ \gls{svm}	& \underline{0.4028}	 		  & \underline{0.7496}			\\
		\gls{orb} +  \gls{bow} + $\chi^2$ \gls{svm}	& 0.2011	 		  & 0.5136			\\
		\gls{censure} + \gls{bow} + $\chi^2$ \gls{svm}	& 0.2217	 	  & 0.7341			\\
		\gls{lbp} + Poly \gls{svm}					& 0.119	 		  & 0.3036			\\
		Color histograms + $\chi^2$ \gls{svm}		& 0.2931		  & 0.6715			\\ \hline
	\end{tabular}
\end{table}

\subsection{SIFT}
\begin{figure}[htbp]
	\centering
	\subfloat[SIFT]{\includegraphics[width=75mm]{figures/results_SIFT_50data_roc}}
	\subfloat[SURF]{\includegraphics[width=75mm]{figures/results_SURF_50data_roc}}
	\caption{Precision recall curve for SIFT and SURF on the 50data dataset validation segment.}
	\label{fig:results_SIFTSURFroc}
\end{figure}

The \gls{sift} feature classifier was evaluated with an image area size of 262,144 pixels. 1088 weighted and augmented keypoints were extracted. This produced an feature vector with 139,264 dimensions. A bag of words vocabulary with the size of 2500 was used and the classification was done by a $\chi^2$ \gls{svm}. Prior to these settings, a \gls{sift} classifier with a much smaller image size and bow vocabulary was tested against the dataset but it only achieved an accuracy of 0.282. By increasing the image size the accuracy could be improved to 0.3576.

\subsection{SURF}

\gls{surf} was tested using an image size of 262,144 {(corresponds to $512 \times 512$)} pixels and 1088 keypoints per image so each image produces a 104,448 dimensional feature vector. The vectors are quantified in a 2500 bin bag of words. Keypoint filtering and keypoint sampling are both turned off. For classification a $\chi^2$ \gls{svm} is used.

SURF achieves the best overall accuracy of 0.4028 which outperforms every other classifier.

\subsection{Color Histogram}
The histogram classifier was tested with an image size of 16384 pixels {($128 \times 128$)}, 16 image segments, 150 histogram bins using the \gls{hsv} color space and $\chi^2$ \glspl{svm}. This model achieved a validation accuracy of 0.7285 on the 8-class parameter optimization dataset.

\subsubsection*{50-data}
\begin{figure}[htbp]
	\centering
	\subfloat[Color Histogram]{\includegraphics[width=75mm]{figures/results_HIST_50data_roc}}
	\subfloat[ORB]{\includegraphics[width=75mm]{figures/results_ORB_50data_roc}}
	\caption{Precision recall curve for color histograms and ORB on the 50-data dataset validation segment.}
	\label{fig:results_HISTORBroc}
\end{figure}

On the full 50-data dataset the histogram classifier achieved an average top-1 validation accuracy of 0.2931. This is 14.7 times better than the null score. The standard deviation of the validation accuracy across all 50 classes is 0.151.

Figure \ref{fig:results_HISTORBroc}a shows the precision recall curve for the two best and worst classes as well as 3 classes around the median of the Top-1 validation accuracy. Figure \ref{fig:results_conv}f shows the confusion matrix for the histogram evaluation.

The histogram classifier had the most problems with "fish and chips" and "stinky tofu". The color of the class "Fish and chips" is very similar to the class "fried food" and "fish and chips" gets often confused with "fried food".
The two classes with the highest accuracy are "pizza" and "gongbao chicken".

\subsubsection*{Food-10}

The computational cost for the training of color histograms is very low. Therefore, this classifier was also tested on the much larger Food-100 dataset. The classifier was tested using 5-fold cross validation and achieved an average Top-1 accuracy on the validation set of 0.1758 with a maximum accuracy of 0.185.

\subsection{ORB}

\gls{orb} was tested with 1088 keypoints per image with both keypoint filtering and random point sampling turned on. A \gls{bow} with a vocabulary size of 2000 bins was used and images were loaded with a size of 262,144 pixels. For classification, a $\chi^2$ \gls{svm} was utilized.

The model achieved an accuracy of 0.2011 with a standard deviation over the accuracy of 0.1027. The accuracy is only half as good as \gls{surf} features. Nonetheless, this is still a better result than expected. \gls{orb} uses \gls{brief} as a descriptor which is a binary-test descriptor but the clustering used for the vocabulary creation by the OpenCV library is only indented to be used with floating point descriptors. So the descriptor clustering is not optimal for an \gls{orb} classifier which explains the poor performance.

Figure \ref{fig:results_HISTORBroc}b shows the precision recall curve for \gls{orb}. "Sausages" and "Potato chips" achieved the highest accuracies and "Goi cuon" and "ice cream" achieved the lowest accuracies.

\subsection{LBP}
\gls{lbp} achieved an accuracy of 0.119 which is only barely better than the null score. This is probably due to the fact that the basic LBP is a texture classifier and only contrast and illumination invariant. For food, however, rotation invariance is very important since food has no dominant orientation and plates can be freely rotated.
\subsection{CenSurE}
\gls{censure} was trained on images with the size 262,144 with the keypoint filtering turned off because the \gls{censure} \gls{api} of skimage does not provide a keypoint response so the score can not be calculated. SURF was used as the keypoint descriptor. Therefore, the number of extracted keypoints and the size of the bag of words vocabulary are the same. Since this is also a classifier with a \gls{bow}, the $\chi^2$ SVM kernel was used. The training of \gls{censure} took almost 33 hours and the top-1 accuracy is not very good. The top-5 accuracy, however, is very good and is actually the second best performance.

\subsection{Neural Network}
Three convolutional neural network architectures were used for evaluation. The first one is a deep \gls{cnn} with 15 layers:
\newline \newline
\begin{tabular}{lll}
	\textbf{Input} & $3 \times 48 \times 48$ &  \\
	\textbf{Convolutional Layer} & $32 \times 46 \times 46$ & $5 \times 5$ filters\\
	\textbf{Max Pooling Layer} & $32 \times 23 \times 23$ & $2 \times 2$ pooling\\
	\textbf{Dropout} & & 0.3\\

	\textbf{Convolutional Layer} & $64 \times 21 \times 21$ & $5 \times 5$ filters\\
	\textbf{Max Pooling Layer} & $64 \times 10 \times 10$ & $2 \times 2$ pooling\\
	\textbf{Dropout} & & 0.5\\

	\textbf{Convolutional Layer} & $128 \times 8 \times 8$ & $3 \times 3$ filters\\
	\textbf{Max Pooling Layer} & $128 \times 4 \times 4$ & $2 \times 2$ pooling\\
	\textbf{Dropout} & & 0.6\\

	\textbf{Dense Layer} & $512$ & \\
	\textbf{Dropout} & & 0.7\\
	\textbf{Dense Layer} & $512$ & \\
	\textbf{Dropout} & & 0.7\\

	\textbf{Output Layer} & 6 & \\
\end{tabular}
\newline\newline
On 6 food classes this architecture achieved an accuracy of 0.2487 after 375 epochs and 7.5 hours of training.

The second network is a very small and compact 8-layer convolutional network:
\newline \newline
\begin{tabular}{lll}
	\textbf{Input} & $3 \times 32 \times 32$ &  \\
	\textbf{Convolutional Layer} & $20 \times 32 \times 32$ & $5 \times 5$ filters\\
	\textbf{Max Pooling Layer} & $20 \times 16 \times 16$ & $2 \times 2$ pooling\\

	\textbf{Convolutional Layer} & $20 \times 16 \times 16$ & $5 \times 5$ filters\\
	\textbf{Max Pooling Layer} & $20 \times 8 \times 8$ & $2 \times 2$ pooling\\
	\textbf{Dropout} & & 0.5\\

	\textbf{Dense Layer} & $1000$ & \\
	\textbf{Output Layer} & 8 & \\
\end{tabular}
\newline \newline
The advantage of this network is the fast training time and the ability to train it on smaller datasets. The network was trained on a 8 class subsample of the 50-data dataset and achieved a Top-1 accuracy of 0.4857 after 1912 epochs of training.

\section{Results for Size Estimation}

The image segmentation and size estimation modules are simple proof of concepts and were therefore only tested on images of menus from the canteen in Garching for the multi food item segmentation as well as home cooked, single type meals for the meal segmentation. All images were taken using a 41 mega pixel smartphone camera and were resized to fit a resolution of $1000 \times 564$.

\subsection{Single Meal Segmentation and Size Estimation}
\begin{figure}[htb]
	\centering
	\hspace{\fill}%
	\subfloat[canteen menu 1]{\includegraphics[height=18mm]{data/images/results/segmentation/resultsMarker_4_regions}}
	\hspace{\fill}%
	\subfloat[canteen menu 2]{\includegraphics[height=18mm]{data/images/results/segmentation/resultsMarker_5_regions}}
	\hspace{\fill}%
	\subfloat[single food 1]{\includegraphics[height=18mm]{data/images/results/segmentation/resultsMarker_3_regions}}
	\hspace{\fill}%
	\subfloat[single food 2]{\includegraphics[height=18mm]{data/images/results/segmentation/resultsMarker_6_regions}}
	\hspace{\fill}%
	\caption{Meal region segmentation and size estimation. Calculated meal sizes: {(a)} $1577 cm^2$, {(b)} $1586 cm^2$, {(c)} $616 cm^2$, {(d)} $654 cm^2$}
	\label{fig:mealSegmentation}
\end{figure}

If the image of the food is taken from above with a clutter free and low contrast background the meal segmentation is reasonably fast and accurate. Almost all images were correctly segmented. Figure \ref{fig:mealSegmentation} shows 4 examples of the image segmentation with two canteen multi food menus measured with a custom marker and two single food images one with the custom marker and one with a chessboard marker. The difference between \ref{fig:mealSegmentation}a and \ref{fig:mealSegmentation}b is only $9 (cm)^2$ and $38 (cm)^2$ between the other two.

Marker recognition is not a problem either although there are issues with low contrast markers or markers that are too small or not rectangular. Due to SIFT's rotational invariance the recognition of rotated markers is still accurate. In figure \ref{fig:mealSegmentation}a the marker is rotated by 90\degree but the measurement and recognition is still accurate. Chessboard markers {(figure \ref{fig:mealSegmentation}d)} are even more accurate than arbitrary markers since they provide more fixed reference points.

\subsection{Multi Meal Segmentation and Size Estimation}
\begin{figure}[htb]
	\centering
	\hspace{\fill}%
	\subfloat[original image {(cropped)}]{\includegraphics[height=20mm]{data/images/results/segmentation/results_1_original}}
	\hspace{\fill}%
	\subfloat[filtered image]{\includegraphics[height=20mm]{data/images/results/segmentation/resultsMarker_1_regionsArea-2}}
	\hspace{\fill}%
	\subfloat[filtered image]{\includegraphics[height=20mm]{data/images/results/segmentation/resultsMarker_1_regionsArea-3}}
	\hspace{\fill}%
	\subfloat[filtered image]{\includegraphics[height=20mm]{data/images/results/segmentation/resultsMarker_1_regionsArea-1}}
	\hspace{\fill}%
	\subfloat[filtered image]{\includegraphics[height=20mm]{data/images/results/segmentation/resultsMarker_1_regionsArea-4}}
	\caption{Color filtering of 4 food items.}
	\label{fig:foodItemSegmentation}
\end{figure}
Although generally the concept of multi meal region segmentation works, this feature is still a work in progress and should be further developed in future works. Figure \ref{fig:foodItemSegmentation} shows images of the current state of the multi meal region segmentation. The problem here is, that dark or very bright colors are sometimes not correctly filtered. In addition there are issues with overlapping bounding boxes that can cause objects to be recognized multiple times because if two colors are to similar to each other they filter the same object.


\subsection{Attention and Neural Turing Machines}


\section{Score functions}


\chapter{Summary}

In this bachelor thesis the need of neural information retrieval models was
    depicted.
This work highlights theoretic aspects and objectives of
    two IR models that use different neural approaches.
The thesis' first theoretic part was dedicated to
    the Neural Vector Space Model (NVSM) from Van Gysel et al.,
    that uses unsupervised learning to learn low-dimensional representations
    of words and documents, and to learn a transformation function between
    a word and document feature space.
Besides that, the Standalone Neural Ranking Model (SNRM) from Zamani et al.
    was examined,
    that utilizes supervised learning to generate high-dimensional sparse
    represenations out of query and document text with the intention
    to construct an inverted index for ranking.

Further, the practical focus was first to implement missing but necessary
    functionality in the original SNRM source code and to
    extend the SNRM to work with
    Microsoft's MS MARCO passage ranking dataset.
In the next step, the original and extended version of the SNRM was
    migrated from TensorFlow version 1 to a
    version of PyTorch that was the most recent at the time of
    implementation.
In the bachelor thesis the challenges and problems in experiments and
    in reproducting the results of Zamani et al. were described in detail.
Unfortunately, the original SNRM source code and the paper lack
    information concerning reproduction of the results.
Despite, making assumptions of originally used sofware versions,
    implementation details,
    chosen hyper parameters and configurations, it was neither possible
    with the extended TensorFlow nor with the PyTorch implementation of the SNRM
    to reproduce the same or similar results of the authors
    with the MS MARCO dataset.
Primarily, it was difficult to control the sparsity of
    learned representations, so that they are just sparse enough for
    efficient inverted index construction.
By adjusting the neural network architecture,
    trying different configurations and adapting the loss computation
    among others,
    it was possible to generate a model with roughly sufficient sparsity,
    however the trained model was never able to learn semantic relations
    between words in retrieval experiments,
    and therefore an evaluation of the model's retrieval performance could not
    be presented.
Due to the lack of a personal NVIDIA GPU for GPU-accelerated model training
    and the limitations of Google Colaboratory, experiments were further
    constrainted.

The migrated PyTorch implementation of the SNRM serves as a starting point
    to make it easier to keep up to date with future versions of PyTorch
    and to support those who are familiar with PyTorch but not with TensorFlow
    to reproduce the SNRM's results.
Further experiments with a different training dataset are imagineable.
Possibly, the SNRM was not able to learn semantic meaning and word relations,
    since passage text's are naturally much shorter than document texts.
It may therefore be worth considering the use of a different training dataset
    containing longer document texts.


\subsection{Euler's equation}