%\VignetteIndexEntry{logcheby}
% 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{Logarithmic Chebyshev Approximation}


%% need no \usepackage{Sweave.sty}

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

\maketitle

For a $p \times n$ ($p > n$) matrix $\m{B}$ and $p \times 1$ vector $\ve{f}$, the Logarithmic Chebyshev Approximation problem is stated as the following optimization problem (\cite{vandenberghe1998determinant})

\[
\begin{array}{ll}
\underset{\ve{x},~t}{\text{minimize}} & t \\
\text{subject to} & \\
 & \begin{array}{rl}
1/t & \leq~~(\tr{\m{x}}\m{B}_{i\cdot})/\ve{f}_{i}~~\leq~~t, \quad i = 1,...,p
\end{array}
\end{array}
\]

\noindent where $\m{B}_{i\cdot}$ denotes the $i^{th}$ row of the matrix $\m{B}$. Note that we require each element of $\m{B}_{\cdot j}/\ve{f}$ to be greater than or equal to 0 for all $j$. 

The function \verb!logcheby! takes as input a matrix \verb!B! and vector \verb!f!, and returns the solution to the Logarithmic Chebyshev Approximation problem using \verb!sqlp!.

\begin{verbatim}
R> out <- logcheby(B,f)
\end{verbatim}

\section*{Numerical Example}

As a numerical example, consider the following

\begin{verbatim}
R> data(Blogcheby)

         V1    V2    V3    V4    V5
 [1,] 9.148 9.040 3.796 6.756 5.816
 [2,] 9.371 1.387 4.358 9.828 1.579
 [3,] 2.861 9.889 0.374 7.595 3.590
 [4,] 8.304 9.467 9.735 5.665 6.456
 [5,] 6.417 0.824 4.318 8.497 7.758
 [6,] 5.191 5.142 9.576 1.895 5.636
 [7,] 7.366 3.902 8.878 2.713 2.337
 [8,] 1.347 9.057 6.400 8.282 0.900
 [9,] 6.570 4.470 9.710 6.932 0.856
[10,] 7.051 8.360 6.188 2.405 3.052
[11,] 4.577 7.376 3.334 0.430 6.674
[12,] 7.191 8.111 3.467 1.405 0.002
[13,] 9.347 3.881 3.985 2.164 2.086
[14,] 2.554 6.852 7.847 4.794 9.330
[15,] 4.623 0.039 0.389 1.974 9.256
[16,] 9.400 8.329 7.488 7.194 7.341
[17,] 9.782 0.073 6.773 0.079 3.331
[18,] 1.175 2.077 1.713 3.755 5.151
[19,] 4.750 9.066 2.611 5.144 7.440
[20,] 5.603 6.118 5.144 0.016 6.192

R> data(flogcheby)

         V1
 [1,] 0.626
 [2,] 0.217
 [3,] 0.217
 [4,] 0.389
 [5,] 0.942
 [6,] 0.963
 [7,] 0.740
 [8,] 0.733
 [9,] 0.536
[10,] 0.002
[11,] 0.609
[12,] 0.837
[13,] 0.752
[14,] 0.453
[15,] 0.536
[16,] 0.537
[17,] 0.001
[18,] 0.356
[19,] 0.612
[20,] 0.829
\end{verbatim}

Note that it must be the case that each element of $\m{B}_{\cdot j}/\ve{f}$ must be greater than or equal to $0$ for every column of $\m{B}$.

\begin{verbatim}
R> out <- logcheby(Blogcheby, flogcheby)
\end{verbatim}

Here, the outputs of interest are the optimal value of the objective function (which again we need to negagate due to the negation of the objective function), and the vector $\ve{X}$, which is stored in the output variable \verb!y!.

\begin{verbatim}
R> -out$pobj

[1] 23.08812

R> m <- ncol(Blogcheby)
R> x <- out$y[1:m]

            [,1]
[1,] 0.001106650
[2,] 0.002661286
[3,] 0.001050662
[4,] 0.002180275
[5,] 0.001435069
\end{verbatim}

\bibliographystyle{plain}
\bibliography{sdpt3r}
\end{document}