1 *> \brief \b SLANSP returns the value of the 1-norm, or the Frobenius norm, or the infinity norm, or the element of largest absolute value of a symmetric matrix supplied in packed form.
3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download SLANSP + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/slansp.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/slansp.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/slansp.f">
21 * REAL FUNCTION SLANSP( NORM, UPLO, N, AP, WORK )
23 * .. Scalar Arguments ..
24 * CHARACTER NORM, UPLO
27 * .. Array Arguments ..
28 * REAL AP( * ), WORK( * )
37 *> SLANSP 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
39 *> real symmetric matrix A, supplied in packed form.
45 *> SLANSP = ( 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 SLANSP as described
71 *> UPLO is CHARACTER*1
72 *> Specifies whether the upper or lower triangular part of the
73 *> symmetric matrix A is supplied.
74 *> = 'U': Upper triangular part of A is supplied
75 *> = 'L': Lower triangular part of A is supplied
81 *> The order of the matrix A. N >= 0. When N = 0, SLANSP is
87 *> AP is REAL array, dimension (N*(N+1)/2)
88 *> The upper or lower triangle of the symmetric matrix A, packed
89 *> columnwise in a linear array. The j-th column of A is stored
90 *> in the array AP as follows:
91 *> if UPLO = 'U', AP(i + (j-1)*j/2) = A(i,j) for 1<=i<=j;
92 *> if UPLO = 'L', AP(i + (j-1)*(2n-j)/2) = A(i,j) for j<=i<=n.
97 *> WORK is REAL array, dimension (MAX(1,LWORK)),
98 *> where LWORK >= N when NORM = 'I' or '1' or 'O'; otherwise,
99 *> WORK is not referenced.
105 *> \author Univ. of Tennessee
106 *> \author Univ. of California Berkeley
107 *> \author Univ. of Colorado Denver
110 *> \date September 2012
112 *> \ingroup realOTHERauxiliary
114 * =====================================================================
115 REAL FUNCTION SLANSP( NORM, UPLO, N, AP, 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 AP( * ), WORK( * )
130 * =====================================================================
134 PARAMETER ( ONE = 1.0E+0, ZERO = 0.0E+0 )
136 * .. Local Scalars ..
138 REAL ABSA, SCALE, SUM, VALUE
140 * .. External Subroutines ..
143 * .. External Functions ..
144 LOGICAL LSAME, SISNAN
145 EXTERNAL LSAME, SISNAN
147 * .. Intrinsic Functions ..
150 * .. Executable Statements ..
154 ELSE IF( LSAME( NORM, 'M' ) ) THEN
156 * Find max(abs(A(i,j))).
159 IF( LSAME( UPLO, 'U' ) ) THEN
162 DO 10 I = K, K + J - 1
164 IF( VALUE .LT. SUM .OR. SISNAN( SUM ) ) VALUE = SUM
171 DO 30 I = K, K + N - J
173 IF( VALUE .LT. SUM .OR. SISNAN( SUM ) ) VALUE = SUM
178 ELSE IF( ( LSAME( NORM, 'I' ) ) .OR. ( LSAME( NORM, 'O' ) ) .OR.
179 $ ( NORM.EQ.'1' ) ) THEN
181 * Find normI(A) ( = norm1(A), since A is symmetric).
185 IF( LSAME( UPLO, 'U' ) ) THEN
189 ABSA = ABS( AP( K ) )
191 WORK( I ) = WORK( I ) + ABSA
194 WORK( J ) = SUM + ABS( AP( K ) )
199 IF( VALUE .LT. SUM .OR. SISNAN( SUM ) ) VALUE = SUM
206 SUM = WORK( J ) + ABS( AP( K ) )
209 ABSA = ABS( AP( K ) )
211 WORK( I ) = WORK( I ) + ABSA
214 IF( VALUE .LT. SUM .OR. SISNAN( SUM ) ) VALUE = SUM
217 ELSE IF( ( LSAME( NORM, 'F' ) ) .OR. ( LSAME( NORM, 'E' ) ) ) THEN
224 IF( LSAME( UPLO, 'U' ) ) THEN
226 CALL SLASSQ( J-1, AP( K ), 1, SCALE, SUM )
231 CALL SLASSQ( N-J, AP( K ), 1, SCALE, SUM )
238 IF( AP( K ).NE.ZERO ) THEN
239 ABSA = ABS( AP( K ) )
240 IF( SCALE.LT.ABSA ) THEN
241 SUM = ONE + SUM*( SCALE / ABSA )**2
244 SUM = SUM + ( ABSA / SCALE )**2
247 IF( LSAME( UPLO, 'U' ) ) THEN
253 VALUE = SCALE*SQRT( SUM )