KTH framework for Nek5000 toolboxes; testing version  0.0.1
dlanhs.f
Go to the documentation of this file.
1  DOUBLE PRECISION FUNCTION dlanhs( NORM, N, A, LDA, WORK )
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 * October 31, 1992
7 *
8 * .. Scalar Arguments ..
9  CHARACTER norm
10  INTEGER lda, n
11 * ..
12 * .. Array Arguments ..
13  DOUBLE PRECISION a( lda, * ), work( * )
14 * ..
15 *
16 * Purpose
17 * =======
18 *
19 * DLANHS 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 * Hessenberg matrix A.
22 *
23 * Description
24 * ===========
25 *
26 * DLANHS returns the value
27 *
28 * DLANHS = ( 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 DLANHS as described
46 * above.
47 *
48 * N (input) INTEGER
49 * The order of the matrix A. N >= 0. When N = 0, DLANHS is
50 * set to zero.
51 *
52 * A (input) DOUBLE PRECISION array, dimension (LDA,N)
53 * The n by n upper Hessenberg matrix A; the part of A below the
54 * first sub-diagonal is not referenced.
55 *
56 * LDA (input) INTEGER
57 * The leading dimension of the array A. LDA >= max(N,1).
58 *
59 * WORK (workspace) DOUBLE PRECISION array, dimension (LWORK),
60 * where LWORK >= N when NORM = 'I'; otherwise, WORK is not
61 * referenced.
62 *
63 * =====================================================================
64 *
65 * .. Parameters ..
66  DOUBLE PRECISION one, zero
67  parameter( one = 1.0d+0, zero = 0.0d+0 )
68 * ..
69 * .. Local Scalars ..
70  INTEGER i, j
71  DOUBLE PRECISION scale, sum, value
72 * ..
73 * .. External Subroutines ..
74  EXTERNAL dlassq
75 * ..
76 * .. External Functions ..
77  LOGICAL lsame
78  EXTERNAL lsame
79 * ..
80 * .. Intrinsic Functions ..
81  INTRINSIC abs, max, min, sqrt
82 * ..
83 * .. Executable Statements ..
84 *
85  IF( n.EQ.0 ) THEN
86  VALUE = zero
87  ELSE IF( lsame( norm, 'M' ) ) THEN
88 *
89 * Find max(abs(A(i,j))).
90 *
91  VALUE = zero
92  DO 20 j = 1, n
93  DO 10 i = 1, min( n, j+1 )
94  VALUE = max( VALUE, abs( a( i, j ) ) )
95  10 CONTINUE
96  20 CONTINUE
97  ELSE IF( ( lsame( norm, 'O' ) ) .OR. ( norm.EQ.'1' ) ) THEN
98 *
99 * Find norm1(A).
100 *
101  VALUE = zero
102  DO 40 j = 1, n
103  sum = zero
104  DO 30 i = 1, min( n, j+1 )
105  sum = sum + abs( a( i, j ) )
106  30 CONTINUE
107  VALUE = max( VALUE, sum )
108  40 CONTINUE
109  ELSE IF( lsame( norm, 'I' ) ) THEN
110 *
111 * Find normI(A).
112 *
113  DO 50 i = 1, n
114  work( i ) = zero
115  50 CONTINUE
116  DO 70 j = 1, n
117  DO 60 i = 1, min( n, j+1 )
118  work( i ) = work( i ) + abs( a( i, j ) )
119  60 CONTINUE
120  70 CONTINUE
121  VALUE = zero
122  DO 80 i = 1, n
123  VALUE = max( VALUE, work( i ) )
124  80 CONTINUE
125  ELSE IF( ( lsame( norm, 'F' ) ) .OR. ( lsame( norm, 'E' ) ) ) THEN
126 *
127 * Find normF(A).
128 *
129  scale = zero
130  sum = one
131  DO 90 j = 1, n
132  CALL dlassq( min( n, j+1 ), a( 1, j ), 1, scale, sum )
133  90 CONTINUE
134  VALUE = scale*sqrt( sum )
135  END IF
136 *
137  dlanhs = VALUE
138  RETURN
139 *
140 * End of DLANHS
141 *
142  END
subroutine scale(xyzl, nl)
Definition: connect2.f:602
double precision function dlanhs(NORM, N, A, LDA, WORK)
Definition: dlanhs.f:2
subroutine dlassq(N, X, INCX, SCALE, SUMSQ)
Definition: dlassq.f:2
logical function lsame(CA, CB)
Definition: lsame.f:2