From eeadb9c72661c1eaceae461c8af9580e4e5e5488 Mon Sep 17 00:00:00 2001 From: Andreas Tsouchlos Date: Fri, 7 Apr 2023 16:58:22 +0200 Subject: [PATCH] Added first version of proximal implementation details --- latex/thesis/chapters/proximal_decoding.tex | 61 +++++++++++++++++++ .../chapters/theoretical_background.tex | 11 ++++ 2 files changed, 72 insertions(+) diff --git a/latex/thesis/chapters/proximal_decoding.tex b/latex/thesis/chapters/proximal_decoding.tex index 00d2803..3f7099b 100644 --- a/latex/thesis/chapters/proximal_decoding.tex +++ b/latex/thesis/chapters/proximal_decoding.tex @@ -252,6 +252,67 @@ return $\boldsymbol{\hat{c}}$ \section{Implementation Details}% \label{sec:prox:Implementation Details} +The algorithm as first implemented in Python because of the fast development +process and straightforward debugging. +They have subsequently been reimplemented in C++ using the Eigen% +\footnote{\url{https://eigen.tuxfamily.org}} +linear algebra library to achieve higher performance. +The focus has been set on a fast implementation, sometimes at the expense of +memory usage. +The evaluation of the simulation results has been wholly realized in Python. + +The gradient of the code-constraint polynomial is given by \cite[Sec. 2.3]{proximal_paper}% +% +\begin{align*} + \nabla h\left( \boldsymbol{x} \right) &= \begin{bmatrix} + \frac{\partial}{\partial x_1}h\left( \boldsymbol{x} \right) & + \ldots & + \frac{\partial}{\partial x_n}h\left( \boldsymbol{x} \right) & + \end{bmatrix}^\text{T}, \\[1em] + \frac{\partial}{\partial x_k}h\left( \boldsymbol{x} \right) &= 4\left( x_k^2 - 1 \right) x_k + + \frac{2}{x_k} \sum_{j\in N_v\left( k \right) }\left( + \left( \prod_{i \in N_c\left( j \right)} x_i \right)^2 + - \prod_{i\in N_c\left( j \right) } x_i \right) +.\end{align*} +% +Evidently, the products +$\prod_{i\in N_c\left( j \right) } x_i,\hspace{1mm}\forall i\in \mathcal{J}$ +can be precomputed, as they are the same for all components $x_k$ of $\boldsymbol{x}$. +Defining% +% +\begin{align*} + \boldsymbol{p} := \begin{bmatrix} + \prod_{i\in N_c\left( 1 \right) }x_i \\ + \vdots \\ + \prod_{i\in N_c\left( m \right) }x_i \\ + \end{bmatrix} + \hspace{5mm} + \text{and} + \hspace{5mm} + \boldsymbol{v} := \boldsymbol{p}^{\circ 2} - \boldsymbol{p} +,\end{align*} +% +the gradient can be written as% +% +\begin{align*} + \nabla h\left( \boldsymbol{x} \right) = + 4\left( \boldsymbol{x}^{\circ 3} - \boldsymbol{x} \right) + + 2\boldsymbol{x}^{\circ -1} \circ \boldsymbol{H}^\text{T} + \boldsymbol{v} +,\end{align*} +% +enabling the computation of the gradient primarily with element-wise +operations and matrix-vector multiplication. +This is beneficial, as the libraries used for the implementation are +heavily optimized for such calculations (e.g., through vectorization of the +operations). +\todo{Note about how the equation with which the gradient is calculated is +itself similar to a message-passing rule} + +The projection $\prod_{\eta}\left( . \right)$ also proves straightforward to +compute, as it amounts to simply clipping each component of the vector onto +$[-\eta, \eta]$ individually. + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \section{Results}% diff --git a/latex/thesis/chapters/theoretical_background.tex b/latex/thesis/chapters/theoretical_background.tex index 1b21d03..ee1d77a 100644 --- a/latex/thesis/chapters/theoretical_background.tex +++ b/latex/thesis/chapters/theoretical_background.tex @@ -32,6 +32,17 @@ of indexed variables:% x_{\left[ m:n \right] } &:= \left\{ x_m, x_{m+1}, \ldots, x_{n-1}, x_n \right\} .\end{align*} % +In order to designate elemen-twise operations, in particular the\textit{Hadamard product} +and the \textit{Hadamard power}, the operator $\circ$ will be used:% +% +\begin{alignat*}{3} + \boldsymbol{a} \circ \boldsymbol{b} + &:= \begin{bmatrix} a_1 b_1 & \ldots & a_n b_n \end{bmatrix} ^\text{T}, + \hspace{5mm} &&\boldsymbol{a}, \boldsymbol{b} \in \mathbb{R}^n, \hspace{2mm} n\in \mathbb{N} \\ + \boldsymbol{a}^{\circ k} &:= \begin{bmatrix} a_1^k \ldots a_n^k \end{bmatrix}^\text{T}, + \hspace{5mm} &&\boldsymbol{a} \in \mathbb{R}^n, \hspace{2mm}k\in \mathbb{Z} +.\end{alignat*} +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%