01:       INTEGER FUNCTION ILASLC(M, N, A, LDA)
02:       IMPLICIT NONE
03: !
04: !  -- LAPACK auxiliary routine (version 3.2) --
05: !     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
06: !     December 2007
07: !
08: !     .. Scalar Arguments ..
09:       INTEGER            M, N, LDA
10: !     ..
11: !     .. Array Arguments ..
12:       REAL               A( LDA, * )
13: !     ..
14: !
15: !  Purpose
16: !  =======
17: !
18: !  ILASLC scans A for its last non-zero column.
19: !
20: !  Arguments
21: !  =========
22: !
23: !  M       (input) INTEGER
24: !          The number of rows of the matrix A.
25: !
26: !  N       (input) INTEGER
27: !          The number of columns of the matrix A.
28: !
29: !  A       (input) REAL array, dimension (LDA,N)
30: !          The m by n matrix A.
31: !
32: !  LDA     (input) INTEGER
33: !          The leading dimension of the array A. LDA >= max(1,M).
34: !
35: !  =====================================================================
36: !
37: !     .. Parameters ..
38:       REAL             ZERO
39:       PARAMETER ( ZERO = 0.0D+0 )
40: !     ..
41: !     .. Local Scalars ..
42:       INTEGER I
43: !     ..
44: !     .. Executable Statements ..
45: !
46: !     Quick test for the common case where one corner is non-zero.
47:       IF( N.EQ.0 .OR. A(1, N).NE.ZERO .OR. A(M, N).NE.ZERO ) THEN
48:          ILASLC = N
49:       ELSE
50: !     Now scan each column from the end, returning with the first non-zero.
51:          DO ILASLC = N, 1, -1
52:             DO I = 1, M
53:                IF( A(I, ILASLC).NE.ZERO ) RETURN
54:             END DO
55:          END DO
56:       END IF
57:       RETURN
58:       END FUNCTION
59: