LAPACK 3.3.0

iladlr.f

Go to the documentation of this file.
00001       INTEGER FUNCTION ILADLR( M, N, A, LDA )
00002       IMPLICIT NONE
00003 *
00004 *  -- LAPACK auxiliary routine (version 3.2.2)                        --
00005 *
00006 *  -- June 2010                                                       --
00007 *
00008 *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
00009 *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
00010 *
00011 *     .. Scalar Arguments ..
00012       INTEGER            M, N, LDA
00013 *     ..
00014 *     .. Array Arguments ..
00015       DOUBLE PRECISION   A( LDA, * )
00016 *     ..
00017 *
00018 *  Purpose
00019 *  =======
00020 *
00021 *  ILADLR scans A for its last non-zero row.
00022 *
00023 *  Arguments
00024 *  =========
00025 *
00026 *  M       (input) INTEGER
00027 *          The number of rows of the matrix A.
00028 *
00029 *  N       (input) INTEGER
00030 *          The number of columns of the matrix A.
00031 *
00032 *  A       (input) DOUBLE PRECISION array, dimension (LDA,N)
00033 *          The m by n matrix A.
00034 *
00035 *  LDA     (input) INTEGER
00036 *          The leading dimension of the array A. LDA >= max(1,M).
00037 *
00038 *  =====================================================================
00039 *
00040 *     .. Parameters ..
00041       DOUBLE PRECISION ZERO
00042       PARAMETER ( ZERO = 0.0D+0 )
00043 *     ..
00044 *     .. Local Scalars ..
00045       INTEGER I, J
00046 *     ..
00047 *     .. Executable Statements ..
00048 *
00049 *     Quick test for the common case where one corner is non-zero.
00050       IF( M.EQ.0 ) THEN
00051          ILADLR = M
00052       ELSE IF( A(M, 1).NE.ZERO .OR. A(M, N).NE.ZERO ) THEN
00053          ILADLR = M
00054       ELSE
00055 *     Scan up each column tracking the last zero row seen.
00056          ILADLR = 0
00057          DO J = 1, N
00058             DO I = M, 1, -1
00059                IF( A(I, J).NE.ZERO ) EXIT
00060             END DO
00061             ILADLR = MAX( ILADLR, I )
00062          END DO
00063       END IF
00064       RETURN
00065       END
 All Files Functions