main.tex (8151B)
1 \documentclass[a4paper]{article} 2 3 4 \usepackage[T1]{fontenc} 5 \usepackage[utf8]{inputenc} 6 \usepackage{mathptmx} 7 8 %\usepackage{ngerman} % Sprachanpassung Deutsch 9 10 \usepackage{graphicx} 11 \usepackage{geometry} 12 \geometry{a4paper, top=15mm} 13 14 \usepackage{subcaption} 15 \usepackage[shortlabels]{enumitem} 16 \usepackage{amssymb} 17 \usepackage{amsthm} 18 \usepackage{mathtools} 19 \usepackage{braket} 20 \usepackage{bbm} 21 \usepackage{graphicx} 22 \usepackage{float} 23 \usepackage{yhmath} 24 \usepackage{tikz} 25 \usetikzlibrary{patterns,decorations.pathmorphing,positioning} 26 \usetikzlibrary{calc,decorations.markings} 27 28 \usepackage[backend=biber, sorting=none]{biblatex} 29 \addbibresource{uni.bib} 30 31 \usepackage[framemethod=TikZ]{mdframed} 32 33 \tikzstyle{titlered} = 34 [draw=black, thick, fill=white,% 35 text=black, rectangle, 36 right, minimum height=.7cm] 37 38 39 \usepackage[colorlinks=true,naturalnames=true,plainpages=false,pdfpagelabels=true]{hyperref} 40 \usepackage[parfill]{parskip} 41 \usepackage{lipsum} 42 43 44 \usepackage{tcolorbox} 45 \tcbuselibrary{skins,breakable} 46 47 \pagestyle{myheadings} 48 49 \markright{Popovic\hfill 1st Exercise \hfill} 50 51 52 \title{University of Vienna\\ Faculty of Mathematics\\ 53 \vspace{1cm}TENSOR METHODS FOR DATA SCIENCE AND SCIENTIFIC COMPUTING \\ 1st 54 Exercise 55 } 56 \author{Milutin Popovic} 57 \date{24. October, 2021} 58 59 \begin{document} 60 \maketitle 61 \tableofcontents 62 63 \section{Introduction} 64 In the following we consider two functions $f$ and $g$ defined pointwise on 65 $[-1, 1]^2$ as 66 \begin{align} 67 f(x, y) &:= \frac{1}{1+x^2+y^2} \;\;\; \text{and}\\ 68 g(x, y) &:= \sqrt{x^2+y^2}\cdot\left(1+\frac{1}{2}cos(15x + 22x)\right), 69 \end{align} 70 for $x, y \in [-1, 1]$, with a grid of points $t$ of size $n=901$ 71 \begin{align} 72 t_i = 2\frac{i-1}{n-1}-1 \;\;\;\;\;\; i=1,\dots,n. 73 \end{align} 74 On this $n\times n$ grid we define two matrices $A$ and $B$ as the following 75 \begin{align} 76 (A)_{ij} &= a_{ij} := f(t_i, t_j)\;\;\; \text{and}\\ 77 (B)_{ij} &= b_{ij} := g(t_i, t_j), 78 \end{align} 79 for all $i, j \in \{1,\dots, n\}$. Throughout we denote $r$ as the rank of the 80 approximate factorization of $A$ or $B$, which actually only makes sense for 81 $r \leq rank(A)$ or $r \leq rank(B)$ accordingly. Since the matrices $A$ and 82 $B$ have the following ranks 83 \begin{align} 84 rank(A) = 8 \;\;\;\;\;\; rank(B) = 57, 85 \end{align} 86 only low rank approximations are valid and any rank approximation above the 87 matrix rank is not valid, e.g. $r=80$ approximation does not make any sense. 88 89 \section{Matrix approximation by SVD} 90 In this section we go through the error analysis in Forbenius and max norms 91 of the truncated SVD on the matrices $A$ and $B$. Considering a $n \times n$ 92 (real or complex matrix) $M$ them the truncated SVD of rank $r$ will give 93 an approximation of $M$, $\tilde{M}$ 94 \begin{align} 95 \tilde{M} = U \Sigma V^*, 96 \end{align} 97 where $U \in \mathbb{F}^{n \times r}$ ($\mathbb{F} = \mathbb{R} 98 \;\text{or}\;\; \mathbb{C}$), $\Sigma \in \mathbb{F}^{r \times r}$ 99 with $r$ largest singular values are the diagonal (else zero) and $V^{r 100 \times n}$. The computational errors of the TSVD approximation of $A$ and 101 $B$ are shown in figure \ref{fig:svd-err} below. 102 \begin{figure}[H] 103 \centering 104 \includegraphics[width=0.8\textwidth]{plots/svd-err.png} 105 \caption{\label{fig:svd-err}Error of rank $r$ truncated SVD approximation 106 of matrices $A$ and $B$ on a logarithmic scale} 107 \end{figure} 108 The error convergance can be explained by applying the Eckart-Young-Mirsky 109 theorem for functions f, g and their singular value decomposition of rank r explicitly. 110 In this sense both norms would be equivalent. Since we for a $p = 111 \{0,\cdots,r\}$ by the lecture script we have 112 \begin{align} 113 A_p = \sum_{k=1}^p \sigma_k u_k v^*_k. 114 \end{align} 115 Thus for $r \rightarrow rank(A)$ the sum would converge to the original 116 matrix $A$ making the difference 117 \begin{align} 118 ||A_p - A||_{F \;\text{or} 2} 119 \end{align} 120 minimal, converging to zero. 121 122 \section{Matrix approximation by LU without pivoting} 123 In this section we look at the errors formed by the LU approximation of the 124 leading principal submatrix without pivoting, when considering rank $r$ cross approximation 125 of the given matrix. Again we atone, that this procedure does not make sense 126 for a submatrix of a size above the rank of the original matrix, since for 127 the approximation the inverse of the submatrix is needed. Also on of the 128 criteria is that the leading principal submatrix is a matrix with maximal 129 volume and maximal rank. Obtaining the maximum volume submatrix is very 130 difficult\cite{survey}, thus we will use an algorithm called ``Maxvol'' 131 \cite{maxvol} to obtain a quasioptimal maximum volume submatrix. In this 132 let us say we are considering appropriate matrix $M$ to approximate, to 133 compute the quasioptimal submatrix we first need to select random $r$ columns 134 of $M$, then the algorithm ``Maxvol'' will do the rest of the work. Further out 135 we apply the LU decomposition on the leading principal submatrix without 136 pivoting and construct an approximation of $M$ by the cross approximation (as 137 in the lecture notes). The computational errors of the LU-cross approximation 138 without pivoting of $A$ and $B$ are shown in figure \ref{fig:lu-np-err} 139 below. 140 \begin{figure}[H] 141 \centering 142 \includegraphics[width=0.8\textwidth]{plots/lu-np-err.png} 143 \caption{\label{fig:svd-err}Error of rank $r$ LU-cross approximation 144 of matrices $A$ and $B$ on a logarithmic scale without pivoting} 145 \end{figure} 146 147 \section{Matrix approximation by LU with pivoting} 148 Here we follow the same procedure, where we cross approximate the matrix. 149 Only that now we consider a pivoted LU decomposition of the leading principal 150 submatrix.The computational errors of the LU-cross approximation with 151 pivoting of $A$ and $B$ are shown in figure \ref{fig:lu-np-err} below. 152 \begin{figure}[H] 153 \centering 154 \includegraphics[width=0.8\textwidth]{plots/lu-p-err.png} 155 \caption{\label{fig:svd-err}Error of rank $r$ LU-cross approximation 156 of matrices $A$ and $B$ on a logarithmic scale with pivoting} 157 \end{figure} 158 The convergence observed is that the bigger $r$, the less the error is. 159 By \cite{error-cross}, for a matrix $A$ and its according leading principal submatrix 160 $A_11$, of a rank exceeding $r$ we have 161 \begin{align} 162 ||\hat{A}- A||_{F/2} \leq(r+1)^2 \min_{rank(B) \leq r} ||A - B||_{F/2}. 163 \end{align} 164 Every increasing of $r$ in the LU-cross approximation we are ``nearer'' the 165 original matrix $A$. 166 \section{Understanding the basis rows and columns} 167 Here we show contour and surface plots of $f$ and $g$ on $[-1, 1]^2$ and 168 additionally color red the axis-parallel lines selected by the pivoted LU 169 algorithm above used for the cross approximation at $r = 1, 2, 3, 4, 5, 10, 170 15, 20, 30, 40$. Where for the matrix $A$ only lines for up to $rank(A) = 8$ 171 are dawn in. 172 \begin{figure}[H] 173 \centering 174 \includegraphics[width=.33\textwidth]{plots/rc-a-1.png}\hfill 175 \includegraphics[width=.33\textwidth]{plots/rc-a-2.png}\hfill 176 \includegraphics[width=.33\textwidth]{plots/rc-a-3.png} 177 \\[\smallskipamount] 178 \includegraphics[width=.49\textwidth]{plots/rc-a-4.png}\hfill 179 \includegraphics[width=.49\textwidth]{plots/rc-a-5.png} 180 \caption{Axis-parallel lines selected by the pivoted LU, of $f(x, y)$}\label{fig:foobar} 181 \end{figure} 182 \begin{figure}[H] 183 \centering 184 \includegraphics[width=.24\textwidth]{plots/rc-b-1.png}\hfill 185 \includegraphics[width=.24\textwidth]{plots/rc-b-2.png}\hfill 186 \includegraphics[width=.24\textwidth]{plots/rc-b-3.png}\hfill 187 \includegraphics[width=.24\textwidth]{plots/rc-b-4.png} 188 \\[\smallskipamount] 189 \includegraphics[width=.24\textwidth]{plots/rc-b-5.png}\hfill 190 \includegraphics[width=.24\textwidth]{plots/rc-b-10.png}\hfill 191 \includegraphics[width=.24\textwidth]{plots/rc-b-15.png}\hfill 192 \includegraphics[width=.24\textwidth]{plots/rc-b-20.png} 193 \\[\smallskipamount] 194 \includegraphics[width=.49\textwidth]{plots/rc-b-30.png}\hfill 195 \includegraphics[width=.49\textwidth]{plots/rc-b-40.png} 196 \caption{Axis-parallel lines selected by the pivoted LU, of $g(x, y)$}\label{fig:foobar} 197 \end{figure} 198 199 \nocite{code} 200 \printbibliography 201 \end{document}