---
name: "ungtsqr"
section: "3"
platform: "linux"
package: "lapack-doc"
version: "3.12.1-2"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/ungtsqr"
---

# ungtsqr(3)

{un,or}gtsqr: generate Q from latsqr

## NAME

ungtsqr - {un,or}gtsqr: generate Q from latsqr

## SYNOPSIS

### Functions

subroutine **cungtsqr** (m, n, mb, nb, a, lda, t, ldt, work, lwork, info)\
 **CUNGTSQR**  subroutine **dorgtsqr** (m, n, mb, nb, a, lda, t, ldt, work, lwork, info)\
 **DORGTSQR**  subroutine **sorgtsqr** (m, n, mb, nb, a, lda, t, ldt, work, lwork, info)\
 **SORGTSQR**  subroutine **zungtsqr** (m, n, mb, nb, a, lda, t, ldt, work, lwork, info)\
 **ZUNGTSQR**

## Detailed Description

## Function Documentation

### subroutine cungtsqr (integer m, integer n, integer mb, integer nb, complex, dimension( lda, \* ) a, integer lda, complex, dimension( ldt, \* ) t, integer ldt, complex, dimension( \* ) work, integer lwork, integer info)

**CUNGTSQR**

**Purpose:**

```
!>
!> CUNGTSQR generates an M-by-N complex matrix Q_out with orthonormal
!> columns, which are the first N columns of a product of comlpex unitary
!> matrices of order M which are returned by CLATSQR
!>
!>      Q_out = first_N_columns_of( Q(1)_in * Q(2)_in * ... * Q(k)_in ).
!>
!> See the documentation for CLATSQR.
!>
```

**Parameters**

*M*

```
!>          M is INTEGER
!>          The number of rows of the matrix A.  M >= 0.
!>
```

*N*

```
!>          N is INTEGER
!>          The number of columns of the matrix A. M >= N >= 0.
!>
```

*MB*

```
!>          MB is INTEGER
!>          The row block size used by CLATSQR to return
!>          arrays A and T. MB > N.
!>          (Note that if MB > M, then M is used instead of MB
!>          as the row block size).
!>
```

*NB*

```
!>          NB is INTEGER
!>          The column block size used by CLATSQR to return
!>          arrays A and T. NB >= 1.
!>          (Note that if NB > N, then N is used instead of NB
!>          as the column block size).
!>
```

*A*

```
!>          A is COMPLEX array, dimension (LDA,N)
!>
!>          On entry:
!>
!>             The elements on and above the diagonal are not accessed.
!>             The elements below the diagonal represent the unit
!>             lower-trapezoidal blocked matrix V computed by CLATSQR
!>             that defines the input matrices Q_in(k) (ones on the
!>             diagonal are not stored) (same format as the output A
!>             below the diagonal in CLATSQR).
!>
!>          On exit:
!>
!>             The array A contains an M-by-N orthonormal matrix Q_out,
!>             i.e the columns of A are orthogonal unit vectors.
!>
```

*LDA*

```
!>          LDA is INTEGER
!>          The leading dimension of the array A.  LDA >= max(1,M).
!>
```

*T*

```
!>          T is COMPLEX array,
!>          dimension (LDT, N * NIRB)
!>          where NIRB = Number_of_input_row_blocks
!>                     = MAX( 1, CEIL((M-N)/(MB-N)) )
!>          Let NICB = Number_of_input_col_blocks
!>                   = CEIL(N/NB)
!>
!>          The upper-triangular block reflectors used to define the
!>          input matrices Q_in(k), k=(1:NIRB*NICB). The block
!>          reflectors are stored in compact form in NIRB block
!>          reflector sequences. Each of NIRB block reflector sequences
!>          is stored in a larger NB-by-N column block of T and consists
!>          of NICB smaller NB-by-NB upper-triangular column blocks.
!>          (same format as the output T in CLATSQR).
!>
```

*LDT*

```
!>          LDT is INTEGER
!>          The leading dimension of the array T.
!>          LDT >= max(1,min(NB1,N)).
!>
```

*WORK*

```
!>          (workspace) COMPLEX array, dimension (MAX(2,LWORK))
!>          On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
!>
```

*LWORK*

```
!>          LWORK is INTEGER
!>          The dimension of the array WORK.  LWORK >= (M+NB)*N.
!>          If LWORK = -1, then a workspace query is assumed.
!>          The routine only calculates the optimal size of the WORK
!>          array, returns this value as the first entry of the WORK
!>          array, and no error message related to LWORK is issued
!>          by XERBLA.
!>
```

