01:       INTEGER FUNCTION ILAZLR(M, N, A, LDA)
02:       IMPLICIT NONE
03: *
04: *  -- LAPACK auxiliary routine (version 3.2.1)                        --
05: *
06: *  -- April 2009                                                      --
07: *
08: *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
09: *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
10: *
11: *     .. Scalar Arguments ..
12:       INTEGER            M, N, LDA
13: *     ..
14: *     .. Array Arguments ..
15:       COMPLEX*16         A( LDA, * )
16: *     ..
17: *
18: *  Purpose
19: *  =======
20: *
21: *  ILAZLR scans A for its last non-zero row.
22: *
23: *  Arguments
24: *  =========
25: *
26: *  M       (input) INTEGER
27: *          The number of rows of the matrix A.
28: *
29: *  N       (input) INTEGER
30: *          The number of columns of the matrix A.
31: *
32: *  A       (input) COMPLEX*16 array, dimension (LDA,N)
33: *          The m by n matrix A.
34: *
35: *  LDA     (input) INTEGER
36: *          The leading dimension of the array A. LDA >= max(1,M).
37: *
38: *  =====================================================================
39: *
40: *     .. Parameters ..
41:       COMPLEX*16       ZERO
42:       PARAMETER ( ZERO = (0.0D+0, 0.0D+0) )
43: *     ..
44: *     .. Local Scalars ..
45:       INTEGER I, J
46: *     ..
47: *     .. Executable Statements ..
48: *
49: *     Quick test for the common case where one corner is non-zero.
50:       IF( M.EQ.0 ) THEN
51:          ILAZLR = M
52:       ELSE IF( A(M, 1).NE.ZERO .OR. A(M, N).NE.ZERO ) THEN
53:          ILAZLR = M
54:       ELSE
55: *     Scan up each column tracking the last zero row seen.
56:          ILAZLR = 0
57:          DO J = 1, N
58:             DO I = M, 1, -1
59:                IF( A(I, J).NE.ZERO ) EXIT
60:             END DO
61:             ILAZLR = MAX( ILAZLR, I )
62:          END DO
63:       END IF
64:       RETURN
65:       END FUNCTION
66: