KTH framework for Nek5000 toolboxes; testing version  0.0.1
dlanst.f
Go to the documentation of this file.
1  DOUBLE PRECISION FUNCTION dlanst( NORM, N, D, E )
2 *
3 * -- LAPACK auxiliary routine (version 3.0) --
4 * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
5 * Courant Institute, Argonne National Lab, and Rice University
6 * February 29, 1992
7 *
8 * .. Scalar Arguments ..
9  CHARACTER norm
10  INTEGER n
11 * ..
12 * .. Array Arguments ..
13  DOUBLE PRECISION d( * ), e( * )
14 * ..
15 *
16 * Purpose
17 * =======
18 *
19 * DLANST returns the value of the one norm, or the Frobenius norm, or
20 * the infinity norm, or the element of largest absolute value of a
21 * real symmetric tridiagonal matrix A.
22 *
23 * Description
24 * ===========
25 *
26 * DLANST returns the value
27 *
28 * DLANST = ( max(abs(A(i,j))), NORM = 'M' or 'm'
29 * (
30 * ( norm1(A), NORM = '1', 'O' or 'o'
31 * (
32 * ( normI(A), NORM = 'I' or 'i'
33 * (
34 * ( normF(A), NORM = 'F', 'f', 'E' or 'e'
35 *
36 * where norm1 denotes the one norm of a matrix (maximum column sum),
37 * normI denotes the infinity norm of a matrix (maximum row sum) and
38 * normF denotes the Frobenius norm of a matrix (square root of sum of
39 * squares). Note that max(abs(A(i,j))) is not a matrix norm.
40 *
41 * Arguments
42 * =========
43 *
44 * NORM (input) CHARACTER*1
45 * Specifies the value to be returned in DLANST as described
46 * above.
47 *
48 * N (input) INTEGER
49 * The order of the matrix A. N >= 0. When N = 0, DLANST is
50 * set to zero.
51 *
52 * D (input) DOUBLE PRECISION array, dimension (N)
53 * The diagonal elements of A.
54 *
55 * E (input) DOUBLE PRECISION array, dimension (N-1)
56 * The (n-1) sub-diagonal or super-diagonal elements of A.
57 *
58 * =====================================================================
59 *
60 * .. Parameters ..
61  DOUBLE PRECISION one, zero
62  parameter( one = 1.0d+0, zero = 0.0d+0 )
63 * ..
64 * .. Local Scalars ..
65  INTEGER i
66  DOUBLE PRECISION anorm, scale, sum
67 * ..
68 * .. External Functions ..
69  LOGICAL lsame
70  EXTERNAL lsame
71 * ..
72 * .. External Subroutines ..
73  EXTERNAL dlassq
74 * ..
75 * .. Intrinsic Functions ..
76  INTRINSIC abs, max, sqrt
77 * ..
78 * .. Executable Statements ..
79 *
80  IF( n.LE.0 ) THEN
81  anorm = zero
82  ELSE IF( lsame( norm, 'M' ) ) THEN
83 *
84 * Find max(abs(A(i,j))).
85 *
86  anorm = abs( d( n ) )
87  DO 10 i = 1, n - 1
88  anorm = max( anorm, abs( d( i ) ) )
89  anorm = max( anorm, abs( e( i ) ) )
90  10 CONTINUE
91  ELSE IF( lsame( norm, 'O' ) .OR. norm.EQ.'1' .OR.
92  $ lsame( norm, 'I' ) ) THEN
93 *
94 * Find norm1(A).
95 *
96  IF( n.EQ.1 ) THEN
97  anorm = abs( d( 1 ) )
98  ELSE
99  anorm = max( abs( d( 1 ) )+abs( e( 1 ) ),
100  $ abs( e( n-1 ) )+abs( d( n ) ) )
101  DO 20 i = 2, n - 1
102  anorm = max( anorm, abs( d( i ) )+abs( e( i ) )+
103  $ abs( e( i-1 ) ) )
104  20 CONTINUE
105  END IF
106  ELSE IF( ( lsame( norm, 'F' ) ) .OR. ( lsame( norm, 'E' ) ) ) THEN
107 *
108 * Find normF(A).
109 *
110  scale = zero
111  sum = one
112  IF( n.GT.1 ) THEN
113  CALL dlassq( n-1, e, 1, scale, sum )
114  sum = 2*sum
115  END IF
116  CALL dlassq( n, d, 1, scale, sum )
117  anorm = scale*sqrt( sum )
118  END IF
119 *
120  dlanst = anorm
121  RETURN
122 *
123 * End of DLANST
124 *
125  END
subroutine scale(xyzl, nl)
Definition: connect2.f:602
double precision function dlanst(NORM, N, D, E)
Definition: dlanst.f:2
subroutine dlassq(N, X, INCX, SCALE, SUMSQ)
Definition: dlassq.f:2
logical function lsame(CA, CB)
Definition: lsame.f:2