*INFO*

```
!>          INFO is INTEGER
!>          = 0:  successful exit
!>          < 0:  if INFO = -i, the i-th argument had an illegal value
!>
```

**Author**

Univ. of Tennessee

Univ. of California Berkeley

Univ. of Colorado Denver

NAG Ltd.

**Contributors:**

```
!>
!> November 2019, Igor Kozachenko,
!>                Computer Science Division,
!>                University of California, Berkeley
!>
!>
```

Definition at line **174** of file **cungtsqr.f**.

### subroutine dorgtsqr (integer m, integer n, integer mb, integer nb, double precision, dimension( lda, \* ) a, integer lda, double precision, dimension( ldt, \* ) t, integer ldt, double precision, dimension( \* ) work, integer lwork, integer info)

**DORGTSQR**

**Purpose:**

```
!>
!> DORGTSQR generates an M-by-N real matrix Q_out with orthonormal columns,
!> which are the first N columns of a product of real orthogonal
!> matrices of order M which are returned by DLATSQR
!>
!>      Q_out = first_N_columns_of( Q(1)_in * Q(2)_in * ... * Q(k)_in ).
!>
!> See the documentation for DLATSQR.
!>
```

**Parameters**

*M*

```
!>          M is INTEGER
!>          The number of rows of the matrix A.  M >= 0.
!>
```

*N*

```
!>          N is INTEGER
!>          The number of columns of the matrix A. M >= N >= 0.
!>
```

*MB*

```
!>          MB is INTEGER
!>          The row block size used by DLATSQR to return
!>          arrays A and T. MB > N.
!>          (Note that if MB > M, then M is used instead of MB
!>          as the row block size).
!>
```

*NB*

```
!>          NB is INTEGER
!>          The column block size used by DLATSQR to return
!>          arrays A and T. NB >= 1.
!>          (Note that if NB > N, then N is used instead of NB
!>          as the column block size).
!>
```

*A*

```
!>          A is DOUBLE PRECISION array, dimension (LDA,N)
!>
!>          On entry:
!>
!>             The elements on and above the diagonal are not accessed.
!>             The elements below the diagonal represent the unit
!>             lower-trapezoidal blocked matrix V computed by DLATSQR
!>             that defines the input matrices Q_in(k) (ones on the
!>             diagonal are not stored) (same format as the output A
!>             below the diagonal in DLATSQR).
!>
!>          On exit:
!>
!>             The array A contains an M-by-N orthonormal matrix Q_out,
!>             i.e the columns of A are orthogonal unit vectors.
!>
```

*LDA*

```
!>          LDA is INTEGER
!>          The leading dimension of the array A.  LDA >= max(1,M).
!>
```

*T*

```
!>          T is DOUBLE PRECISION array,
!>          dimension (LDT, N * NIRB)
!>          where NIRB = Number_of_input_row_blocks
!>                     = MAX( 1, CEIL((M-N)/(MB-N)) )
!>          Let NICB = Number_of_input_col_blocks
!>                   = CEIL(N/NB)
!>
!>          The upper-triangular block reflectors used to define the
!>          input matrices Q_in(k), k=(1:NIRB*NICB). The block
!>          reflectors are stored in compact form in NIRB block
!>          reflector sequences. Each of NIRB block reflector sequences
!>          is stored in a larger NB-by-N column block of T and consists
!>          of NICB smaller NB-by-NB upper-triangular column blocks.
!>          (same format as the output T in DLATSQR).
!>
```

*LDT*

```
!>          LDT is INTEGER
!>          The leading dimension of the array T.
!>          LDT >= max(1,min(NB1,N)).
!>
```

*WORK*

```
!>          (workspace) DOUBLE PRECISION array, dimension (MAX(2,LWORK))
!>          On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
!>
```

*LWORK*

```
!>          LWORK is INTEGER
!>          The dimension of the array WORK.  LWORK >= (M+NB)*N.
!>          If LWORK = -1, then a workspace query is assumed.
!>          The routine only calculates the optimal size of the WORK
!>          array, returns this value as the first entry of the WORK
!>          array, and no error message related to LWORK is issued
!>          by XERBLA.
!>
```

*INFO*

