01:       INTEGER FUNCTION ILACLC(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            A( LDA, * )
16: *     ..
17: *
18: *  Purpose
19: *  =======
20: *
21: *  ILACLC 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 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          ZERO
42:       PARAMETER ( ZERO = (0.0E+0, 0.0E+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:          ILACLC = N
52:       ELSE IF( A(1, N).NE.ZERO .OR. A(M, N).NE.ZERO ) THEN
53:          ILACLC = N
54:       ELSE
55: *     Now scan each column from the end, returning with the first non-zero.
56:          DO ILACLC = N, 1, -1
57:             DO I = 1, M
58:                IF( A(I, ILACLC).NE.ZERO ) RETURN
59:             END DO
60:          END DO
61:       END IF
62:       RETURN
63:       END FUNCTION
64: