VOOZH about

URL: https://www.geeksforgeeks.org/numpy/get-the-qr-factorization-of-a-given-numpy-array/

⇱ Get the QR factorization of a given NumPy array - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Get the QR factorization of a given NumPy array

Last Updated : 29 Aug, 2020

In this article, we will discuss QR decomposition or QR factorization of a matrix. QR factorization of a matrix is the decomposition of a matrix say 'A' into 'A=QR' where Q is orthogonal and R is an upper-triangular matrix. We factorize the matrix using numpy.linalg.qr() function.

Syntax : numpy.linalg.qr(a, mode='reduced')

Parameters :

  • a : matrix(M,N) which needs to be factored.
  • mode : it is optional. It can be :

Below are some examples of how to use the above-described function :

Example 1: QR factorization of 2X2 matrix

Output :

👁 Image

Example 2: QR factorization of 2X4 matrix

Output :

👁 Image

Example 3: QR factorization of 3X3 matrix

Output :

👁 Image
Comment

Explore