```
!>          INFO is INTEGER
!>          = 0:  successful exit
!>          < 0:  if INFO = -i, the i-th argument had an illegal value
!>
```

**Author**

Univ. of Tennessee

Univ. of California Berkeley

Univ. of Colorado Denver

NAG Ltd.

**Contributors:**

```
!>
!> November 2019, Igor Kozachenko,
!>                Computer Science Division,
!>                University of California, Berkeley
!>
!>
```

Definition at line **174** of file **dorgtsqr.f**.

### subroutine sorgtsqr (integer m, integer n, integer mb, integer nb, real, dimension( lda, \* ) a, integer lda, real, dimension( ldt, \* ) t, integer ldt, real, dimension( \* ) work, integer lwork, integer info)

**SORGTSQR**

**Purpose:**

```
!>
!> SORGTSQR generates an M-by-N real matrix Q_out with orthonormal columns,
!> which are the first N columns of a product of real orthogonal
!> matrices of order M which are returned by SLATSQR
!>
!>      Q_out = first_N_columns_of( Q(1)_in * Q(2)_in * ... * Q(k)_in ).
!>
!> See the documentation for SLATSQR.
!>
```

**Parameters**

*M*

```
!>          M is INTEGER
!>          The number of rows of the matrix A.  M >= 0.
!>
```

*N*

```
!>          N is INTEGER
!>          The number of columns of the matrix A. M >= N >= 0.
!>
```

*MB*

```
!>          MB is INTEGER
!>          The row block size used by SLATSQR to return
!>          arrays A and T. MB > N.
!>          (Note that if MB > M, then M is used instead of MB
!>          as the row block size).
!>
```

*NB*

```
!>          NB is INTEGER
!>          The column block size used by SLATSQR to return
!>          arrays A and T. NB >= 1.
!>          (Note that if NB > N, then N is used instead of NB
!>          as the column block size).
!>
```

*A*

```
!>          A is REAL array, dimension (LDA,N)
!>
!>          On entry:
!>
!>             The elements on and above the diagonal are not accessed.
!>             The elements below the diagonal represent the unit
!>             lower-trapezoidal blocked matrix V computed by SLATSQR
!>             that defines the input matrices Q_in(k) (ones on the
!>             diagonal are not stored) (same format as the output A
!>             below the diagonal in SLATSQR).
!>
!>          On exit:
!>
!>             The array A contains an M-by-N orthonormal matrix Q_out,
!>             i.e the columns of A are orthogonal unit vectors.
!>
```

*LDA*

```
!>          LDA is INTEGER
!>          The leading dimension of the array A.  LDA >= max(1,M).
!>
```

*T*

```
!>          T is REAL array,
!>          dimension (LDT, N * NIRB)
!>          where NIRB = Number_of_input_row_blocks
!>                     = MAX( 1, CEIL((M-N)/(MB-N)) )
!>          Let NICB = Number_of_input_col_blocks
!>                   = CEIL(N/NB)
!>
!>          The upper-triangular block reflectors used to define the
!>          input matrices Q_in(k), k=(1:NIRB*NICB). The block
!>          reflectors are stored in compact form in NIRB block
!>          reflector sequences. Each of NIRB block reflector sequences
!>          is stored in a larger NB-by-N column block of T and consists
!>          of NICB smaller NB-by-NB upper-triangular column blocks.
!>          (same format as the output T in SLATSQR).
!>
```

*LDT*

```
!>          LDT is INTEGER
!>          The leading dimension of the array T.
!>          LDT >= max(1,min(NB1,N)).
!>
```

*WORK*

```
!>          (workspace) REAL array, dimension (MAX(2,LWORK))
!>          On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
!>
```

*LWORK*

```
!>          LWORK is INTEGER
!>          The dimension of the array WORK.  LWORK >= (M+NB)*N.
!>          If LWORK = -1, then a workspace query is assumed.
!>          The routine only calculates the optimal size of the WORK
!>          array, returns this value as the first entry of the WORK
!>          array, and no error message related to LWORK is issued
!>          by XERBLA.
!>
```

*INFO*

```
!>          INFO is INTEGER
!>          = 0:  successful exit
!>          < 0:  if INFO = -i, the i-th argument had an illegal value
!>
```

**Author**

Univ. of Tennessee

Univ. of California Berkeley

Univ. of Colorado Denver

NAG Ltd.

**Contributors:**

