LAPACK  3.10.0
LAPACK: Linear Algebra PACKage
chbmv.f
Go to the documentation of this file.
1 *> \brief \b CHBMV
2 *
3 * =========== DOCUMENTATION ===========
4 *
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
7 *
8 * Definition:
9 * ===========
10 *
11 * SUBROUTINE CHBMV(UPLO,N,K,ALPHA,A,LDA,X,INCX,BETA,Y,INCY)
12 *
13 * .. Scalar Arguments ..
14 * COMPLEX ALPHA,BETA
15 * INTEGER INCX,INCY,K,LDA,N
16 * CHARACTER UPLO
17 * ..
18 * .. Array Arguments ..
19 * COMPLEX A(LDA,*),X(*),Y(*)
20 * ..
21 *
22 *
23 *> \par Purpose:
24 * =============
25 *>
26 *> \verbatim
27 *>
28 *> CHBMV performs the matrix-vector operation
29 *>
30 *> y := alpha*A*x + beta*y,
31 *>
32 *> where alpha and beta are scalars, x and y are n element vectors and
33 *> A is an n by n hermitian band matrix, with k super-diagonals.
34 *> \endverbatim
35 *
36 * Arguments:
37 * ==========
38 *
39 *> \param[in] UPLO
40 *> \verbatim
41 *> UPLO is CHARACTER*1
42 *> On entry, UPLO specifies whether the upper or lower
43 *> triangular part of the band matrix A is being supplied as
44 *> follows:
45 *>
46 *> UPLO = 'U' or 'u' The upper triangular part of A is
47 *> being supplied.
48 *>
49 *> UPLO = 'L' or 'l' The lower triangular part of A is
50 *> being supplied.
51 *> \endverbatim
52 *>
53 *> \param[in] N
54 *> \verbatim
55 *> N is INTEGER
56 *> On entry, N specifies the order of the matrix A.
57 *> N must be at least zero.
58 *> \endverbatim
59 *>
60 *> \param[in] K
61 *> \verbatim
62 *> K is INTEGER
63 *> On entry, K specifies the number of super-diagonals of the
64 *> matrix A. K must satisfy 0 .le. K.
65 *> \endverbatim
66 *>
67 *> \param[in] ALPHA
68 *> \verbatim
69 *> ALPHA is COMPLEX
70 *> On entry, ALPHA specifies the scalar alpha.
71 *> \endverbatim
72 *>
73 *> \param[in] A
74 *> \verbatim
75 *> A is COMPLEX array, dimension ( LDA, N )
76 *> Before entry with UPLO = 'U' or 'u', the leading ( k + 1 )
77 *> by n part of the array A must contain the upper triangular
78 *> band part of the hermitian matrix, supplied column by
79 *> column, with the leading diagonal of the matrix in row
80 *> ( k + 1 ) of the array, the first super-diagonal starting at
81 *> position 2 in row k, and so on. The top left k by k triangle
82 *> of the array A is not referenced.
83 *> The following program segment will transfer the upper
84 *> triangular part of a hermitian band matrix from conventional
85 *> full matrix storage to band storage:
86 *>
87 *> DO 20, J = 1, N
88 *> M = K + 1 - J
89 *> DO 10, I = MAX( 1, J - K ), J
90 *> A( M + I, J ) = matrix( I, J )
91 *> 10 CONTINUE
92 *> 20 CONTINUE
93 *>
94 *> Before entry with UPLO = 'L' or 'l', the leading ( k + 1 )
95 *> by n part of the array A must contain the lower triangular
96 *> band part of the hermitian matrix, supplied column by
97 *> column, with the leading diagonal of the matrix in row 1 of
98 *> the array, the first sub-diagonal starting at position 1 in
99 *> row 2, and so on. The bottom right k by k triangle of the
100 *> array A is not referenced.
101 *> The following program segment will transfer the lower
102 *> triangular part of a hermitian band matrix from conventional
103 *> full matrix storage to band storage:
104 *>
105 *> DO 20, J = 1, N
106 *> M = 1 - J
107 *> DO 10, I = J, MIN( N, J + K )
108 *> A( M + I, J ) = matrix( I, J )
109 *> 10 CONTINUE
110 *> 20 CONTINUE
111 *>
112 *> Note that the imaginary parts of the diagonal elements need
113 *> not be set and are assumed to be zero.
114 *> \endverbatim
115 *>
116 *> \param[in] LDA
117 *> \verbatim
118 *> LDA is INTEGER
119 *> On entry, LDA specifies the first dimension of A as declared
120 *> in the calling (sub) program. LDA must be at least
121 *> ( k + 1 ).
122 *> \endverbatim
123 *>
124 *> \param[in] X
125 *> \verbatim
126 *> X is COMPLEX array, dimension at least
127 *> ( 1 + ( n - 1 )*abs( INCX ) ).
128 *> Before entry, the incremented array X must contain the
129 *> vector x.
130 *> \endverbatim
131 *>
132 *> \param[in] INCX
133 *> \verbatim
134 *> INCX is INTEGER
135 *> On entry, INCX specifies the increment for the elements of
136 *> X. INCX must not be zero.
137 *> \endverbatim
138 *>
139 *> \param[in] BETA
140 *> \verbatim
141 *> BETA is COMPLEX
142 *> On entry, BETA specifies the scalar beta.
143 *> \endverbatim
144 *>
145 *> \param[in,out] Y
146 *> \verbatim
147 *> Y is COMPLEX array, dimension at least
148 *> ( 1 + ( n - 1 )*abs( INCY ) ).
149 *> Before entry, the incremented array Y must contain the
150 *> vector y. On exit, Y is overwritten by the updated vector y.
151 *> \endverbatim
152 *>
153 *> \param[in] INCY
154 *> \verbatim
155 *> INCY is INTEGER
156 *> On entry, INCY specifies the increment for the elements of
157 *> Y. INCY must not be zero.
158 *> \endverbatim
159 *
160 * Authors:
161 * ========
162 *
163 *> \author Univ. of Tennessee
164 *> \author Univ. of California Berkeley
165 *> \author Univ. of Colorado Denver
166 *> \author NAG Ltd.
167 *
168 *> \ingroup complex_blas_level2
169 *
170 *> \par Further Details:
171 * =====================
172 *>
173 *> \verbatim
174 *>
175 *> Level 2 Blas routine.
176 *> The vector and matrix arguments are not referenced when N = 0, or M = 0
177 *>
178 *> -- Written on 22-October-1986.
179 *> Jack Dongarra, Argonne National Lab.
180 *> Jeremy Du Croz, Nag Central Office.
181 *> Sven Hammarling, Nag Central Office.
182 *> Richard Hanson, Sandia National Labs.
183 *> \endverbatim
184 *>
185 * =====================================================================
186  SUBROUTINE chbmv(UPLO,N,K,ALPHA,A,LDA,X,INCX,BETA,Y,INCY)
187 *
188 * -- Reference BLAS level2 routine --
189 * -- Reference BLAS is a software package provided by Univ. of Tennessee, --
190 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
191 *
192 * .. Scalar Arguments ..
193  COMPLEX ALPHA,BETA
194  INTEGER INCX,INCY,K,LDA,N
195  CHARACTER UPLO
196 * ..
197 * .. Array Arguments ..
198  COMPLEX A(LDA,*),X(*),Y(*)
199 * ..
200 *
201 * =====================================================================
202 *
203 * .. Parameters ..
204  COMPLEX ONE
205  parameter(one= (1.0e+0,0.0e+0))
206  COMPLEX ZERO
207  parameter(zero= (0.0e+0,0.0e+0))
208 * ..
209 * .. Local Scalars ..
210  COMPLEX TEMP1,TEMP2
211  INTEGER I,INFO,IX,IY,J,JX,JY,KPLUS1,KX,KY,L
212 * ..
213 * .. External Functions ..
214  LOGICAL LSAME
215  EXTERNAL lsame
216 * ..
217 * .. External Subroutines ..
218  EXTERNAL xerbla
219 * ..
220 * .. Intrinsic Functions ..
221  INTRINSIC conjg,max,min,real
222 * ..
223 *
224 * Test the input parameters.
225 *
226  info = 0
227  IF (.NOT.lsame(uplo,'U') .AND. .NOT.lsame(uplo,'L')) THEN
228  info = 1
229  ELSE IF (n.LT.0) THEN
230  info = 2
231  ELSE IF (k.LT.0) THEN
232  info = 3
233  ELSE IF (lda.LT. (k+1)) THEN
234  info = 6
235  ELSE IF (incx.EQ.0) THEN
236  info = 8
237  ELSE IF (incy.EQ.0) THEN
238  info = 11
239  END IF
240  IF (info.NE.0) THEN
241  CALL xerbla('CHBMV ',info)
242  RETURN
243  END IF
244 *
245 * Quick return if possible.
246 *
247  IF ((n.EQ.0) .OR. ((alpha.EQ.zero).AND. (beta.EQ.one))) RETURN
248 *
249 * Set up the start points in X and Y.
250 *
251  IF (incx.GT.0) THEN
252  kx = 1
253  ELSE
254  kx = 1 - (n-1)*incx
255  END IF
256  IF (incy.GT.0) THEN
257  ky = 1
258  ELSE
259  ky = 1 - (n-1)*incy
260  END IF
261 *
262 * Start the operations. In this version the elements of the array A
263 * are accessed sequentially with one pass through A.
264 *
265 * First form y := beta*y.
266 *
267  IF (beta.NE.one) THEN
268  IF (incy.EQ.1) THEN
269  IF (beta.EQ.zero) THEN
270  DO 10 i = 1,n
271  y(i) = zero
272  10 CONTINUE
273  ELSE
274  DO 20 i = 1,n
275  y(i) = beta*y(i)
276  20 CONTINUE
277  END IF
278  ELSE
279  iy = ky
280  IF (beta.EQ.zero) THEN
281  DO 30 i = 1,n
282  y(iy) = zero
283  iy = iy + incy
284  30 CONTINUE
285  ELSE
286  DO 40 i = 1,n
287  y(iy) = beta*y(iy)
288  iy = iy + incy
289  40 CONTINUE
290  END IF
291  END IF
292  END IF
293  IF (alpha.EQ.zero) RETURN
294  IF (lsame(uplo,'U')) THEN
295 *
296 * Form y when upper triangle of A is stored.
297 *
298  kplus1 = k + 1
299  IF ((incx.EQ.1) .AND. (incy.EQ.1)) THEN
300  DO 60 j = 1,n
301  temp1 = alpha*x(j)
302  temp2 = zero
303  l = kplus1 - j
304  DO 50 i = max(1,j-k),j - 1
305  y(i) = y(i) + temp1*a(l+i,j)
306  temp2 = temp2 + conjg(a(l+i,j))*x(i)
307  50 CONTINUE
308  y(j) = y(j) + temp1*real(a(kplus1,j)) + alpha*temp2
309  60 CONTINUE
310  ELSE
311  jx = kx
312  jy = ky
313  DO 80 j = 1,n
314  temp1 = alpha*x(jx)
315  temp2 = zero
316  ix = kx
317  iy = ky
318  l = kplus1 - j
319  DO 70 i = max(1,j-k),j - 1
320  y(iy) = y(iy) + temp1*a(l+i,j)
321  temp2 = temp2 + conjg(a(l+i,j))*x(ix)
322  ix = ix + incx
323  iy = iy + incy
324  70 CONTINUE
325  y(jy) = y(jy) + temp1*real(a(kplus1,j)) + alpha*temp2
326  jx = jx + incx
327  jy = jy + incy
328  IF (j.GT.k) THEN
329  kx = kx + incx
330  ky = ky + incy
331  END IF
332  80 CONTINUE
333  END IF
334  ELSE
335 *
336 * Form y when lower triangle of A is stored.
337 *
338  IF ((incx.EQ.1) .AND. (incy.EQ.1)) THEN
339  DO 100 j = 1,n
340  temp1 = alpha*x(j)
341  temp2 = zero
342  y(j) = y(j) + temp1*real(a(1,j))
343  l = 1 - j
344  DO 90 i = j + 1,min(n,j+k)
345  y(i) = y(i) + temp1*a(l+i,j)
346  temp2 = temp2 + conjg(a(l+i,j))*x(i)
347  90 CONTINUE
348  y(j) = y(j) + alpha*temp2
349  100 CONTINUE
350  ELSE
351  jx = kx
352  jy = ky
353  DO 120 j = 1,n
354  temp1 = alpha*x(jx)
355  temp2 = zero
356  y(jy) = y(jy) + temp1*real(a(1,j))
357  l = 1 - j
358  ix = jx
359  iy = jy
360  DO 110 i = j + 1,min(n,j+k)
361  ix = ix + incx
362  iy = iy + incy
363  y(iy) = y(iy) + temp1*a(l+i,j)
364  temp2 = temp2 + conjg(a(l+i,j))*x(ix)
365  110 CONTINUE
366  y(jy) = y(jy) + alpha*temp2
367  jx = jx + incx
368  jy = jy + incy
369  120 CONTINUE
370  END IF
371  END IF
372 *
373  RETURN
374 *
375 * End of CHBMV
376 *
377  END
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:60
subroutine chbmv(UPLO, N, K, ALPHA, A, LDA, X, INCX, BETA, Y, INCY)
CHBMV
Definition: chbmv.f:187