%\VignetteIndexEntry{minelips}
% JSS Article Template
\documentclass{article}


%%% Additional Packages %%%

% Algorithms
% http://tex.stackexchange.com/questions/229355/algorithm-algorithmic-algorithmicx-algorithm2e-algpseudocode-confused
\usepackage{algorithm}% http://ctan.org/pkg/algorithms
\usepackage{algpseudocode}% http://ctan.org/pkg/algorithmicx


% Font stuff
\usepackage[T1]{fontenc}% for correct hyphenation and T1 encoding
%\usepackage{lmodern}% latin modern font
\usepackage[american]{babel}% for American English

% Math fonts/symbols
\usepackage{amsmath}% sophisticated mathematical formulas with amstex (includes \text{})
\usepackage{mathtools}% fix amsmath deficiencies
\usepackage{amssymb}% sophisticated mathematical symbols with amstex
\usepackage{amstext}% ams mathematical fonts
\usepackage{amsfonts}% ams mathematical fonts

% Figures
\usepackage{graphicx}% for including figures

%%% Commands %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% vetors
\newcommand{\ve}[1]{\mathbf{#1}}           % for vetors
\newcommand{\sv}[1]{\boldsymbol{#1}}   % for greek letters
\newcommand{\m}[1]{\mathbf{#1}}               % for matrices
\newcommand{\sm}[1]{\boldsymbol{#1}}   % for greek letters
\newcommand{\tr}[1]{{#1}^{\mkern-1.5mu\mathsf{T}}}              % for transpose
\newcommand{\norm}[1]{||{#1}||}              % for transpose
\newcommand*{\mve}{\operatorname{ve}}
\newcommand*{\trace}{\operatorname{trace}}
\newcommand*{\rank}{\operatorname{rank}}
\newcommand*{\diag}{\operatorname{diag}}
\newcommand*{\vspan}{\operatorname{span}}
\newcommand*{\rowsp}{\operatorname{rowsp}}
\newcommand*{\colsp}{\operatorname{colsp}}
\newcommand*{\svd}{\operatorname{svd}}
\newcommand*{\edm}{\operatorname{edm}}  % euclidean distance matrix (D * D)


% statistical
\newcommand{\widebar}[1]{\overline{#1}}  

% 
% operators
\newcommand{\Had}{\circ}
\DeclareMathOperator*{\lmin}{Minimize}
\DeclareMathOperator*{\argmin}{arg\,min}
\DeclareMathOperator*{\argmax}{arg\,max}
\DeclareMathOperator*{\arginf}{arg\,inf}
\DeclareMathOperator*{\argsup}{arg\,sup}
%\newcommand*{\arginf}{\operatorname*{arginf}}
%\newcommand*{\argsup}{\operatorname*{argsup}}

% Sets
\newcommand*{\intersect}{\cap}
\newcommand*{\union}{\cup}
\let\oldemptyset\emptyset
\let\emptyset\varnothing

% Fields, Reals, etc. etc
\newcommand{\field}[1]{\mathbb{#1}}
\newcommand{\Reals}{\field{R}}
\newcommand{\Integers}{\field{Z}}
\newcommand{\Naturals}{\field{N}}
\newcommand{\Complex}{\field{C}}
\newcommand{\Rationals}{\field{Q}}

% Hyphenation
\hyphenation{Ar-chi-me-dean}

% Editorial
\newcommand*{\TODO}[1]{\textcolor{red}{TODO: #1}}
\newcommand*{\NOTE}[1]{\textcolor{blue}{Note: #1}}
\newtheorem{theorem}{Theorem}
\newtheorem{Proof}{Proof}

\usepackage[total={6.5in,8.75in}, top=0.9in, left=0.7in, right=0.7in, includefoot]{geometry}


% Misc
%\makeatletter
%\newcommand\myisodate{\number\year-\ifcase\month\or 01\or 02\or 03\or 04\or 05\or 06\or 07\or 08\or 09\or 10\or 11\or 12\fi-\ifcase\day\or 01\or 02\or 03\or 04\or 05\or 06\or 07\or 08\or 09\or 10\or 11\or 12\or 13\or 14\or 15\or 16\or 17\or 18\or 19\or 20\or 21\or 22\or 23\or 24\or 25\or 26\or 27\or 28\or 29\or 30\or 31\fi}% create iso date
\makeatother
%\newcommand*{\abstractnoindent}{}% define abstract such that it has no indent
%\let\abstractnoindent\abstract
%\renewcommand*{\abstract}{\let\quotation\quote\let\endquotation\endquote
%  \abstractnoindent}
%\deffootnote[1em]{1em}{1em}{\textsuperscript{\thefootnotemark}}% setting for footnote

\author{Adam Rahman}
\title{Minimum Volume Ellipsoids}


%% need no \usepackage{Sweave.sty}

\begin{document}
\SweaveOpts{concordance=FALSE}

\maketitle

The problem of finding the ellipsoid of minimum volume containing a set of points $\ve{v}_{1},...,\ve{v}_{n}$ is stated as the following optimization problem (\cite{vandenberghe1998determinant})

\[
\begin{array}{ll}
\underset{\m{B},~\ve{d}}{\text{maximize}} & log~det(\m{B}) \\
\text{subject to} & \\
& \begin{array}{rl}
||\m{B}\ve{x} + \ve{d}|| &\leq~~ 1, \quad \forall~]ve{x}~\in~[\ve{v}_{1},...,\ve{v}_{n}]
\end{array}
\end{array}
\]

The function \verb!minelips! takes as input an $n \times p$ matrix $\m{V}$ containing the points around which we would like to find the minimum volume ellipsoid, and returns the optimal solution using \verb!sqlp!.

\begin{verbatim}
R> out <- minelips(V)
\end{verbatim}

\section*{Numerical Example}

We consider a small point configuration of size 25 in two dimensions.

\begin{verbatim}
R> data(Vminelips)

          V1     V2
 [1,]  1.371 -0.430
 [2,] -0.565 -0.257
 [3,]  0.363 -1.763
 [4,]  0.633  0.460
 [5,]  0.404 -0.640
 [6,] -0.106  0.455
 [7,]  1.512  0.705
 [8,] -0.095  1.035
 [9,]  2.018 -0.609
[10,] -0.063  0.505
[11,]  1.305 -1.717
[12,]  2.287 -0.784
[13,] -1.389 -0.851
[14,] -0.279 -2.414
[15,] -0.133  0.036
[16,]  0.636  0.206
[17,] -0.284 -0.361
[18,] -2.656  0.758
[19,] -2.440 -0.727
[20,]  1.320 -1.368
[21,] -0.307  0.433
[22,] -1.781 -0.811
[23,] -0.172  1.444
[24,]  1.215 -0.431
[25,]  1.895  0.656

R> out <- minelips(Vminelips)
\end{verbatim}

Here, the output we are interested in $\m{B}$ and $\ve{d}$ are stored in the output vector \verb!y!, but not in a straightforward way. 

\begin{verbatim}
R> y <- out$y

           [,1]
[1,] 0.37878339
[2,] 0.48368646
[3,] 0.01425185
[4,] 0.12947058
[5,] 0.17165170

R> p <- ncol(Vminelips)

R> B <- diag(y[1:p])
R> tmp <- p
R> for(k in 1:(p-1)){
R>    B[(k+1):p,k] <- y[tmp + c(1:(p-k))]
R>    B[l,(k+1):p] <- B[(k+1):p,k]
R>    tmp <- tmp + p - k
R> }

R> d <- y[(tmp+1):length(y)]
\end{verbatim}

\bibliographystyle{plain}
\bibliography{sdpt3r}

\end{document}