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

## how to use geqrf to generate unitary matrix Q (matrix size: m*n) Beginner
155 Views

I know ?geqrf to calculate m-by-n A = QR and then ungqr to generate Q. but the Q is m-by-m square matrix, what i want is Q m-by-n.

I really don't know how to deal with this, I found p?geqrf and p?ungqr would generate Q with m-by-n, but I think it's a parallel ?geqrf, it might not help me. could anyone help me, please? thanks very much..

1 Solution Employee
155 Views

Hello Leo,

The functions is supposed to be able to get m x n Q too . please see the doc:

?orgqr
Generates the real orthogonal matrix Q of the QR
factorization formed by ?geqrf.

The routine generates the whole or part of m-by-m orthogonal matrix Qof the QRfactorization formed by
the routines geqrf/geqrfor geqpf/geqpf. Use this routine after a call to sgeqrf/dgeqrfor sgeqpf/dgeqpf.
Usually Q is determined from the QR factorization of an mby p matrix A with m ≥ p. To compute the whole
matrix Q, use:
call ?orgqr(m, m, p, a, lda, tau, work, lwork, info)
To compute the leading p columns of Q(which form an orthonormal basis in the space spanned by the
columns of A):
call ?orgqr(m, p, p, a, lda, tau, work, lwork, info)

To compute the matrix Q k of the QRfactorization of leading k columns of the matrix A:
call ?orgqr(m, m, k, a, lda, tau, work, lwork, info)
To compute the leading k columns of Q k
(which form an orthonormal basis in the space spanned by leading k
columns of the matrix A):
call ?orgqr(m, k, k, a, lda, tau, work, lwork, info)

?ungqr
Generates the complex unitary matrix Q of the QR
factorization formed by ?geqrf

The routine generates the whole or part of m-by-munitary matrix Qof the QRfactorization formed by the
routines geqrf/geqrfor geqpf/geqpf. Use this routine after a call to cgeqrf/zgeqrfor cgeqpf/zgeqpf.
Usually Qis determined from the QRfactorization of an mby pmatrix Awith m ≥ p. To compute the whole
matrix Q, use:
call ?ungqr(m, m, p, a, lda, tau, work, lwork, info)
To compute the leading pcolumns of Q(which form an orthonormal basis in the space spanned by the
columns of A):
call ?ungqr(m, p, p, a, lda, tau, work, lwork, info)
To compute the matrix Q
k
of the QRfactorization of the leading kcolumns of the matrix A:
call ?ungqr(m, m, k, a, lda, tau, work, lwork, info)
To compute the leading kcolumns of Q
k
(which form an orthonormal basis in the space spanned by the
leading kcolumns of the matrix A):
call ?ungqr(m, k, k, a, lda, tau, work, lwork, info) Employee
156 Views

Hello Leo,

The functions is supposed to be able to get m x n Q too . please see the doc:

?orgqr
Generates the real orthogonal matrix Q of the QR
factorization formed by ?geqrf.

The routine generates the whole or part of m-by-m orthogonal matrix Qof the QRfactorization formed by
the routines geqrf/geqrfor geqpf/geqpf. Use this routine after a call to sgeqrf/dgeqrfor sgeqpf/dgeqpf.
Usually Q is determined from the QR factorization of an mby p matrix A with m ≥ p. To compute the whole
matrix Q, use:
call ?orgqr(m, m, p, a, lda, tau, work, lwork, info)
To compute the leading p columns of Q(which form an orthonormal basis in the space spanned by the
columns of A):
call ?orgqr(m, p, p, a, lda, tau, work, lwork, info)

To compute the matrix Q k of the QRfactorization of leading k columns of the matrix A:
call ?orgqr(m, m, k, a, lda, tau, work, lwork, info)
To compute the leading k columns of Q k
(which form an orthonormal basis in the space spanned by leading k
columns of the matrix A):
call ?orgqr(m, k, k, a, lda, tau, work, lwork, info)

?ungqr
Generates the complex unitary matrix Q of the QR
factorization formed by ?geqrf

The routine generates the whole or part of m-by-munitary matrix Qof the QRfactorization formed by the
routines geqrf/geqrfor geqpf/geqpf. Use this routine after a call to cgeqrf/zgeqrfor cgeqpf/zgeqpf.
Usually Qis determined from the QRfactorization of an mby pmatrix Awith m ≥ p. To compute the whole
matrix Q, use:
call ?ungqr(m, m, p, a, lda, tau, work, lwork, info)
To compute the leading pcolumns of Q(which form an orthonormal basis in the space spanned by the
columns of A):
call ?ungqr(m, p, p, a, lda, tau, work, lwork, info)
To compute the matrix Q
k
of the QRfactorization of the leading kcolumns of the matrix A:
call ?ungqr(m, m, k, a, lda, tau, work, lwork, info)
To compute the leading kcolumns of Q
k
(which form an orthonormal basis in the space spanned by the
leading kcolumns of the matrix A):
call ?ungqr(m, k, k, a, lda, tau, work, lwork, info) 