Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.

Size problem using zgeqrf and zunmqr



After using zgeqrf to compute the QR factorization of an m by n matrix, I want to multiply Q by another matrix C (k by k with k<m) with zunmqr.

My problem is that the result of the multiplication overwrites the matrix C, which size is smaller than the expected result.

I expect to get an m by k matrix, but C is only allocated for a k by k size.

Is there a way to directly compute the product into another allocated matrix with the proper size, or is the only solution to first compute the matrix Q and then multiply with zgemm ?

Thanks a lot in advance for your response.


0 Kudos
2 Replies
Black Belt

Most QR decomposition routines, including ZGEQRF, do not form Q explicitly. Instead, they produce compacted information from which one can recover the Householder reflectors whose product is Q. For this reason, you cannot use ZGEMM, nor should you plan to form Q explicitly.

It is not clear to my why/how you try to multiply Q, which is m X n, with a matrix C of size k X k. First of all, the matrix shapes do not conform w.r.t. matrix multiplication. Perhaps, what you want to do is to use a submatrix of Q as the multiplier?

Secondly, do you want to obtain Q C, or QTC?


Thanks for your answer, and sorry, I realize my first post wasn't cery clear.

My goal is to multiply the matrix Q from the QR factorization of A (m X k) with the matrix C (k X k). I want to obtain Q C (no transposition needed) which size should be m X k. So if I understand correctly how unmqr works, the result of size m X k is too big to be overwriting C.