1       INTEGER FUNCTION ILAZLC( M, N, A, LDA )
 2       IMPLICIT NONE
 3 *
 4 *  -- LAPACK auxiliary routine (version 3.2.2)                        --
 5 *
 6 *  -- June 2010                                                       --
 7 *
 8 *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
 9 *  -- 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 *  ILAZLC scans A for its last non-zero column.
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+00.0D+0) )
43 *     ..
44 *     .. Local Scalars ..
45       INTEGER I
46 *     ..
47 *     .. Executable Statements ..
48 *
49 *     Quick test for the common case where one corner is non-zero.
50       IF( N.EQ.0 ) THEN
51          ILAZLC = N
52       ELSE IF( A(1, N).NE.ZERO .OR. A(M, N).NE.ZERO ) THEN
53          ILAZLC = N
54       ELSE
55 *     Now scan each column from the end, returning with the first non-zero.
56          DO ILAZLC = N, 1-1
57             DO I = 1, M
58                IF( A(I, ILAZLC).NE.ZERO ) RETURN
59             END DO
60          END DO
61       END IF
62       RETURN
63       END