Animation.tex 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  1. \documentclass[aspectratio=169,hyperref={pdfpagelabels=false}]{beamer}
  2. \usepackage{lmodern}
  3. \usepackage[utf8]{inputenc} % this is needed for german umlauts
  4. \usepackage[ngerman]{babel} % this is needed for german umlauts
  5. \usepackage[T1]{fontenc} % this is needed for correct output of umlauts in pdf
  6. \usepackage{braket} % needed for \Set
  7. \usepackage{algorithm,algpseudocode}
  8. \usepackage{verbatim}
  9. \usepackage{tikz}
  10. \usetikzlibrary{arrows,shapes}
  11. % Define some styles for graphs
  12. \tikzstyle{vertex}=[circle,fill=black!25,minimum size=20pt,inner sep=0pt]
  13. \tikzstyle{selected vertex} = [vertex, fill=red!24]
  14. \tikzstyle{blue vertex} = [vertex, fill=blue!24]
  15. \tikzstyle{edge} = [draw,thick,-]
  16. \tikzstyle{weight} = [font=\small]
  17. \tikzstyle{selected edge} = [draw,line width=5pt,-,red!50]
  18. \tikzstyle{ignored edge} = [draw,line width=5pt,-,black!20]
  19. % see http://deic.uab.es/~iblanes/beamer_gallery/index_by_theme.html
  20. %\usetheme{Frankfurt}
  21. \usefonttheme{professionalfonts}
  22. % disables bottom navigation bar
  23. \beamertemplatenavigationsymbolsempty
  24. % http://tex.stackexchange.com/questions/23727/converting-beamer-slides-to-animated-images
  25. \setbeamertemplate{navigation symbols}{}%
  26. \newcommand{\alertline}{%
  27. \usebeamercolor[fg]{normal text}%
  28. \only{\usebeamercolor[fg]{alerted text}}}
  29. \begin{document}
  30. \pgfdeclarelayer{background}
  31. \pgfsetlayers{background,main}
  32. \newcommand\hlight[1]{\tikz[overlay, remember picture,baseline=-\the\dimexpr\fontdimen22\textfont2\relax]\node[rectangle,fill=blue!50,rounded corners,fill opacity = 0.2,draw,thick,text opacity =1] {$#1$};}
  33. \newcommand\tocalculate[1]{\tikz[overlay, remember picture,baseline=-\the\dimexpr\fontdimen22\textfont2\relax]\node[rectangle,fill=green!50,rounded corners,fill opacity = 0.2,draw,thick,text opacity =1] {$#1$};}
  34. \begin{frame}
  35. \begin{minipage}[b]{0.30\linewidth}
  36. \centering
  37. \begin{align*}
  38. A &= \begin{pmatrix}
  39. 1 & 2 & 3\\
  40. 2 & 8 & 14\\
  41. 3 & 14 & 34
  42. \end{pmatrix}\\
  43. \alertline<1> L &= \alertline<1>\begin{pmatrix}
  44. 0 & 0 & 0\\
  45. 0 & 0 & 0\\
  46. 0 & 0 & 0
  47. \end{pmatrix}\\
  48. tmp &= 0
  49. \end{align*}
  50. \end{minipage}
  51. \hspace{0.5cm}
  52. \begin{minipage}[b]{0.60\linewidth}
  53. \centering
  54. \begin{algorithm}[H]
  55. \begin{algorithmic}
  56. \Function{Cholesky}{$A \in \mathbb{R}^{n \times n}$}
  57. \alertline<1>\State $L = \Set{0} \in \mathbb{R}^{n \times n}$ \Comment{Initialisiere $L$}\\
  58. \alertline<2>\alertline<4>\For{($k=1$; $\;k \leq n$; $\;k$++)}
  59. \alertline<3>\State $L_{k,k} = \sqrt{A_{k,k} - \sum_{i=1}^{k-1} L_{k,i}^2}$
  60. \For{($i=k+1$; $\;i \leq n$; $\;i$++)}
  61. \State $L_{i,k} = \frac{A_{i,k} - \sum_{j=1}^{k-1} L_{i,j} \cdot L_{k,j}}{L_{k,k}}$
  62. \EndFor
  63. \EndFor
  64. \alertline<5>\State \Return $L$
  65. \EndFunction
  66. \end{algorithmic}
  67. \caption{Cholesky-Zerlegung}
  68. \label{alg:seq1}
  69. \end{algorithm}
  70. \end{minipage}
  71. \end{frame}
  72. \begin{frame}
  73. \begin{align*}
  74. A &= \begin{pmatrix}
  75. \hlight{1} & 2 & 3\\
  76. 2 & 8 & 14\\
  77. 3 & 14 & 34
  78. \end{pmatrix}\\
  79. L &= \begin{pmatrix}
  80. \tocalculate{0} & 0 & 0\\
  81. 0 & 0 & 0\\
  82. 0 & 0 & 0
  83. \end{pmatrix}\\
  84. tmp &= 0
  85. \end{align*}
  86. \end{frame}
  87. \begin{frame}
  88. \begin{align*}
  89. A &= \begin{pmatrix}
  90. 1 & 2 & 3\\
  91. 2 & 8 & 14\\
  92. 3 & 14 & 34
  93. \end{pmatrix}\\
  94. L &= \begin{pmatrix}
  95. \tocalculate{1} & 0 & 0\\
  96. 0 & 0 & 0\\
  97. 0 & 0 & 0
  98. \end{pmatrix}\\
  99. tmp &= 0
  100. \end{align*}
  101. \end{frame}
  102. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  103. % Calculate L_2,1
  104. \begin{frame}
  105. \begin{align*}
  106. A &= \begin{pmatrix}
  107. 1 & 2 & 3\\
  108. \hlight{2} & 8 & 14\\
  109. 3 & 14 & 34
  110. \end{pmatrix}\\
  111. L &= \begin{pmatrix}
  112. 1 & 0 & 0\\
  113. \tocalculate{0} & 0 & 0\\
  114. 0 & 0 & 0
  115. \end{pmatrix}\\
  116. tmp &= 0
  117. \end{align*}
  118. \end{frame}
  119. \begin{frame}
  120. \begin{align*}
  121. A &= \begin{pmatrix}
  122. 1 & 2 & 3\\
  123. 2 & 8 & 14\\
  124. 3 & 14 & 34
  125. \end{pmatrix}\\
  126. L &= \begin{pmatrix}
  127. \hlight{1} & 0 & 0\\
  128. \tocalculate{2} & 0 & 0\\
  129. 0 & 0 & 0
  130. \end{pmatrix}\\
  131. tmp &= 0
  132. \end{align*}
  133. \end{frame}
  134. \begin{frame}
  135. \begin{align*}
  136. A &= \begin{pmatrix}
  137. 1 & 2 & 3\\
  138. 2 & 8 & 14\\
  139. 3 & 14 & 34
  140. \end{pmatrix}\\
  141. L &= \begin{pmatrix}
  142. 1 & 0 & 0\\
  143. \tocalculate{2} & 0 & 0\\
  144. 0 & 0 & 0
  145. \end{pmatrix}\\
  146. tmp &= 0
  147. \end{align*}
  148. \end{frame}
  149. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  150. % Calculate L_3,1
  151. \begin{frame}
  152. \begin{align*}
  153. A &= \begin{pmatrix}
  154. 1 & 2 & 3\\
  155. 2 & 8 & 14\\
  156. \hlight{3} & 14 & 34
  157. \end{pmatrix}\\
  158. L &= \begin{pmatrix}
  159. 1 & 0 & 0\\
  160. 2 & 0 & 0\\
  161. \tocalculate{0} & 0 & 0
  162. \end{pmatrix}\\
  163. tmp &= 0
  164. \end{align*}
  165. \end{frame}
  166. \begin{frame}
  167. \begin{align*}
  168. A &= \begin{pmatrix}
  169. \hlight{1} & 2 & 3\\
  170. 2 & 8 & 14\\
  171. 3 & 14 & 34
  172. \end{pmatrix}\\
  173. L &= \begin{pmatrix}
  174. 1 & 0 & 0\\
  175. 2 & 0 & 0\\
  176. \tocalculate{3} & 0 & 0
  177. \end{pmatrix}\\
  178. tmp &= 0
  179. \end{align*}
  180. \end{frame}
  181. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  182. % Calculate L_2,2
  183. \begin{frame}
  184. \begin{align*}
  185. A &= \begin{pmatrix}
  186. 1 & 2 & 3\\
  187. 2 & \hlight{8} & 14\\
  188. 3 & 14 & 34
  189. \end{pmatrix}\\
  190. L &= \begin{pmatrix}
  191. 1 & 0 & 0\\
  192. 2 & \tocalculate{0} & 0\\
  193. 3 & 0 & 0
  194. \end{pmatrix}\\
  195. tmp &= 0
  196. \end{align*}
  197. \end{frame}
  198. \begin{frame}
  199. \begin{align*}
  200. A &= \begin{pmatrix}
  201. 1 & 2 & 3\\
  202. 2 & 8 & 14\\
  203. 3 & 14 & 34
  204. \end{pmatrix}\\
  205. L &= \begin{pmatrix}
  206. 1 & 0 & 0\\
  207. \hlight{2} & \tocalculate{8} & 0\\
  208. 3 & 0 & 0
  209. \end{pmatrix}\\
  210. tmp &= 0
  211. \end{align*}
  212. \end{frame}
  213. \begin{frame}
  214. \begin{align*}
  215. A &= \begin{pmatrix}
  216. 1 & 2 & 3\\
  217. 2 & 8 & 14\\
  218. 3 & 14 & 34
  219. \end{pmatrix}\\
  220. L &= \begin{pmatrix}
  221. 1 & 0 & 0\\
  222. 2 & \tocalculate{8} & 0\\
  223. 3 & 0 & 0
  224. \end{pmatrix}\\
  225. tmp &= \hlight{4}
  226. \end{align*}
  227. \end{frame}
  228. \begin{frame}
  229. \begin{align*}
  230. A &= \begin{pmatrix}
  231. 1 & 2 & 3\\
  232. 2 & 8 & 14\\
  233. 3 & 14 & 34
  234. \end{pmatrix}\\
  235. L &= \begin{pmatrix}
  236. 1 & 0 & 0\\
  237. 2 & \tocalculate{4} & 0\\
  238. 3 & 0 & 0
  239. \end{pmatrix}\\
  240. tmp &= 0
  241. \end{align*}
  242. \end{frame}
  243. \begin{frame}
  244. \begin{align*}
  245. A &= \begin{pmatrix}
  246. 1 & 2 & 3\\
  247. 2 & 8 & 14\\
  248. 3 & 14 & 34
  249. \end{pmatrix}\\
  250. L &= \begin{pmatrix}
  251. 1 & 0 & 0\\
  252. 2 & \tocalculate{2} & 0\\
  253. 3 & 0 & 0
  254. \end{pmatrix}\\
  255. tmp &= 0
  256. \end{align*}
  257. \end{frame}
  258. \end{document}