```
!>
!> November 2019, Igor Kozachenko,
!>                Computer Science Division,
!>                University of California, Berkeley
!>
!>
```

Definition at line **174** of file **sorgtsqr.f**.

### subroutine zungtsqr (integer m, integer n, integer mb, integer nb, complex\*16, dimension( lda, \* ) a, integer lda, complex\*16, dimension( ldt, \* ) t, integer ldt, complex\*16, dimension( \* ) work, integer lwork, integer info)

**ZUNGTSQR**

**Purpose:**

```
!>
!> ZUNGTSQR generates an M-by-N complex matrix Q_out with orthonormal
!> columns, which are the first N columns of a product of comlpex unitary
!> matrices of order M which are returned by ZLATSQR
!>
!>      Q_out = first_N_columns_of( Q(1)_in * Q(2)_in * ... * Q(k)_in ).
!>
!> See the documentation for ZLATSQR.
!>
```

**Parameters**

*M*

```
!>          M is INTEGER
!>          The number of rows of the matrix A.  M >= 0.
!>
```

*N*

```
!>          N is INTEGER
!>          The number of columns of the matrix A. M >= N >= 0.
!>
```

*MB*

```
!>          MB is INTEGER
!>          The row block size used by ZLATSQR to return
!>          arrays A and T. MB > N.
!>          (Note that if MB > M, then M is used instead of MB
!>          as the row block size).
!>
```

*NB*

```
!>          NB is INTEGER
!>          The column block size used by ZLATSQR to return
!>          arrays A and T. NB >= 1.
!>          (Note that if NB > N, then N is used instead of NB
!>          as the column block size).
!>
```

*A*

```
!>          A is COMPLEX*16 array, dimension (LDA,N)
!>
!>          On entry:
!>
!>             The elements on and above the diagonal are not accessed.
!>             The elements below the diagonal represent the unit
!>             lower-trapezoidal blocked matrix V computed by ZLATSQR
!>             that defines the input matrices Q_in(k) (ones on the
!>             diagonal are not stored) (same format as the output A
!>             below the diagonal in ZLATSQR).
!>
!>          On exit:
!>
!>             The array A contains an M-by-N orthonormal matrix Q_out,
!>             i.e the columns of A are orthogonal unit vectors.
!>
```

*LDA*

```
!>          LDA is INTEGER
!>          The leading dimension of the array A.  LDA >= max(1,M).
!>
```

*T*

```
!>          T is COMPLEX*16 array,
!>          dimension (LDT, N * NIRB)
!>          where NIRB = Number_of_input_row_blocks
!>                     = MAX( 1, CEIL((M-N)/(MB-N)) )
!>          Let NICB = Number_of_input_col_blocks
!>                   = CEIL(N/NB)
!>
!>          The upper-triangular block reflectors used to define the
!>          input matrices Q_in(k), k=(1:NIRB*NICB). The block
!>          reflectors are stored in compact form in NIRB block
!>          reflector sequences. Each of NIRB block reflector sequences
!>          is stored in a larger NB-by-N column block of T and consists
!>          of NICB smaller NB-by-NB upper-triangular column blocks.
!>          (same format as the output T in ZLATSQR).
!>
```

*LDT*

```
!>          LDT is INTEGER
!>          The leading dimension of the array T.
!>          LDT >= max(1,min(NB1,N)).
!>
```

*WORK*

```
!>          (workspace) COMPLEX*16 array, dimension (MAX(2,LWORK))
!>          On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
!>
```

*LWORK*

```
!>          LWORK is INTEGER
!>          The dimension of the array WORK.  LWORK >= (M+NB)*N.
!>          If LWORK = -1, then a workspace query is assumed.
!>          The routine only calculates the optimal size of the WORK
!>          array, returns this value as the first entry of the WORK
!>          array, and no error message related to LWORK is issued
!>          by XERBLA.
!>
```

*INFO*

```
!>          INFO is INTEGER
!>          = 0:  successful exit
!>          < 0:  if INFO = -i, the i-th argument had an illegal value
!>
```

**Author**

Univ. of Tennessee

Univ. of California Berkeley

Univ. of Colorado Denver

NAG Ltd.

**Contributors:**

```
!>
!> November 2019, Igor Kozachenko,
!>                Computer Science Division,
!>                University of California, Berkeley
!>
!>
```

Definition at line **174** of file **zungtsqr.f**.

## Author

Generated automatically by Doxygen for LAPACK from the source code.
