INTEGER FUNCTION ILASLR(M, N, A, LDA) IMPLICIT NONE * * -- LAPACK auxiliary routine (version 3.2.1) -- * * -- April 2009 -- * * -- LAPACK is a software package provided by Univ. of Tennessee, -- * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- * * .. Scalar Arguments .. INTEGER M, N, LDA * .. * .. Array Arguments .. REAL A( LDA, * ) * .. * * Purpose * ======= * * ILASLR scans A for its last non-zero row. * * Arguments * ========= * * M (input) INTEGER * The number of rows of the matrix A. * * N (input) INTEGER * The number of columns of the matrix A. * * A (input) REAL array, dimension (LDA,N) * The m by n matrix A. * * LDA (input) INTEGER * The leading dimension of the array A. LDA >= max(1,M). * * ===================================================================== * * .. Parameters .. REAL ZERO PARAMETER ( ZERO = 0.0E+0 ) * .. * .. Local Scalars .. INTEGER I, J * .. * .. Executable Statements .. * * Quick test for the common case where one corner is non-zero. IF( M.EQ.0 ) THEN ILASLR = M ELSEIF( A(M, 1).NE.ZERO .OR. A(M, N).NE.ZERO ) THEN ILASLR = M ELSE * Scan up each column tracking the last zero row seen. ILASLR = 0 DO J = 1, N DO I = M, 1, -1 IF( A(I, J).NE.ZERO ) EXIT END DO ILASLR = MAX( ILASLR, I ) END DO END IF RETURN END FUNCTION