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. 2* 3* =========== DOCUMENTATION =========== 4* 5* Online html documentation available at 6* http://www.netlib.org/lapack/explore-html/ 7* 8*> \htmlonly 9*> Download SLANTP + dependencies 10*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/slantp.f"> 11*> [TGZ]</a> 12*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/slantp.f"> 13*> [ZIP]</a> 14*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/slantp.f"> 15*> [TXT]</a> 16*> \endhtmlonly 17* 18* Definition: 19* =========== 20* 21* REAL FUNCTION SLANTP( NORM, UPLO, DIAG, N, AP, WORK ) 22* 23* .. Scalar Arguments .. 24* CHARACTER DIAG, NORM, UPLO 25* INTEGER N 26* .. 27* .. Array Arguments .. 28* REAL AP( * ), WORK( * ) 29* .. 30* 31* 32*> \par Purpose: 33* ============= 34*> 35*> \verbatim 36*> 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. 40*> \endverbatim 41*> 42*> \return SLANTP 43*> \verbatim 44*> 45*> SLANTP = ( max(abs(A(i,j))), NORM = 'M' or 'm' 46*> ( 47*> ( norm1(A), NORM = '1', 'O' or 'o' 48*> ( 49*> ( normI(A), NORM = 'I' or 'i' 50*> ( 51*> ( normF(A), NORM = 'F', 'f', 'E' or 'e' 52*> 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. 57*> \endverbatim 58* 59* Arguments: 60* ========== 61* 62*> \param[in] NORM 63*> \verbatim 64*> NORM is CHARACTER*1 65*> Specifies the value to be returned in SLANTP as described 66*> above. 67*> \endverbatim 68*> 69*> \param[in] UPLO 70*> \verbatim 71*> UPLO is CHARACTER*1 72*> Specifies whether the matrix A is upper or lower triangular. 73*> = 'U': Upper triangular 74*> = 'L': Lower triangular 75*> \endverbatim 76*> 77*> \param[in] DIAG 78*> \verbatim 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 83*> \endverbatim 84*> 85*> \param[in] N 86*> \verbatim 87*> N is INTEGER 88*> The order of the matrix A. N >= 0. When N = 0, SLANTP is 89*> set to zero. 90*> \endverbatim 91*> 92*> \param[in] AP 93*> \verbatim 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 97*> AP as follows: 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. 103*> \endverbatim 104*> 105*> \param[out] WORK 106*> \verbatim 107*> WORK is REAL array, dimension (MAX(1,LWORK)), 108*> where LWORK >= N when NORM = 'I'; otherwise, WORK is not 109*> referenced. 110*> \endverbatim 111* 112* Authors: 113* ======== 114* 115*> \author Univ. of Tennessee 116*> \author Univ. of California Berkeley 117*> \author Univ. of Colorado Denver 118*> \author NAG Ltd. 119* 120*> \ingroup realOTHERauxiliary 121* 122* ===================================================================== 123 REAL FUNCTION SLANTP( NORM, UPLO, DIAG, N, AP, WORK ) 124* 125* -- LAPACK auxiliary routine -- 126* -- LAPACK is a software package provided by Univ. of Tennessee, -- 127* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- 128* 129 IMPLICIT NONE 130* .. Scalar Arguments .. 131 CHARACTER DIAG, NORM, UPLO 132 INTEGER N 133* .. 134* .. Array Arguments .. 135 REAL AP( * ), WORK( * ) 136* .. 137* 138* ===================================================================== 139* 140* .. Parameters .. 141 REAL ONE, ZERO 142 PARAMETER ( ONE = 1.0E+0, ZERO = 0.0E+0 ) 143* .. 144* .. Local Scalars .. 145 LOGICAL UDIAG 146 INTEGER I, J, K 147 REAL SUM, VALUE 148* .. 149* .. Local Arrays .. 150 REAL SSQ( 2 ), COLSSQ( 2 ) 151* .. 152* .. External Functions .. 153 LOGICAL LSAME, SISNAN 154 EXTERNAL LSAME, SISNAN 155* .. 156* .. External Subroutines .. 157 EXTERNAL SLASSQ, SCOMBSSQ 158* .. 159* .. Intrinsic Functions .. 160 INTRINSIC ABS, SQRT 161* .. 162* .. Executable Statements .. 163* 164 IF( N.EQ.0 ) THEN 165 VALUE = ZERO 166 ELSE IF( LSAME( NORM, 'M' ) ) THEN 167* 168* Find max(abs(A(i,j))). 169* 170 K = 1 171 IF( LSAME( DIAG, 'U' ) ) THEN 172 VALUE = ONE 173 IF( LSAME( UPLO, 'U' ) ) THEN 174 DO 20 J = 1, N 175 DO 10 I = K, K + J - 2 176 SUM = ABS( AP( I ) ) 177 IF( VALUE .LT. SUM .OR. SISNAN( SUM ) ) VALUE = SUM 178 10 CONTINUE 179 K = K + J 180 20 CONTINUE 181 ELSE 182 DO 40 J = 1, N 183 DO 30 I = K + 1, K + N - J 184 SUM = ABS( AP( I ) ) 185 IF( VALUE .LT. SUM .OR. SISNAN( SUM ) ) VALUE = SUM 186 30 CONTINUE 187 K = K + N - J + 1 188 40 CONTINUE 189 END IF 190 ELSE 191 VALUE = ZERO 192 IF( LSAME( UPLO, 'U' ) ) THEN 193 DO 60 J = 1, N 194 DO 50 I = K, K + J - 1 195 SUM = ABS( AP( I ) ) 196 IF( VALUE .LT. SUM .OR. SISNAN( SUM ) ) VALUE = SUM 197 50 CONTINUE 198 K = K + J 199 60 CONTINUE 200 ELSE 201 DO 80 J = 1, N 202 DO 70 I = K, K + N - J 203 SUM = ABS( AP( I ) ) 204 IF( VALUE .LT. SUM .OR. SISNAN( SUM ) ) VALUE = SUM 205 70 CONTINUE 206 K = K + N - J + 1 207 80 CONTINUE 208 END IF 209 END IF 210 ELSE IF( ( LSAME( NORM, 'O' ) ) .OR. ( NORM.EQ.'1' ) ) THEN 211* 212* Find norm1(A). 213* 214 VALUE = ZERO 215 K = 1 216 UDIAG = LSAME( DIAG, 'U' ) 217 IF( LSAME( UPLO, 'U' ) ) THEN 218 DO 110 J = 1, N 219 IF( UDIAG ) THEN 220 SUM = ONE 221 DO 90 I = K, K + J - 2 222 SUM = SUM + ABS( AP( I ) ) 223 90 CONTINUE 224 ELSE 225 SUM = ZERO 226 DO 100 I = K, K + J - 1 227 SUM = SUM + ABS( AP( I ) ) 228 100 CONTINUE 229 END IF 230 K = K + J 231 IF( VALUE .LT. SUM .OR. SISNAN( SUM ) ) VALUE = SUM 232 110 CONTINUE 233 ELSE 234 DO 140 J = 1, N 235 IF( UDIAG ) THEN 236 SUM = ONE 237 DO 120 I = K + 1, K + N - J 238 SUM = SUM + ABS( AP( I ) ) 239 120 CONTINUE 240 ELSE 241 SUM = ZERO 242 DO 130 I = K, K + N - J 243 SUM = SUM + ABS( AP( I ) ) 244 130 CONTINUE 245 END IF 246 K = K + N - J + 1 247 IF( VALUE .LT. SUM .OR. SISNAN( SUM ) ) VALUE = SUM 248 140 CONTINUE 249 END IF 250 ELSE IF( LSAME( NORM, 'I' ) ) THEN 251* 252* Find normI(A). 253* 254 K = 1 255 IF( LSAME( UPLO, 'U' ) ) THEN 256 IF( LSAME( DIAG, 'U' ) ) THEN 257 DO 150 I = 1, N 258 WORK( I ) = ONE 259 150 CONTINUE 260 DO 170 J = 1, N 261 DO 160 I = 1, J - 1 262 WORK( I ) = WORK( I ) + ABS( AP( K ) ) 263 K = K + 1 264 160 CONTINUE 265 K = K + 1 266 170 CONTINUE 267 ELSE 268 DO 180 I = 1, N 269 WORK( I ) = ZERO 270 180 CONTINUE 271 DO 200 J = 1, N 272 DO 190 I = 1, J 273 WORK( I ) = WORK( I ) + ABS( AP( K ) ) 274 K = K + 1 275 190 CONTINUE 276 200 CONTINUE 277 END IF 278 ELSE 279 IF( LSAME( DIAG, 'U' ) ) THEN 280 DO 210 I = 1, N 281 WORK( I ) = ONE 282 210 CONTINUE 283 DO 230 J = 1, N 284 K = K + 1 285 DO 220 I = J + 1, N 286 WORK( I ) = WORK( I ) + ABS( AP( K ) ) 287 K = K + 1 288 220 CONTINUE 289 230 CONTINUE 290 ELSE 291 DO 240 I = 1, N 292 WORK( I ) = ZERO 293 240 CONTINUE 294 DO 260 J = 1, N 295 DO 250 I = J, N 296 WORK( I ) = WORK( I ) + ABS( AP( K ) ) 297 K = K + 1 298 250 CONTINUE 299 260 CONTINUE 300 END IF 301 END IF 302 VALUE = ZERO 303 DO 270 I = 1, N 304 SUM = WORK( I ) 305 IF( VALUE .LT. SUM .OR. SISNAN( SUM ) ) VALUE = SUM 306 270 CONTINUE 307 ELSE IF( ( LSAME( NORM, 'F' ) ) .OR. ( LSAME( NORM, 'E' ) ) ) THEN 308* 309* Find normF(A). 310* SSQ(1) is scale 311* SSQ(2) is sum-of-squares 312* For better accuracy, sum each column separately. 313* 314 IF( LSAME( UPLO, 'U' ) ) THEN 315 IF( LSAME( DIAG, 'U' ) ) THEN 316 SSQ( 1 ) = ONE 317 SSQ( 2 ) = N 318 K = 2 319 DO 280 J = 2, N 320 COLSSQ( 1 ) = ZERO 321 COLSSQ( 2 ) = ONE 322 CALL SLASSQ( J-1, AP( K ), 1, 323 $ COLSSQ( 1 ), COLSSQ( 2 ) ) 324 CALL SCOMBSSQ( SSQ, COLSSQ ) 325 K = K + J 326 280 CONTINUE 327 ELSE 328 SSQ( 1 ) = ZERO 329 SSQ( 2 ) = ONE 330 K = 1 331 DO 290 J = 1, N 332 COLSSQ( 1 ) = ZERO 333 COLSSQ( 2 ) = ONE 334 CALL SLASSQ( J, AP( K ), 1, 335 $ COLSSQ( 1 ), COLSSQ( 2 ) ) 336 CALL SCOMBSSQ( SSQ, COLSSQ ) 337 K = K + J 338 290 CONTINUE 339 END IF 340 ELSE 341 IF( LSAME( DIAG, 'U' ) ) THEN 342 SSQ( 1 ) = ONE 343 SSQ( 2 ) = N 344 K = 2 345 DO 300 J = 1, N - 1 346 COLSSQ( 1 ) = ZERO 347 COLSSQ( 2 ) = ONE 348 CALL SLASSQ( N-J, AP( K ), 1, 349 $ COLSSQ( 1 ), COLSSQ( 2 ) ) 350 CALL SCOMBSSQ( SSQ, COLSSQ ) 351 K = K + N - J + 1 352 300 CONTINUE 353 ELSE 354 SSQ( 1 ) = ZERO 355 SSQ( 2 ) = ONE 356 K = 1 357 DO 310 J = 1, N 358 COLSSQ( 1 ) = ZERO 359 COLSSQ( 2 ) = ONE 360 CALL SLASSQ( N-J+1, AP( K ), 1, 361 $ COLSSQ( 1 ), COLSSQ( 2 ) ) 362 CALL SCOMBSSQ( SSQ, COLSSQ ) 363 K = K + N - J + 1 364 310 CONTINUE 365 END IF 366 END IF 367 VALUE = SSQ( 1 )*SQRT( SSQ( 2 ) ) 368 END IF 369* 370 SLANTP = VALUE 371 RETURN 372* 373* End of SLANTP 374* 375 END 376