mirror of
https://github.com/janishutz/eth-summaries.git
synced 2025-11-25 10:34:23 +00:00
[NumCS] ++ Ch. 7 draft
This commit is contained in:
Binary file not shown.
@@ -155,6 +155,8 @@ Moral of the story: Use descriptive variable names and do NOT use $t$, $tt$, $tt
|
|||||||
\input{parts/03_zeros/03_bisection-method.tex}
|
\input{parts/03_zeros/03_bisection-method.tex}
|
||||||
\input{parts/03_zeros/04_newton-one-d.tex}
|
\input{parts/03_zeros/04_newton-one-d.tex}
|
||||||
|
|
||||||
|
\newsection
|
||||||
|
\section{Intermezzo: Lineare Algebra}
|
||||||
|
\input{parts/04_linalg/00_intro.tex}
|
||||||
|
|
||||||
\end{document}
|
\end{document}
|
||||||
|
|||||||
44
semester3/numcs/parts/04_linalg/00_intro.tex
Normal file
44
semester3/numcs/parts/04_linalg/00_intro.tex
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
Das Skript-Kapitel hierzu existiert nicht. Die Vorlesung orientiert sich an dem äquivalenten Teil des NumCSE Dokuments.
|
||||||
|
|
||||||
|
\textbf{Perturbierte LGS}
|
||||||
|
|
||||||
|
Statt $Ax = b$ ist das LGS ungenau gegeben: $(A + \Delta A)(\tilde{x} - x) = \Delta b - \Delta Ax$.
|
||||||
|
|
||||||
|
$\text{cond}(A) := \left\lvert\left\lvert A^{-1} \right\rvert\right\rvert \cdot \lvert\lvert A \rvert\rvert \in \mathbb{R}$ (Konditionszahl von $A$)
|
||||||
|
|
||||||
|
$\text{cond}(A) \gg 1$ bedeutet intuitiv: kleine Änderung der Daten $\mapsto$ grosse Änderung in der Lösung
|
||||||
|
|
||||||
|
\textbf{Gauss Elimination / LU Zerlegung}
|
||||||
|
|
||||||
|
$A \in \mathbb{R}^{n\times m} = PLU$ wie bekannt.
|
||||||
|
|
||||||
|
\textbf{Cholesky Zerlegung} ($A$ pos. def. und hermitesch)
|
||||||
|
|
||||||
|
$A = LDL^\top = \underbrace{L\sqrt{D}}_{R^\top}\underbrace{\sqrt{D}L^\top}_{R} = R^\top R$
|
||||||
|
|
||||||
|
Kann $Ax = b$ potenziell schneller lösen als LU.
|
||||||
|
|
||||||
|
\begin{code}{python}
|
||||||
|
L = np.linalg.solve(A) # A = L @ L.T
|
||||||
|
y = np.linalg.solve(L, b)
|
||||||
|
x = np.linalg.solve(L.T, y)
|
||||||
|
\end{code}
|
||||||
|
|
||||||
|
\textbf{Grosse Matrizen}
|
||||||
|
|
||||||
|
Passen oft nicht (direkt) in den Speicher: effizientere Speicherung nötig, möglich für z.B. Diagonalmatrizen, Dreiecksmatrizen. Auch für Cholesky möglich.
|
||||||
|
|
||||||
|
\textbf{Dünnbesetzte Matrizen}
|
||||||
|
|
||||||
|
$\text{nnz}(A) := |\{ (i,j) \ |\ a_{ij} \in A, a_{ij} \neq 0 \}| \ll m\cdot n$
|
||||||
|
|
||||||
|
$\underset{l \to \infty}{\lim} \frac{\text{nnz}(A^{(l)})}{n_l m_l} = 0$
|
||||||
|
|
||||||
|
Einfacher zu speichern: \verb|val, col, row| vektoren s.d. \verb|val[k]| $ = a_{ij}$ wobei $i=$ \verb|row[k]|, $j=$ \verb|col[k]|. (nur $a_{ij} \neq 0$)
|
||||||
|
|
||||||
|
Viele Formate, je nach Anwendung gewisse sinnvoller als andere. (Siehe Tabelle, NumCSE)
|
||||||
|
|
||||||
|
\verb|scipy.sparse.csr_matrix(A)| $\mapsto$ Dramatische Speichereinsparung.\\
|
||||||
|
Deprecated: \verb|bsr_array| und \verb|coo_array| verwenden, kompatibel mit \verb|numpy| arrays.
|
||||||
|
|
||||||
|
\verb|CSC, CSR| erlauben weitere Optimierungen, je nach Gewichtung der $a_{ij}$ auf Zeilen, Spalten.
|
||||||
Reference in New Issue
Block a user