Rate This Document
Findability
Accuracy
Completeness
Readability

?(or,un)mql

Calculate 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

  • "L": Q* is applied to C from the left.
  • "R": Q* is applied to C from the right.

Input

trans

Character

  • "N": Q is not transposed.
  • "T": Q is transposed.

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 that defines Q.

  • If side = "L", M ≥ K ≥ 0.
  • If side = "R", N ≥ K ≥ 0.

Input

A

  • A single-precision floating-point array in sormql
  • A double-precision floating-point array in dormql
  • A single-precision complex array in cunmql
  • A double-precision complex array in zunmql

Original matrix. The number of dimensions is (LDA, K).

Input

lda

Integer

Leading dimension of matrix A.

  • If side = "L", lda ≥ max(1, M).
  • If side = "R", lda ≥ max(1, N).

Input

tau

  • A single-precision floating-point array in sormql
  • A double-precision floating-point array in dormql
  • A single-precision complex array in cunmql
  • A double-precision complex array in zunmql

tau(i) must contain the constant factor of the elementary reflector H(i), which is returned by ?geqlf.

Input

C

  • A single-precision floating-point array in sormql
  • A double-precision floating-point array in dormql
  • A single-precision complex array in cunmql
  • A double-precision complex array in zunmql

Matrix to be calculated. The number of dimensions is (LDC, N).

Input/Output

ldc

Integer

Leading dimension of matrix C. ldc ≥ max(1, M)

Input

work

  • A single-precision floating-point array in sormql
  • A double-precision floating-point array in dormql
  • A single-precision complex array in cunmql
  • A double-precision complex array in zunmql

Number of dimensions, max(1, lwork).

If info is set to 0, work(1) returns the optimal lwork value.

Output

lwork

Integer

Work size.

  • If side = "L", lwork ≥ max(1, N).
  • If side = "R", lwork ≥ max(1, M).

If lwork = -1, this routine calculates only the optimal size of the work array and returns the first value of the work array.

Input

info

Integer

  • info = 0: The execution is successful.
  • info < 0: If the value of info is -i, the ith parameter is invalid.

Output

Dependencies

#include "klapack.h"

Examples

C interface:

    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 DORGLQ 
*       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 
 *