LAPACK  3.9.0
LAPACK: Linear Algebra PACKage

◆ dlanhs()

double precision function dlanhs ( character  NORM,
integer  N,
double precision, dimension( lda, * )  A,
integer  LDA,
double precision, dimension( * )  WORK 
)

DLANHS returns the value of the 1-norm, Frobenius norm, infinity-norm, or the largest absolute value of any element of an upper Hessenberg matrix.

Download DLANHS + dependencies [TGZ] [ZIP] [TXT]

Purpose:
 DLANHS  returns the value of the one norm,  or the Frobenius norm, or
 the  infinity norm,  or the  element of  largest absolute value  of a
 Hessenberg matrix A.
Returns
DLANHS
    DLANHS = ( max(abs(A(i,j))), NORM = 'M' or 'm'
             (
             ( norm1(A),         NORM = '1', 'O' or 'o'
             (
             ( normI(A),         NORM = 'I' or 'i'
             (
             ( normF(A),         NORM = 'F', 'f', 'E' or 'e'

 where  norm1  denotes the  one norm of a matrix (maximum column sum),
 normI  denotes the  infinity norm  of a matrix  (maximum row sum) and
 normF  denotes the  Frobenius norm of a matrix (square root of sum of
 squares).  Note that  max(abs(A(i,j)))  is not a consistent matrix norm.
Parameters
[in]NORM
          NORM is CHARACTER*1
          Specifies the value to be returned in DLANHS as described
          above.
[in]N
          N is INTEGER
          The order of the matrix A.  N >= 0.  When N = 0, DLANHS is
          set to zero.
[in]A
          A is DOUBLE PRECISION array, dimension (LDA,N)
          The n by n upper Hessenberg matrix A; the part of A below the
          first sub-diagonal is not referenced.
[in]LDA
          LDA is INTEGER
          The leading dimension of the array A.  LDA >= max(N,1).
[out]WORK
          WORK is DOUBLE PRECISION array, dimension (MAX(1,LWORK)),
          where LWORK >= N when NORM = 'I'; otherwise, WORK is not
          referenced.
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
December 2016

Definition at line 110 of file dlanhs.f.

110 *
111 * -- LAPACK auxiliary routine (version 3.7.0) --
112 * -- LAPACK is a software package provided by Univ. of Tennessee, --
113 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
114 * December 2016
115 *
116  IMPLICIT NONE
117 * .. Scalar Arguments ..
118  CHARACTER NORM
119  INTEGER LDA, N
120 * ..
121 * .. Array Arguments ..
122  DOUBLE PRECISION A( LDA, * ), WORK( * )
123 * ..
124 *
125 * =====================================================================
126 *
127 * .. Parameters ..
128  DOUBLE PRECISION ONE, ZERO
129  parameter( one = 1.0d+0, zero = 0.0d+0 )
130 * ..
131 * .. Local Scalars ..
132  INTEGER I, J
133  DOUBLE PRECISION SUM, VALUE
134 * ..
135 * .. Local Arrays ..
136  DOUBLE PRECISION SSQ( 2 ), COLSSQ( 2 )
137 * ..
138 * .. External Functions ..
139  LOGICAL LSAME, DISNAN
140  EXTERNAL lsame, disnan
141 * ..
142 * .. External Subroutines ..
143  EXTERNAL dlassq, dcombssq
144 * ..
145 * .. Intrinsic Functions ..
146  INTRINSIC abs, min, sqrt
147 * ..
148 * .. Executable Statements ..
149 *
150  IF( n.EQ.0 ) THEN
151  VALUE = zero
152  ELSE IF( lsame( norm, 'M' ) ) THEN
153 *
154 * Find max(abs(A(i,j))).
155 *
156  VALUE = zero
157  DO 20 j = 1, n
158  DO 10 i = 1, min( n, j+1 )
159  sum = abs( a( i, j ) )
160  IF( VALUE .LT. sum .OR. disnan( sum ) ) VALUE = sum
161  10 CONTINUE
162  20 CONTINUE
163  ELSE IF( ( lsame( norm, 'O' ) ) .OR. ( norm.EQ.'1' ) ) THEN
164 *
165 * Find norm1(A).
166 *
167  VALUE = zero
168  DO 40 j = 1, n
169  sum = zero
170  DO 30 i = 1, min( n, j+1 )
171  sum = sum + abs( a( i, j ) )
172  30 CONTINUE
173  IF( VALUE .LT. sum .OR. disnan( sum ) ) VALUE = sum
174  40 CONTINUE
175  ELSE IF( lsame( norm, 'I' ) ) THEN
176 *
177 * Find normI(A).
178 *
179  DO 50 i = 1, n
180  work( i ) = zero
181  50 CONTINUE
182  DO 70 j = 1, n
183  DO 60 i = 1, min( n, j+1 )
184  work( i ) = work( i ) + abs( a( i, j ) )
185  60 CONTINUE
186  70 CONTINUE
187  VALUE = zero
188  DO 80 i = 1, n
189  sum = work( i )
190  IF( VALUE .LT. sum .OR. disnan( sum ) ) VALUE = sum
191  80 CONTINUE
192  ELSE IF( ( lsame( norm, 'F' ) ) .OR. ( lsame( norm, 'E' ) ) ) THEN
193 *
194 * Find normF(A).
195 * SSQ(1) is scale
196 * SSQ(2) is sum-of-squares
197 * For better accuracy, sum each column separately.
198 *
199  ssq( 1 ) = zero
200  ssq( 2 ) = one
201  DO 90 j = 1, n
202  colssq( 1 ) = zero
203  colssq( 2 ) = one
204  CALL dlassq( min( n, j+1 ), a( 1, j ), 1,
205  $ colssq( 1 ), colssq( 2 ) )
206  CALL dcombssq( ssq, colssq )
207  90 CONTINUE
208  VALUE = ssq( 1 )*sqrt( ssq( 2 ) )
209  END IF
210 *
211  dlanhs = VALUE
212  RETURN
213 *
214 * End of DLANHS
215 *
Here is the call graph for this function:
dlanhs
double precision function dlanhs(NORM, N, A, LDA, WORK)
DLANHS returns the value of the 1-norm, Frobenius norm, infinity-norm, or the largest absolute value ...
Definition: dlanhs.f:110
disnan
logical function disnan(DIN)
DISNAN tests input for NaN.
Definition: disnan.f:61
lsame
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55
dlassq
subroutine dlassq(N, X, INCX, SCALE, SUMSQ)
DLASSQ updates a sum of squares represented in scaled form.
Definition: dlassq.f:105
dcombssq
subroutine dcombssq(V1, V2)
DCOMBSSQ adds two scaled sum of squares quantities.
Definition: dcombssq.f:62