Page 1 of 1

QR decomp for complex matrix

PostPosted: Sun Aug 25, 2019 9:28 am
by cottrell
I'm used to the functions dgeqrf and dorgqr for real matrices. Recently I've been working with complex matrices, and I see there's a zgeqrf, but no zorgqr to construct the m x n Q matrix from the raw materials provided by zgeqrf. I guess there must be a reason for that -- can you tell me what it is?

(I've written code which does the job on Q for the complex case, but I'm sure it's horribly inefficient compared with the clever stuff that dorgqr does.)

Re: QR decomp for complex matrix

PostPosted: Sun Aug 25, 2019 9:43 am
by Julien Langou
ZUNGQR

Re: QR decomp for complex matrix

PostPosted: Sun Aug 25, 2019 3:34 pm
by cottrell
Perfect! I missed that, needless to say, but then most z* functions have the same name as the corresponding d* ones, apart from the first letter.

Re: QR decomp for complex matrix

PostPosted: Sun Aug 25, 2019 4:04 pm
by cottrell
Ah, but now I see: ZUNGQR does not have the same signature as DORGQR (data types aside).

However, it would be helpful if the doc for ZGEQRF had a cross reference to ZUNGQR.

Re: QR decomp for complex matrix

PostPosted: Sun Aug 25, 2019 5:48 pm
by cottrell
Oof, sorry, too hasty! Actually the signatures of DORGQR and ZUNGQR are the same, modulo the data types for A, TAU and WORK. So (a less pressing question) is there a reason why the names of the functions differ, other than in their first letter as usual?

Re: QR decomp for complex matrix

PostPosted: Sun Aug 25, 2019 8:26 pm
by Julien Langou
OR = Orthogonal
UN = unitary

In general we say orthogonal for real matrices, and we say unitary for complex matrices.

( For the record, my preference would be to use DUNxxx and ZUNxxx. )

Re: QR decomp for complex matrix

PostPosted: Tue Aug 27, 2019 4:18 pm
by cottrell
Thanks for the explanation, Julien. My only remaining point is that it would be nice to have cross-references from the primary QR functions to those that extract or construct the actual Q matrix, in the online LAPACK documentation.