1

QR Factorization

Unsolved
Linear Algebra

Difficulty: 1 | Problem written by Mr. Umair
QR Factorization records the orthogonalization of a matrix and is defined as:

                                        \( A = QR = Q \begin{bmatrix} R_1 \\ 0 \end{bmatrix}\) \(= \begin{bmatrix} Q_1 & Q_2 \end{bmatrix} \begin{bmatrix} R_1 \\ 0 \end{bmatrix}\)\(= Q_1 R_1\)

Your function will take a 2D NumPy array and compute the QR factorization. Your function will return a list with two elements in it containing the Q and R 2D arrays.

You may use any library function you want.

Sample Input:
<class 'numpy.ndarray'>
arr: [[8 8 3 7 7] [0 4 2 5 2] [2 2 1 0 9] [8 2 7 8 9]]

Expected Output:
<class 'list'>
[array([[-0.69631062, -0.49495058, -0.47586376, -0.20911509], [-0. , -0.68055705, 0.73082764, -0.05227877], [-0.17407766, -0.12373764, -0.04541867, 0.97587044], [-0.69631062, 0.52588499, 0.48721842, -0.03485252]]), array([[-11.48912529, -7.31126155, -7.13718389, -10.44465936, -12.70766888], [ 0. , -5.87753814, 0.71149146, -2.66035937, -1.20644204], [ 0. , 0. , 3.39917431, 4.22083928, 2.10680679], [ 0. , 0. , 0. , -2.00401965, 6.90079809]])]

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Voluptates magni nemo explicabo cupiditate deleniti ullam eaque ipsa, aperiam quibusdam quo quisquam incidunt ea laboriosam eligendi enim, beatae voluptates officiis nisi fuga ab sit, id quis minus fuga consequuntur rem distinctio libero adipisci? Illo dolore error quasi ullam velit voluptate aut consequuntur delectus fugiat?

Dolores voluptas blanditiis eaque odit sed, cum molestiae voluptatem aperiam impedit perferendis molestias facere possimus nemo tempora? Voluptatum tempora placeat, laudantium quos nesciunt accusantium, ipsum vero suscipit alias dolores cumque, quaerat labore provident cupiditate voluptates deserunt deleniti. Molestiae laudantium voluptates qui cum quam corrupti quibusdam neque, quam necessitatibus libero laudantium possimus vel facilis distinctio sunt molestiae, necessitatibus omnis repudiandae impedit, assumenda impedit dolor aut ipsa error perspiciatis autem eligendi, explicabo iusto minima nostrum et rem dignissimos nulla odit? Soluta rerum ducimus totam earum tempora dolorem quo laborum esse culpa porro, inventore officiis amet sint laudantium accusantium doloribus laboriosam nulla.

Ab nisi excepturi accusantium aut sed dolorem deleniti ullam autem aperiam assumenda, blanditiis et similique itaque eligendi quisquam beatae vel sit reprehenderit ratione? Similique magni placeat aspernatur assumenda eveniet tempore atque obcaecati consequuntur accusantium, ratione exercitationem quasi omnis labore ab saepe laudantium illum, itaque quis quia facilis doloremque, unde placeat culpa, asperiores at repudiandae nobis corporis possimus ducimus vel officia alias repellendus dolor.

This is a premium feature.
To access this and other such features, click on upgrade below.

Ready.

Input Test Case

Please enter only one test case at a time
numpy has been already imported as np (import numpy as np)