1 *> \brief \b SLANTP returns the value of the 1-norm, or the Frobenius norm, or the infinity norm, or the element of largest absolute value of a triangular matrix supplied in packed form.
3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download SLANTP + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/slantp.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/slantp.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/slantp.f">
21 * REAL FUNCTION SLANTP( NORM, UPLO, DIAG, N, AP, WORK )
23 * .. Scalar Arguments ..
24 * CHARACTER DIAG, NORM, UPLO
27 * .. Array Arguments ..
28 * REAL AP( * ), WORK( * )
37 *> SLANTP 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 *> triangular matrix A, supplied in packed form.
45 *> SLANTP = ( 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 SLANTP as described
71 *> UPLO is CHARACTER*1
72 *> Specifies whether the matrix A is upper or lower triangular.
73 *> = 'U': Upper triangular
74 *> = 'L': Lower triangular
79 *> DIAG is CHARACTER*1
80 *> Specifies whether or not the matrix A is unit triangular.
81 *> = 'N': Non-unit triangular
82 *> = 'U': Unit triangular
88 *> The order of the matrix A. N >= 0. When N = 0, SLANTP is
94 *> AP is REAL array, dimension (N*(N+1)/2)
95 *> The upper or lower triangular matrix A, packed columnwise in
96 *> a linear array. The j-th column of A is stored in the array
98 *> if UPLO = 'U', AP(i + (j-1)*j/2) = A(i,j) for 1<=i<=j;
99 *> if UPLO = 'L', AP(i + (j-1)*(2n-j)/2) = A(i,j) for j<=i<=n.
100 *> Note that when DIAG = 'U', the elements of the array AP
101 *> corresponding to the diagonal elements of the matrix A are
102 *> not referenced, but are assumed to be one.
107 *> WORK is REAL array, dimension (MAX(1,LWORK)),
108 *> where LWORK >= N when NORM = 'I'; otherwise, WORK is not
115 *> \author Univ. of Tennessee
116 *> \author Univ. of California Berkeley
117 *> \author Univ. of Colorado Denver
120 *> \date September 2012
122 *> \ingroup realOTHERauxiliary
124 * =====================================================================
125 REAL FUNCTION SLANTP( NORM, UPLO, DIAG, N, AP, WORK )
127 * -- LAPACK auxiliary routine (version 3.4.2) --
128 * -- LAPACK is a software package provided by Univ. of Tennessee, --
129 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
132 * .. Scalar Arguments ..
133 CHARACTER DIAG, NORM, UPLO
136 * .. Array Arguments ..
137 REAL AP( * ), WORK( * )
140 * =====================================================================
144 PARAMETER ( ONE = 1.0E+0, ZERO = 0.0E+0 )
146 * .. Local Scalars ..
149 REAL SCALE, SUM, VALUE
151 * .. External Subroutines ..
154 * .. External Functions ..
155 LOGICAL LSAME, SISNAN
156 EXTERNAL LSAME, SISNAN
158 * .. Intrinsic Functions ..
161 * .. Executable Statements ..
165 ELSE IF( LSAME( NORM, 'M' ) ) THEN
167 * Find max(abs(A(i,j))).
170 IF( LSAME( DIAG, 'U' ) ) THEN
172 IF( LSAME( UPLO, 'U' ) ) THEN
174 DO 10 I = K, K + J - 2
176 IF( VALUE .LT. SUM .OR. SISNAN( SUM ) ) VALUE = SUM
182 DO 30 I = K + 1, K + N - J
184 IF( VALUE .LT. SUM .OR. SISNAN( SUM ) ) VALUE = SUM
191 IF( LSAME( UPLO, 'U' ) ) THEN
193 DO 50 I = K, K + J - 1
195 IF( VALUE .LT. SUM .OR. SISNAN( SUM ) ) VALUE = SUM
201 DO 70 I = K, K + N - J
203 IF( VALUE .LT. SUM .OR. SISNAN( SUM ) ) VALUE = SUM
209 ELSE IF( ( LSAME( NORM, 'O' ) ) .OR. ( NORM.EQ.'1' ) ) THEN
215 UDIAG = LSAME( DIAG, 'U' )
216 IF( LSAME( UPLO, 'U' ) ) THEN
220 DO 90 I = K, K + J - 2
221 SUM = SUM + ABS( AP( I ) )
225 DO 100 I = K, K + J - 1
226 SUM = SUM + ABS( AP( I ) )
230 IF( VALUE .LT. SUM .OR. SISNAN( SUM ) ) VALUE = SUM
236 DO 120 I = K + 1, K + N - J
237 SUM = SUM + ABS( AP( I ) )
241 DO 130 I = K, K + N - J
242 SUM = SUM + ABS( AP( I ) )
246 IF( VALUE .LT. SUM .OR. SISNAN( SUM ) ) VALUE = SUM
249 ELSE IF( LSAME( NORM, 'I' ) ) THEN
254 IF( LSAME( UPLO, 'U' ) ) THEN
255 IF( LSAME( DIAG, 'U' ) ) THEN
261 WORK( I ) = WORK( I ) + ABS( AP( K ) )
272 WORK( I ) = WORK( I ) + ABS( AP( K ) )
278 IF( LSAME( DIAG, 'U' ) ) THEN
285 WORK( I ) = WORK( I ) + ABS( AP( K ) )
295 WORK( I ) = WORK( I ) + ABS( AP( K ) )
304 IF( VALUE .LT. SUM .OR. SISNAN( SUM ) ) VALUE = SUM
306 ELSE IF( ( LSAME( NORM, 'F' ) ) .OR. ( LSAME( NORM, 'E' ) ) ) THEN
310 IF( LSAME( UPLO, 'U' ) ) THEN
311 IF( LSAME( DIAG, 'U' ) ) THEN
316 CALL SLASSQ( J-1, AP( K ), 1, SCALE, SUM )
324 CALL SLASSQ( J, AP( K ), 1, SCALE, SUM )
329 IF( LSAME( DIAG, 'U' ) ) THEN
334 CALL SLASSQ( N-J, AP( K ), 1, SCALE, SUM )
342 CALL SLASSQ( N-J+1, AP( K ), 1, SCALE, SUM )
347 VALUE = SCALE*SQRT( SUM )