I have a matrix which is "almost" like an upper triangular just that the last row has non zero elements. And I want to perform the QR decomposition on that matrix.

Does anyone know the "name" of such a matrix? And also since I don't want to use the built in matlab QR function for such a matrix, can anyone suggest a better algorithm for me to use?

  • $\begingroup$ Have you considered the Cholesky decomposition, please? Or LU decomposition? I use R rather than Matlab, but I believe that those may be effective for your problem. Would you happen to have a small numeric example, by any chance? $\endgroup$ Commented Sep 28, 2015 at 3:06
  • $\begingroup$ The main idea is to observe the sensitivity of the diagonal elements. The original matrix was a full matrix where I used the built in matlab function QR to decompose it. But now I have purturbed (R+E) the R upper triangular matrix of the decomposition with E( E is an NxN matrix with its elements all zeros except at the last row where it has non zero elements) The shape of (R+E) is almost like the Upper triangular matrix R since it has zeros below its diagonal except it's last row. $\endgroup$ Commented Sep 28, 2015 at 10:58
  • $\begingroup$ I am expected to take the QR decomposition of this new matrix (R+E) in other to observe how sensitive the diagonal elements of R with respect to (E) is. I no longer want to use the matlab QR built function since this new matrix is (almost upper triangular except at the last row where you have non zero elements). I do have numeric examples but since I'm new here, I don't know how to type in matrices. $\endgroup$ Commented Sep 28, 2015 at 10:58
  • $\begingroup$ This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post - you can always comment on your own posts, and once you have sufficient reputation you will be able to comment on any post. $\endgroup$
    – nicoguaro
    Commented Sep 28, 2015 at 19:59
  • 1
    $\begingroup$ @user1544953 Cholesky only works for SPD matrices. I doubt that the matrix here is symmetric. $\endgroup$ Commented Nov 20, 2015 at 2:56

2 Answers 2


Look at section 5 of http://web.stanford.edu/group/SOL/papers/ggms74.pdf to see how to update QR decomposition when a row is added to the matrix you wish to factorize. You may find it not so easy to fully digest.

I think algorithm 6.16 of Chapter 6 of Scientific Computing - An Introduction using Maple and MATLAB will do the trick for you, allowing you to update in MATLAB an existing QR factorization when you add a row to the matrix you wish to factorize. Here are the MATLAB m files http://www.cs.cornell.edu/cv/GVL4/M-Files/Chapter%206/Chap6.htm .


If the matrix is almost triangular, you can just update the QR to get rid of the unwanted non-zeros. You can do that by using Givens rotations (see Golub and Van-Loan, "Matrix Computations" 4th edition, Chapter 6.5).

You can also use MATLAB's "qrinsert" and add the additional row to the QR factorization.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.