Add missing step to explanation

This commit is contained in:
Manuel Thalmann 2023-01-11 04:11:03 +01:00
parent ddf2fcbd36
commit c6d7514752

View file

@ -856,13 +856,14 @@ Die $QR$-Zerlegung kann folgendermassen durchgeführt werden:
3. Erweiterte Householder-Matrix als $Q_i$ speichern 3. Erweiterte Householder-Matrix als $Q_i$ speichern
4. $R = Q_i \cdot R$ 4. $R = Q_i \cdot R$
5. $Q = Q \cdot Q_i^T$ 5. $Q = Q \cdot Q_i^T$
6. Die Gleichung $R \cdot x = Q^T \cdot b$ mit Gauss-Algorithmus lösen
***Code-Beispiel:*** ***Code-Beispiel:***
```py ```py
from numpy import array, identity, sign, sqrt, square, sum, zeros from numpy import array, identity, sign, sqrt, square, sum, zeros
def qrDecomposition(A): def qrSolve(A, b):
A = array(A) A = array(A)
n = A.shape[0] n = A.shape[0]
R = A.reshape((n, n)) R = A.reshape((n, n))
@ -880,7 +881,7 @@ def qrDecomposition(A):
Qi[i:,i:] = H Qi[i:,i:] = H
R = Qi @ R R = Qi @ R
Q = Q @ Qi.T Q = Q @ Qi.T
return [Q, R] return linalg.solve(R, Q.T @ b)
``` ```
## Formelbuchstaben ## Formelbuchstaben