Skip to content

Commit c25b7c4

Browse files
committed
add QR Decomposition of matrix in linear algebra
1 parent 28ac77c commit c25b7c4

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

linear_algebra/qr_decomposition.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
1-
"""
2-
In linear algebra, a QR decomposition, also known as a QR factorization
1+
"""In linear algebra, a QR decomposition, also known as a QR factorization
32
or Q factorization,
43
is a decomposition of a matrix a into a product matrix_a = QR
54
of an orthonormal matrix Q and an upper triangular matrix R.
65
QR decomposition is often used to solve the linear least squares (LLS) problem
76
and is the basis for a particular eigenvalue algorithm, the QR algorithm.
8-
97
This algorithm will simply attempt to perform QR decomposition on any square matrix.
10-
11-
Reference: https://en.wikipedia.org/wiki/QR_decomposition
12-
"""
13-
import numpy as np
8+
Reference: https://en.wikipedia.org/wiki/QR_decomposition"""
149
from __future__ import annotations
1510
from scipy.linalg import qr
11+
import numpy as np
1612

1713
def qr_decomposition(matrix_a: np.ndarray) -> tuple[np.ndarray, np.ndarray]:
1814
"""
@@ -88,4 +84,4 @@ def qr_decomposition(matrix_a: np.ndarray) -> tuple[np.ndarray, np.ndarray]:
8884
if __name__ == "__main__":
8985
import doctest
9086

91-
doctest.testmod()
87+
doctest.testmod()

0 commit comments

Comments
 (0)