Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
6538 Discussions

QR decomposition for transposed matrices



could you please help with a solution of the following issue.

There is a simple Z*beta=Y overdetermined linear system with respect to beta and I want to solve it with MKL/QR decomposition. I read manual and found two similar approaches to achieve the goal:

  1. one 'sgels(...)' call or
  2. sequence 'geqrf(...) + ormqr(...) + trsm(...)' of calls

The issue is, that matrices in my application are stored in transposed form, i.e. (X')*beta=Y system is under consideration. Is there any possibility to find QR decomposition for transposed?

Note. Solution with LQ factorization was tried, but it takes approximately 10 times longer than QR for transposed matrices.

Thank you in advance.

0 Kudos
2 Replies

Dear Victor,

If you use C as programming language, you could try to call LAPACKE_dgeqrf(). Its first parameter is matrix layout and calling a LAPACKE function with row major data layout versus column major data layout is equivalent to transposing input matrices.

Also you could try transposition routines provided with MKL, you could find description of these in BLAS-like extensions chapter.

Thank you for reporting about 10x performance difference between LQ and QR factorization. Could you please let us know a bit more about input sizes of your matrices and your host configuration, so that we could reproduce this and see how we could fix it.

Thanks, Alexander



thanks for the detailed answer, I see the work flow now.

For random matrix 10000x10000 about 2x difference is stably observed (not sure about 10x stability now). But this is not the issue for the moment, just interesting observation, since I thought LQ problem is almost the same as QR one in algorithmic sense.