LAPACK  3.10.0
LAPACK: Linear Algebra PACKage

◆ clanhb()

real function clanhb ( character  NORM,
character  UPLO,
integer  N,
integer  K,
complex, dimension( ldab, * )  AB,
integer  LDAB,
real, dimension( * )  WORK 
)

CLANHB returns the value of the 1-norm, or the Frobenius norm, or the infinity norm, or the element of largest absolute value of a Hermitian band matrix.

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

Purpose:
 CLANHB  returns the value of the one norm,  or the Frobenius norm, or
 the  infinity norm,  or the element of  largest absolute value  of an
 n by n hermitian band matrix A,  with k super-diagonals.
Returns
CLANHB
    CLANHB = ( 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 CLANHB as described
          above.
[in]UPLO
          UPLO is CHARACTER*1
          Specifies whether the upper or lower triangular part of the
          band matrix A is supplied.
          = 'U':  Upper triangular
          = 'L':  Lower triangular
[in]N
          N is INTEGER
          The order of the matrix A.  N >= 0.  When N = 0, CLANHB is
          set to zero.
[in]K
          K is INTEGER
          The number of super-diagonals or sub-diagonals of the
          band matrix A.  K >= 0.
[in]AB
          AB is COMPLEX array, dimension (LDAB,N)
          The upper or lower triangle of the hermitian band matrix A,
          stored in the first K+1 rows of AB.  The j-th column of A is
          stored in the j-th column of the array AB as follows:
          if UPLO = 'U', AB(k+1+i-j,j) = A(i,j) for max(1,j-k)<=i<=j;
          if UPLO = 'L', AB(1+i-j,j)   = A(i,j) for j<=i<=min(n,j+k).
          Note that the imaginary parts of the diagonal elements need
          not be set and are assumed to be zero.
[in]LDAB
          LDAB is INTEGER
          The leading dimension of the array AB.  LDAB >= K+1.
[out]WORK
          WORK is REAL array, dimension (MAX(1,LWORK)),
          where LWORK >= N when NORM = 'I' or '1' or 'O'; otherwise,
          WORK is not referenced.
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.

Definition at line 130 of file clanhb.f.

132 *
133 * -- LAPACK auxiliary routine --
134 * -- LAPACK is a software package provided by Univ. of Tennessee, --
135 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
136 *
137  IMPLICIT NONE
138 * .. Scalar Arguments ..
139  CHARACTER NORM, UPLO
140  INTEGER K, LDAB, N
141 * ..
142 * .. Array Arguments ..
143  REAL WORK( * )
144  COMPLEX AB( LDAB, * )
145 * ..
146 *
147 * =====================================================================
148 *
149 * .. Parameters ..
150  REAL ONE, ZERO
151  parameter( one = 1.0e+0, zero = 0.0e+0 )
152 * ..
153 * .. Local Scalars ..
154  INTEGER I, J, L
155  REAL ABSA, SUM, VALUE
156 * ..
157 * .. Local Arrays ..
158  REAL SSQ( 2 ), COLSSQ( 2 )
159 * ..
160 * .. External Functions ..
161  LOGICAL LSAME, SISNAN
162  EXTERNAL lsame, sisnan
163 * ..
164 * .. External Subroutines ..
165  EXTERNAL classq, scombssq
166 * ..
167 * .. Intrinsic Functions ..
168  INTRINSIC abs, max, min, real, sqrt
169 * ..
170 * .. Executable Statements ..
171 *
172  IF( n.EQ.0 ) THEN
173  VALUE = zero
174  ELSE IF( lsame( norm, 'M' ) ) THEN
175 *
176 * Find max(abs(A(i,j))).
177 *
178  VALUE = zero
179  IF( lsame( uplo, 'U' ) ) THEN
180  DO 20 j = 1, n
181  DO 10 i = max( k+2-j, 1 ), k
182  sum = abs( ab( i, j ) )
183  IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
184  10 CONTINUE
185  sum = abs( real( ab( k+1, j ) ) )
186  IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
187  20 CONTINUE
188  ELSE
189  DO 40 j = 1, n
190  sum = abs( real( ab( 1, j ) ) )
191  IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
192  DO 30 i = 2, min( n+1-j, k+1 )
193  sum = abs( ab( i, j ) )
194  IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
195  30 CONTINUE
196  40 CONTINUE
197  END IF
198  ELSE IF( ( lsame( norm, 'I' ) ) .OR. ( lsame( norm, 'O' ) ) .OR.
199  $ ( norm.EQ.'1' ) ) THEN
200 *
201 * Find normI(A) ( = norm1(A), since A is hermitian).
202 *
203  VALUE = zero
204  IF( lsame( uplo, 'U' ) ) THEN
205  DO 60 j = 1, n
206  sum = zero
207  l = k + 1 - j
208  DO 50 i = max( 1, j-k ), j - 1
209  absa = abs( ab( l+i, j ) )
210  sum = sum + absa
211  work( i ) = work( i ) + absa
212  50 CONTINUE
213  work( j ) = sum + abs( real( ab( k+1, j ) ) )
214  60 CONTINUE
215  DO 70 i = 1, n
216  sum = work( i )
217  IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
218  70 CONTINUE
219  ELSE
220  DO 80 i = 1, n
221  work( i ) = zero
222  80 CONTINUE
223  DO 100 j = 1, n
224  sum = work( j ) + abs( real( ab( 1, j ) ) )
225  l = 1 - j
226  DO 90 i = j + 1, min( n, j+k )
227  absa = abs( ab( l+i, j ) )
228  sum = sum + absa
229  work( i ) = work( i ) + absa
230  90 CONTINUE
231  IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
232  100 CONTINUE
233  END IF
234  ELSE IF( ( lsame( norm, 'F' ) ) .OR. ( lsame( norm, 'E' ) ) ) THEN
235 *
236 * Find normF(A).
237 * SSQ(1) is scale
238 * SSQ(2) is sum-of-squares
239 * For better accuracy, sum each column separately.
240 *
241  ssq( 1 ) = zero
242  ssq( 2 ) = one
243 *
244 * Sum off-diagonals
245 *
246  IF( k.GT.0 ) THEN
247  IF( lsame( uplo, 'U' ) ) THEN
248  DO 110 j = 2, n
249  colssq( 1 ) = zero
250  colssq( 2 ) = one
251  CALL classq( min( j-1, k ), ab( max( k+2-j, 1 ), j ),
252  $ 1, colssq( 1 ), colssq( 2 ) )
253  CALL scombssq( ssq, colssq )
254  110 CONTINUE
255  l = k + 1
256  ELSE
257  DO 120 j = 1, n - 1
258  colssq( 1 ) = zero
259  colssq( 2 ) = one
260  CALL classq( min( n-j, k ), ab( 2, j ), 1,
261  $ colssq( 1 ), colssq( 2 ) )
262  CALL scombssq( ssq, colssq )
263  120 CONTINUE
264  l = 1
265  END IF
266  ssq( 2 ) = 2*ssq( 2 )
267  ELSE
268  l = 1
269  END IF
270 *
271 * Sum diagonal
272 *
273  colssq( 1 ) = zero
274  colssq( 2 ) = one
275  DO 130 j = 1, n
276  IF( real( ab( l, j ) ).NE.zero ) THEN
277  absa = abs( real( ab( l, j ) ) )
278  IF( colssq( 1 ).LT.absa ) THEN
279  colssq( 2 ) = one + colssq(2)*( colssq(1) / absa )**2
280  colssq( 1 ) = absa
281  ELSE
282  colssq( 2 ) = colssq( 2 ) + ( absa / colssq( 1 ) )**2
283  END IF
284  END IF
285  130 CONTINUE
286  CALL scombssq( ssq, colssq )
287  VALUE = ssq( 1 )*sqrt( ssq( 2 ) )
288  END IF
289 *
290  clanhb = VALUE
291  RETURN
292 *
293 * End of CLANHB
294 *
subroutine scombssq(V1, V2)
SCOMBSSQ adds two scaled sum of squares quantities
Definition: scombssq.f:60
subroutine classq(n, x, incx, scl, sumsq)
CLASSQ updates a sum of squares represented in scaled form.
Definition: classq.f90:126
logical function sisnan(SIN)
SISNAN tests input for NaN.
Definition: sisnan.f:59
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:53
real function clanhb(NORM, UPLO, N, K, AB, LDAB, WORK)
CLANHB returns the value of the 1-norm, or the Frobenius norm, or the infinity norm,...
Definition: clanhb.f:132
Here is the call graph for this function: