## MB3PYZ

### Matrix rank determination by incremental condition estimation, during the pivoted RQ factorization process (row pivoting, complex case)

[Specification] [Arguments] [Method] [References] [Comments] [Example]

Purpose

```  To compute a rank-revealing RQ factorization of a complex general
M-by-N matrix  A,  which may be rank-deficient, and estimate its
effective rank using incremental condition estimation.

The routine uses a truncated RQ factorization with row pivoting:
[ R11 R12 ]
P * A = R * Q,  where  R = [         ],
[  0  R22 ]
with R22 defined as the largest trailing upper triangular
submatrix whose estimated condition number is less than 1/RCOND.
The order of R22, RANK, is the effective rank of A.  Condition
estimation is performed during the RQ factorization process.
Matrix R11 is full (but of small norm), or empty.

MB3PYZ  does not perform any scaling of the matrix A.

```
Specification
```      SUBROUTINE MB3PYZ( M, N, A, LDA, RCOND, SVLMAX, RANK, SVAL, JPVT,
\$                   TAU, DWORK, ZWORK, INFO )
C     .. Scalar Arguments ..
INTEGER            INFO, LDA, M, N, RANK
DOUBLE PRECISION   RCOND, SVLMAX
C     .. Array Arguments ..
INTEGER            JPVT( * )
COMPLEX*16         A( LDA, * ), TAU( * ), ZWORK( * )
DOUBLE PRECISION   DWORK( * ), SVAL( 3 )

```
Arguments

Input/Output Parameters

```  M       (input) INTEGER
The number of rows of the matrix A.  M >= 0.

N       (input) INTEGER
The number of columns of the matrix A.  N >= 0.

A       (input/output) COMPLEX*16 array, dimension ( LDA, N )
On entry, the leading M-by-N part of this array must
contain the given matrix A.
On exit, the upper triangle of the subarray
A(M-RANK+1:M,N-RANK+1:N) contains the RANK-by-RANK upper
triangular matrix R22;  the remaining elements in the last
RANK  rows, with the array TAU, represent the unitary
matrix Q as a product of  RANK  elementary reflectors
(see METHOD).  The first  M-RANK  rows contain the result
of the RQ factorization process used.

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

RCOND   (input) DOUBLE PRECISION
RCOND is used to determine the effective rank of A, which
is defined as the order of the largest trailing triangular
submatrix R22 in the RQ factorization with pivoting of A,
whose estimated condition number is less than 1/RCOND.
0 <= RCOND <= 1.
NOTE that when SVLMAX > 0, the estimated rank could be
less than that defined above (see SVLMAX).

SVLMAX  (input) DOUBLE PRECISION
If A is a submatrix of another matrix B, and the rank
decision should be related to that matrix, then SVLMAX
should be an estimate of the largest singular value of B
(for instance, the Frobenius norm of B).  If this is not
the case, the input value SVLMAX = 0 should work.
SVLMAX >= 0.

RANK    (output) INTEGER
The effective (estimated) rank of A, i.e., the order of
the submatrix R22.

SVAL    (output) DOUBLE PRECISION array, dimension ( 3 )
The estimates of some of the singular values of the
triangular factor R:
SVAL(1): largest singular value of
R(M-RANK+1:M,N-RANK+1:N);
SVAL(2): smallest singular value of
R(M-RANK+1:M,N-RANK+1:N);
SVAL(3): smallest singular value of R(M-RANK:M,N-RANK:N),
if RANK < MIN( M, N ), or of
R(M-RANK+1:M,N-RANK+1:N), otherwise.
If the triangular factorization is a rank-revealing one
(which will be the case if the trailing rows were well-
conditioned), then SVAL(1) will also be an estimate for
the largest singular value of A, and SVAL(2) and SVAL(3)
will be estimates for the RANK-th and (RANK+1)-st singular
values of A, respectively.
By examining these values, one can confirm that the rank
is well defined with respect to the chosen value of RCOND.
The ratio SVAL(1)/SVAL(2) is an estimate of the condition
number of R(M-RANK+1:M,N-RANK+1:N).

JPVT    (output) INTEGER array, dimension ( M )
If JPVT(i) = k, then the i-th row of P*A was the k-th row
of A.

TAU     (output) COMPLEX*16 array, dimension ( MIN( M, N ) )
The trailing  RANK  elements of TAU contain the scalar
factors of the elementary reflectors.

```
Workspace
```  DWORK   DOUBLE PRECISION array, dimension ( 2*M )

ZWORK   COMPLEX*16 array, dimension ( 3*M-1 )

```
Error Indicator
```  INFO    INTEGER
= 0:  successful exit;
< 0:  if INFO = -i, the i-th argument had an illegal
value.

```
Method
```  The routine computes a truncated RQ factorization with row
pivoting of A,  P * A = R * Q,  with  R  defined above, and,
during this process, finds the largest trailing submatrix whose
estimated condition number is less than 1/RCOND, taking the
possible positive value of SVLMAX into account.  This is performed
using an adaptation of the LAPACK incremental condition estimation
scheme and a slightly modified rank decision test.  The
factorization process stops when  RANK  has been determined.

The matrix Q is represented as a product of elementary reflectors

Q = H(k-rank+1)' H(k-rank+2)' . . . H(k)', where k = min(m,n).

Each H(i) has the form

H = I - tau * v * v'

where tau is a complex scalar, and v is a complex vector with
v(n-k+i+1:n) = 0 and v(n-k+i) = 1; conjg(v(1:n-k+i-1)) is stored
on exit in A(m-k+i,1:n-k+i-1), and tau in TAU(i).

The matrix P is represented in jpvt as follows: If
jpvt(j) = i
then the jth row of P is the ith canonical unit vector.

```
References
```  [1] Bischof, C.H. and P. Tang.
Generalizing Incremental Condition Estimation.
LAPACK Working Notes 32, Mathematics and Computer Science
Division, Argonne National Laboratory, UT, CS-91-132,
May 1991.

[2] Bischof, C.H. and P. Tang.
Robust Incremental Condition Estimation.
LAPACK Working Notes 33, Mathematics and Computer Science
Division, Argonne National Laboratory, UT, CS-91-133,
May 1991.

```
Numerical Aspects
```  The algorithm is backward stable.

```
```  None
```
Example

Program Text

```  None
```
Program Data
```  None
```
Program Results
```  None
```