1 *> \brief \b SLANGE returns the value of the 1-norm, Frobenius norm, infinity-norm, or the largest absolute value of any element of a general rectangular matrix.
3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download SLANGE + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/slange.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/slange.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/slange.f">
21 * REAL FUNCTION SLANGE( NORM, M, N, A, LDA, WORK )
23 * .. Scalar Arguments ..
27 * .. Array Arguments ..
28 * REAL A( LDA, * ), WORK( * )
37 *> SLANGE returns the value of the one norm, or the Frobenius norm, or
38 *> the infinity norm, or the element of largest absolute value of a
45 *> SLANGE = ( max(abs(A(i,j))), NORM = 'M' or 'm'
47 *> ( norm1(A), NORM = '1', 'O' or 'o'
49 *> ( normI(A), NORM = 'I' or 'i'
51 *> ( normF(A), NORM = 'F', 'f', 'E' or 'e'
53 *> where norm1 denotes the one norm of a matrix (maximum column sum),
54 *> normI denotes the infinity norm of a matrix (maximum row sum) and
55 *> normF denotes the Frobenius norm of a matrix (square root of sum of
56 *> squares). Note that max(abs(A(i,j))) is not a consistent matrix norm.
64 *> NORM is CHARACTER*1
65 *> Specifies the value to be returned in SLANGE as described
72 *> The number of rows of the matrix A. M >= 0. When M = 0,
73 *> SLANGE is set to zero.
79 *> The number of columns of the matrix A. N >= 0. When N = 0,
80 *> SLANGE is set to zero.
85 *> A is REAL array, dimension (LDA,N)
86 *> The m by n matrix A.
92 *> The leading dimension of the array A. LDA >= max(M,1).
97 *> WORK is REAL array, dimension (MAX(1,LWORK)),
98 *> where LWORK >= M when NORM = 'I'; otherwise, WORK is not
105 *> \author Univ. of Tennessee
106 *> \author Univ. of California Berkeley
107 *> \author Univ. of Colorado Denver
110 *> \date September 2012
112 *> \ingroup realGEauxiliary
114 * =====================================================================
115 REAL FUNCTION SLANGE( NORM, M, N, A, LDA, WORK )
117 * -- LAPACK auxiliary routine (version 3.4.2) --
118 * -- LAPACK is a software package provided by Univ. of Tennessee, --
119 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
122 * .. Scalar Arguments ..
126 * .. Array Arguments ..
127 REAL A( LDA, * ), WORK( * )
130 * =====================================================================
134 PARAMETER ( ONE = 1.0E+0, ZERO = 0.0E+0 )
136 * .. Local Scalars ..
138 REAL SCALE, SUM, VALUE, TEMP
140 * .. External Subroutines ..
143 * .. External Functions ..
144 LOGICAL LSAME, SISNAN
145 EXTERNAL LSAME, SISNAN
147 * .. Intrinsic Functions ..
148 INTRINSIC ABS, MIN, SQRT
150 * .. Executable Statements ..
152 IF( MIN( M, N ).EQ.0 ) THEN
154 ELSE IF( LSAME( NORM, 'M' ) ) THEN
156 * Find max(abs(A(i,j))).
161 TEMP = ABS( A( I, J ) )
162 IF( VALUE.LT.TEMP .OR. SISNAN( TEMP ) ) VALUE = TEMP
165 ELSE IF( ( LSAME( NORM, 'O' ) ) .OR. ( NORM.EQ.'1' ) ) THEN
173 SUM = SUM + ABS( A( I, J ) )
175 IF( VALUE.LT.SUM .OR. SISNAN( SUM ) ) VALUE = SUM
177 ELSE IF( LSAME( NORM, 'I' ) ) THEN
186 WORK( I ) = WORK( I ) + ABS( A( I, J ) )
192 IF( VALUE.LT.TEMP .OR. SISNAN( TEMP ) ) VALUE = TEMP
194 ELSE IF( ( LSAME( NORM, 'F' ) ) .OR. ( LSAME( NORM, 'E' ) ) ) THEN
201 CALL SLASSQ( M, A( 1, J ), 1, SCALE, SUM )
203 VALUE = SCALE*SQRT( SUM )