2
0
Fork 0
CVE/LaTeX/notes.tex

61 lines
2.3 KiB
TeX
Raw Normal View History

2019-09-25 12:49:12 +00:00
\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath, amsfonts, amssymb, amsthm}
2019-10-18 07:06:36 +00:00
\usepackage{tikz}
2019-09-25 12:49:12 +00:00
\usepackage{fullpage}
\newcommand{\vecl}{\ensuremath{\operatorname{vec}_l}}
\newcommand{\Sym}{\ensuremath{\operatorname{Sym}}}
\begin{document}
Indexing a given matrix $A = (a_{ij})_{i,j = 1, ..., n} \in \mathbb{R}^{n\times n}$ given as
\begin{displaymath}
A = \begin{pmatrix}
a_{0,0} & a_{0,1} & a_{0,2} & \ldots & a_{0,n-1} \\
a_{1,0} & a_{1,1} & a_{1,2} & \ldots & a_{1,n-1} \\
a_{2,0} & a_{2,1} & a_{2,2} & \ldots & a_{2,n-1} \\
\vdots & \vdots & \vdots & \ddots & \vdots \\
a_{n-1,0} & a_{n-1,1} & a_{n-1,2} & \ldots & a_{n-1,n-1}
\end{pmatrix}
\end{displaymath}
A symmetric matrix with zero main diagonal, meaning a matrix $S = S^T$ with $S_{i,i} = 0,\ \forall i = 1,..,n$ is givne in the following form
\begin{displaymath}
S = \begin{pmatrix}
0 & s_{1,0} & s_{2,0} & \ldots & s_{n-1,0} \\
s_{1,0} & 0 & s_{2,1} & \ldots & s_{n-1,1} \\
s_{2,0} & s_{2,1} & 0 & \ldots & s_{n-1,2} \\
\vdots & \vdots & \vdots & \ddots & \vdots \\
s_{n-1,0} & s_{n-1,1} & s_{n-1,2} & \ldots & 0
\end{pmatrix}
\end{displaymath}
Therefore its sufficient to store only the lower triangular part, for memory efficiency and some further alrogithmic shortcuts (sometime they are more expencife) the symmetric matrix $S$ is stored in packed form, meanin in a vector of the length $\frac{n(n-1)}{2}$. We use (like for matrices) a column-major order of elements and define the $\vecl:\Sym(n)\to \mathbb{R}^{n(n-1) / 2}$ opperator defined as
\begin{displaymath}
\vecl(S) = (s_{1,0}, s_{2,0},\cdots,s_{n-1,0},s_{2,1}\cdots,s_{n-1,n-2})^T
\end{displaymath}
The relation between the matrix indices $i,j$ and the $\vecl$ index $k$ is given by
\begin{displaymath}
(\vecl(S)_k = s_{i,j} \quad\Leftrightarrow\quad k = jn+i) : j \in \{0,...,n-2\} \land j < i < n.
\end{displaymath}
2019-10-18 07:06:36 +00:00
\begin{center}
\begin{tikzpicture}[xscale=1,yscale=-1]
% \foreach \i in {0,...,5} {
% \node at ({mod(\i, 3)}, {int(\i / 3)}) {$\i$};
% }
\foreach \i in {1,...,4} {
\foreach \j in {1,...,\i} {
\node at (\j, \i) {$\i,\j$};
}
}
\end{tikzpicture}
\end{center}
2019-09-25 12:49:12 +00:00
\end{document}