?(or,un)mql
Compute
or
, where Q is returned by calling ?geqlf. If Q is transposed and it is a real matrix,
indicates
; if Q is transposed and it is a complex matrix,
indicates
. If Q is not transposed,
indicates Q.
Interface Definition
C interface:
void sormql_(const char *uplo, const char *trans, const int *m, const int *n, const int *k, float *a, const int *lda, const float *tau, float *c, const int *ldc, float *work, const int *lwork, int *info);
void dormql_(const char *uplo, const char *trans, const int *m, const int *n, const int *k, double *a, const int *lda, const double *tau, double *c, const int *ldc, double *work, const int *lwork, int *info);
void cunmql_(const char *uplo, const char *trans, const int *m, const int *n, const int *k, float _Complex *a, const int *lda, const float _Complex *tau, float _Complex *c, const int *ldc, float _Complex *work, const int *lwork, int *info);
void zunmql_(const char *uplo, const char *trans, const int *m, const int *n, const int *k, double _Complex *a, const int *lda, const double _Complex *tau, double _Complex *c, const int *ldc, double _Complex *work, const int *lwork, int *info);
Fortran interface:
SORMQL(side,trans,m,n,k,a,lda,tau,c,ldc,work,lwork,info);
DORMQL(side,trans,m,n,k,a,lda,tau,c,ldc,work,lwork,info);
CUNMQL(side,trans,m,n,k,a,lda,tau,c,ldc,work,lwork,info);
ZUNMQL(side,trans,m,n,k,a,lda,tau,c,ldc,work,lwork,info);
Parameters
Parameter |
Type |
Description |
Input/Output |
|---|---|---|---|
side |
Character |
|
Input |
trans |
Character |
|
Input |
M |
Integer |
Number of rows in C. M ≥ 0. |
Input |
N |
Integer |
Number of columns in C. N ≥ 0. |
Input |
K |
Integer |
Number of elementary reflectors whose product defines Q.
|
Input |
A |
|
Original matrix, with dimensions (LDA, K). |
Input |
lda |
Integer |
Leading dimension of matrix A.
|
Input |
tau |
|
tau(i) must contain the constant factor of elementary reflector H(i), as returned by ?geqlf. |
Input |
C |
|
Matrix to be computed. The number of dimensions is (LDC, N). |
Input, output |
ldc |
Integer |
Leading dimension of matrix C. ldc ≥ max(1, M) |
Input |
work |
|
Number of dimensions, max(1, lwork). If info = 0, work(1) returns the optimal lwork value. |
Output |
lwork |
Integer |
Work size.
If lwork = -1, this routine computes only the optimal size of the work array and returns the first value of the work array. |
Input |
info |
Integer |
|
Output |
Dependency
#include "klapack.h"
Examples
C interface:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | char side = 'L'; char trans = 'N'; int m = 4; int n = 4; int k = 4; int lda = 4; int ldc = 4; int info = 0; double tau[4] = {1.003949, 1.125229, 1.978923, 0.000000}; double *work = NULL; double qwork; int lwork = -1; /* * tau: * 1.003949 1.125229 1.978923 0.000000 * A (4x4, stored in column-major): * -1.036040 -0.892502 -0.120115 -0.425611 * 0.654120 0.468127 0.644302 -0.601906 * -0.135860 0.502159 1.077637 -0.103204 * -0.480109 -1.207226 0.162668 0.227483 * *C (4x4, stored in column-major): * 2.229, 8.103, 7.810, 0.087, * 8.667, 8.859, 2.911, 4.091, * 0.205, 1.273, 1.396, 2.553, * 2.758, 4.317, 3.161, 8.791 */ double a[] = {-1.036040, 0.654120, 0.135860, -0.480109, -0.892502, 0.468127, 0.502159, -1.207226, -0.120115, 0.644302, 1.077637, 0.162668, -0.425611, -0.601906, -0.103204, 0.227483}; double c[] = {2.229, 8.667, 0.205, 2.758, 8.103, 8.859, 1.273, 4.317, 7.810, 2.911, 1.396, 3.161, 0.087, 4.091, 2.553, 8.791}; /* Query optimal work size */ dormql_(&side, &trans, &m, &n, &k, a, &lda, tau, c, &ldc, &qwork, &lwork, &info); if (info != 0) { return ERROR; } lwork = (int)qwork; work = (double *)malloc(sizeof(double) * lwork); /* Calculate Q */ dormql_(&side, &trans, &m, &n, &k, a, &lda, tau, c, &ldc, &qwork, &lwork, &info); free(work); /* * Output: * C output (stored in column-major) * 8.335757 0.876180 3.263161 2.758000 * 8.767347 -0.464834 2.323291 4.317000 * 3.108108 -1.403301 -0.168152 3.161000 * 4.519460 -2.717441 -0.868974 8.791000 */ |
Fortran interface:
CHARACTER :: side = "L"
CHARACTER :: trans = "N"
PARAMETER (m = 4)
PARAMETER (n = 4)
PARAMETER (k = 4)
PARAMETER (lda = 4)
PARAMETER (ldc = 4)
INTEGER :: info = 0
REAL(8) :: tau(4)
REAL(8) :: qwork(1)
INTEGER :: lwork = -1
REAL(8), ALLOCATABLE :: work(:)
*
* tau:
* 1.003949 1.125229 1.978923 0.000000
* A (4x4, stored in column-major):
* -1.036040 -0.892502 -0.120115 -0.425611
* 0.654120 0.468127 0.644302 -0.601906
* -0.135860 0.502159 1.077637 -0.103204
* -0.480109 -1.207226 0.162668 0.227483
* C (4x4, stored in column-major):
* 2.229, 8.103, 7.810, 0.087,
* 8.667, 8.859, 2.911, 4.091,
* 0.205, 1.273, 1.396, 2.553,
* 2.758, 4.317, 3.161, 8.791
*
DATA tau /1.003949, 1.125229, 1.978923, 0.000000/
REAL(8) :: a(m, n)
DATA a / -1.036040, 0.654120, 0.135860, -0.480109,
$ -0.892502, 0.468127, 0.502159, -1.207226,
$ -0.120115, 0.644302, 1.077637, 0.162668,
$ -0.425611, -0.601906, -0.103204, 0.227483 /
DATA c / 2.229, 8.667, 0.205, 2.758,
$ 8.103, 8.859, 1.273, 4.317,
$ 7.810, 2.911, 1.396, 3.161,
$ 0.087, 4.091, 2.553, 8.791
EXTERNAL DORMQL
* Query optimal work size
CALL DORMQL(side, trans, m, n, k, a, lda, tau, c, ldc, qwork, lwork, info)
IF (info.NE.0) THEN
CALL EXIT(1)
END IF
lwork = INT(qwork(1))
ALLOCATE(work(lwork))
* Calculate Q
CALL DORMQL(side, trans, m, n, k, a, lda, tau, c, ldc, work, lwork, info)
DEALLOCATE(work)
*
* Output:
* C output (stored in column-major)
* 8.335757 0.876180 3.263161 2.758000
* 8.767347 -0.464834 2.323291 4.317000
* 3.108108 -1.403301 -0.168152 3.161000
* 4.519460 -2.717441 -0.868974 8.791000
*