LAPACK  3.10.0
LAPACK: Linear Algebra PACKage
zlansb.f
Go to the documentation of this file.
1 *> \brief \b ZLANSB returns the value of the 1-norm, or the Frobenius norm, or the infinity norm, or the element of largest absolute value of a symmetric band matrix.
2 *
3 * =========== DOCUMENTATION ===========
4 *
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
7 *
8 *> \htmlonly
9 *> Download ZLANSB + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zlansb.f">
11 *> [TGZ]</a>
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zlansb.f">
13 *> [ZIP]</a>
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zlansb.f">
15 *> [TXT]</a>
16 *> \endhtmlonly
17 *
18 * Definition:
19 * ===========
20 *
21 * DOUBLE PRECISION FUNCTION ZLANSB( NORM, UPLO, N, K, AB, LDAB,
22 * WORK )
23 *
24 * .. Scalar Arguments ..
25 * CHARACTER NORM, UPLO
26 * INTEGER K, LDAB, N
27 * ..
28 * .. Array Arguments ..
29 * DOUBLE PRECISION WORK( * )
30 * COMPLEX*16 AB( LDAB, * )
31 * ..
32 *
33 *
34 *> \par Purpose:
35 * =============
36 *>
37 *> \verbatim
38 *>
39 *> ZLANSB returns the value of the one norm, or the Frobenius norm, or
40 *> the infinity norm, or the element of largest absolute value of an
41 *> n by n symmetric band matrix A, with k super-diagonals.
42 *> \endverbatim
43 *>
44 *> \return ZLANSB
45 *> \verbatim
46 *>
47 *> ZLANSB = ( max(abs(A(i,j))), NORM = 'M' or 'm'
48 *> (
49 *> ( norm1(A), NORM = '1', 'O' or 'o'
50 *> (
51 *> ( normI(A), NORM = 'I' or 'i'
52 *> (
53 *> ( normF(A), NORM = 'F', 'f', 'E' or 'e'
54 *>
55 *> where norm1 denotes the one norm of a matrix (maximum column sum),
56 *> normI denotes the infinity norm of a matrix (maximum row sum) and
57 *> normF denotes the Frobenius norm of a matrix (square root of sum of
58 *> squares). Note that max(abs(A(i,j))) is not a consistent matrix norm.
59 *> \endverbatim
60 *
61 * Arguments:
62 * ==========
63 *
64 *> \param[in] NORM
65 *> \verbatim
66 *> NORM is CHARACTER*1
67 *> Specifies the value to be returned in ZLANSB as described
68 *> above.
69 *> \endverbatim
70 *>
71 *> \param[in] UPLO
72 *> \verbatim
73 *> UPLO is CHARACTER*1
74 *> Specifies whether the upper or lower triangular part of the
75 *> band matrix A is supplied.
76 *> = 'U': Upper triangular part is supplied
77 *> = 'L': Lower triangular part is supplied
78 *> \endverbatim
79 *>
80 *> \param[in] N
81 *> \verbatim
82 *> N is INTEGER
83 *> The order of the matrix A. N >= 0. When N = 0, ZLANSB is
84 *> set to zero.
85 *> \endverbatim
86 *>
87 *> \param[in] K
88 *> \verbatim
89 *> K is INTEGER
90 *> The number of super-diagonals or sub-diagonals of the
91 *> band matrix A. K >= 0.
92 *> \endverbatim
93 *>
94 *> \param[in] AB
95 *> \verbatim
96 *> AB is COMPLEX*16 array, dimension (LDAB,N)
97 *> The upper or lower triangle of the symmetric band matrix A,
98 *> stored in the first K+1 rows of AB. The j-th column of A is
99 *> stored in the j-th column of the array AB as follows:
100 *> if UPLO = 'U', AB(k+1+i-j,j) = A(i,j) for max(1,j-k)<=i<=j;
101 *> if UPLO = 'L', AB(1+i-j,j) = A(i,j) for j<=i<=min(n,j+k).
102 *> \endverbatim
103 *>
104 *> \param[in] LDAB
105 *> \verbatim
106 *> LDAB is INTEGER
107 *> The leading dimension of the array AB. LDAB >= K+1.
108 *> \endverbatim
109 *>
110 *> \param[out] WORK
111 *> \verbatim
112 *> WORK is DOUBLE PRECISION array, dimension (MAX(1,LWORK)),
113 *> where LWORK >= N when NORM = 'I' or '1' or 'O'; otherwise,
114 *> WORK is not referenced.
115 *> \endverbatim
116 *
117 * Authors:
118 * ========
119 *
120 *> \author Univ. of Tennessee
121 *> \author Univ. of California Berkeley
122 *> \author Univ. of Colorado Denver
123 *> \author NAG Ltd.
124 *
125 *> \ingroup complex16OTHERauxiliary
126 *
127 * =====================================================================
128  DOUBLE PRECISION FUNCTION zlansb( NORM, UPLO, N, K, AB, LDAB,
129  $ WORK )
130 *
131 * -- LAPACK auxiliary routine --
132 * -- LAPACK is a software package provided by Univ. of Tennessee, --
133 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
134 *
135  IMPLICIT NONE
136 * .. Scalar Arguments ..
137  CHARACTER norm, uplo
138  INTEGER k, ldab, n
139 * ..
140 * .. Array Arguments ..
141  DOUBLE PRECISION work( * )
142  COMPLEX*16 ab( ldab, * )
143 * ..
144 *
145 * =====================================================================
146 *
147 * .. Parameters ..
148  DOUBLE PRECISION one, zero
149  parameter( one = 1.0d+0, zero = 0.0d+0 )
150 * ..
151 * .. Local Scalars ..
152  INTEGER i, j, l
153  DOUBLE PRECISION absa, sum, value
154 * ..
155 * .. Local Arrays ..
156  DOUBLE PRECISION ssq( 2 ), colssq( 2 )
157 * ..
158 * .. External Functions ..
159  LOGICAL lsame, disnan
160  EXTERNAL lsame, disnan
161 * ..
162 * .. External Subroutines ..
163  EXTERNAL zlassq, dcombssq
164 * ..
165 * .. Intrinsic Functions ..
166  INTRINSIC abs, max, min, sqrt
167 * ..
168 * .. Executable Statements ..
169 *
170  IF( n.EQ.0 ) THEN
171  VALUE = zero
172  ELSE IF( lsame( norm, 'M' ) ) THEN
173 *
174 * Find max(abs(A(i,j))).
175 *
176  VALUE = zero
177  IF( lsame( uplo, 'U' ) ) THEN
178  DO 20 j = 1, n
179  DO 10 i = max( k+2-j, 1 ), k + 1
180  sum = abs( ab( i, j ) )
181  IF( VALUE .LT. sum .OR. disnan( sum ) ) VALUE = sum
182  10 CONTINUE
183  20 CONTINUE
184  ELSE
185  DO 40 j = 1, n
186  DO 30 i = 1, min( n+1-j, k+1 )
187  sum = abs( ab( i, j ) )
188  IF( VALUE .LT. sum .OR. disnan( sum ) ) VALUE = sum
189  30 CONTINUE
190  40 CONTINUE
191  END IF
192  ELSE IF( ( lsame( norm, 'I' ) ) .OR. ( lsame( norm, 'O' ) ) .OR.
193  $ ( norm.EQ.'1' ) ) THEN
194 *
195 * Find normI(A) ( = norm1(A), since A is symmetric).
196 *
197  VALUE = zero
198  IF( lsame( uplo, 'U' ) ) THEN
199  DO 60 j = 1, n
200  sum = zero
201  l = k + 1 - j
202  DO 50 i = max( 1, j-k ), j - 1
203  absa = abs( ab( l+i, j ) )
204  sum = sum + absa
205  work( i ) = work( i ) + absa
206  50 CONTINUE
207  work( j ) = sum + abs( ab( k+1, j ) )
208  60 CONTINUE
209  DO 70 i = 1, n
210  sum = work( i )
211  IF( VALUE .LT. sum .OR. disnan( sum ) ) VALUE = sum
212  70 CONTINUE
213  ELSE
214  DO 80 i = 1, n
215  work( i ) = zero
216  80 CONTINUE
217  DO 100 j = 1, n
218  sum = work( j ) + abs( ab( 1, j ) )
219  l = 1 - j
220  DO 90 i = j + 1, min( n, j+k )
221  absa = abs( ab( l+i, j ) )
222  sum = sum + absa
223  work( i ) = work( i ) + absa
224  90 CONTINUE
225  IF( VALUE .LT. sum .OR. disnan( sum ) ) VALUE = sum
226  100 CONTINUE
227  END IF
228  ELSE IF( ( lsame( norm, 'F' ) ) .OR. ( lsame( norm, 'E' ) ) ) THEN
229 *
230 * Find normF(A).
231 * SSQ(1) is scale
232 * SSQ(2) is sum-of-squares
233 * For better accuracy, sum each column separately.
234 *
235  ssq( 1 ) = zero
236  ssq( 2 ) = one
237 *
238 * Sum off-diagonals
239 *
240  IF( k.GT.0 ) THEN
241  IF( lsame( uplo, 'U' ) ) THEN
242  DO 110 j = 2, n
243  colssq( 1 ) = zero
244  colssq( 2 ) = one
245  CALL zlassq( min( j-1, k ), ab( max( k+2-j, 1 ), j ),
246  $ 1, colssq( 1 ), colssq( 2 ) )
247  CALL dcombssq( ssq, colssq )
248  110 CONTINUE
249  l = k + 1
250  ELSE
251  DO 120 j = 1, n - 1
252  colssq( 1 ) = zero
253  colssq( 2 ) = one
254  CALL zlassq( min( n-j, k ), ab( 2, j ), 1,
255  $ colssq( 1 ), colssq( 2 ) )
256  CALL dcombssq( ssq, colssq )
257  120 CONTINUE
258  l = 1
259  END IF
260  ssq( 2 ) = 2*ssq( 2 )
261  ELSE
262  l = 1
263  END IF
264 *
265 * Sum diagonal
266 *
267  colssq( 1 ) = zero
268  colssq( 2 ) = one
269  CALL zlassq( n, ab( l, 1 ), ldab, colssq( 1 ), colssq( 2 ) )
270  CALL dcombssq( ssq, colssq )
271  VALUE = ssq( 1 )*sqrt( ssq( 2 ) )
272  END IF
273 *
274  zlansb = VALUE
275  RETURN
276 *
277 * End of ZLANSB
278 *
279  END
logical function disnan(DIN)
DISNAN tests input for NaN.
Definition: disnan.f:59
subroutine dcombssq(V1, V2)
DCOMBSSQ adds two scaled sum of squares quantities.
Definition: dcombssq.f:60
subroutine zlassq(n, x, incx, scl, sumsq)
ZLASSQ updates a sum of squares represented in scaled form.
Definition: zlassq.f90:126
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:53
double precision function zlansb(NORM, UPLO, N, K, AB, LDAB, WORK)
ZLANSB returns the value of the 1-norm, or the Frobenius norm, or the infinity norm,...
Definition: zlansb.f:130