QR-Zerlegung

This commit is contained in:
Sandro Zimmermann 2026-06-02 21:40:03 +02:00
parent 92e2f991e3
commit 94ccd12cfe

View File

@ -0,0 +1,34 @@
"""
QR-Zerlegung
A Matrix:
[3 1]
[6 9]
"""
import numpy as np
import scipy as sc
# Parameter
A = np.array([[3, 1], [6, 9]])
pr = 3
# Berechnung
[Q, R] = sc.linalg.qr(A)
# Ausgabe
with np.printoptions(precision=pr):
print(f"Q = \n{Q}\n\n R = \n{R}")
"""
Ausgabe:
Q =
[[-0.447 -0.894]
[-0.894 0.447]]
R =
[[-6.708 -8.497]
[ 0. 3.13 ]]
"""