LAPACK  3.9.0
LAPACK: Linear Algebra PACKage
dsbt21.f
Go to the documentation of this file.
1 *> \brief \b DSBT21
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 DSBT21( UPLO, N, KA, KS, A, LDA, D, E, U, LDU, WORK,
12 * RESULT )
13 *
14 * .. Scalar Arguments ..
15 * CHARACTER UPLO
16 * INTEGER KA, KS, LDA, LDU, N
17 * ..
18 * .. Array Arguments ..
19 * DOUBLE PRECISION A( LDA, * ), D( * ), E( * ), RESULT( 2 ),
20 * $ U( LDU, * ), WORK( * )
21 * ..
22 *
23 *
24 *> \par Purpose:
25 * =============
26 *>
27 *> \verbatim
28 *>
29 *> DSBT21 generally checks a decomposition of the form
30 *>
31 *> A = U S U**T
32 *>
33 *> where **T means transpose, A is symmetric banded, U is
34 *> orthogonal, and S is diagonal (if KS=0) or symmetric
35 *> tridiagonal (if KS=1).
36 *>
37 *> Specifically:
38 *>
39 *> RESULT(1) = | A - U S U**T | / ( |A| n ulp ) and
40 *> RESULT(2) = | I - U U**T | / ( n ulp )
41 *> \endverbatim
42 *
43 * Arguments:
44 * ==========
45 *
46 *> \param[in] UPLO
47 *> \verbatim
48 *> UPLO is CHARACTER
49 *> If UPLO='U', the upper triangle of A and V will be used and
50 *> the (strictly) lower triangle will not be referenced.
51 *> If UPLO='L', the lower triangle of A and V will be used and
52 *> the (strictly) upper triangle will not be referenced.
53 *> \endverbatim
54 *>
55 *> \param[in] N
56 *> \verbatim
57 *> N is INTEGER
58 *> The size of the matrix. If it is zero, DSBT21 does nothing.
59 *> It must be at least zero.
60 *> \endverbatim
61 *>
62 *> \param[in] KA
63 *> \verbatim
64 *> KA is INTEGER
65 *> The bandwidth of the matrix A. It must be at least zero. If
66 *> it is larger than N-1, then max( 0, N-1 ) will be used.
67 *> \endverbatim
68 *>
69 *> \param[in] KS
70 *> \verbatim
71 *> KS is INTEGER
72 *> The bandwidth of the matrix S. It may only be zero or one.
73 *> If zero, then S is diagonal, and E is not referenced. If
74 *> one, then S is symmetric tri-diagonal.
75 *> \endverbatim
76 *>
77 *> \param[in] A
78 *> \verbatim
79 *> A is DOUBLE PRECISION array, dimension (LDA, N)
80 *> The original (unfactored) matrix. It is assumed to be
81 *> symmetric, and only the upper (UPLO='U') or only the lower
82 *> (UPLO='L') will be referenced.
83 *> \endverbatim
84 *>
85 *> \param[in] LDA
86 *> \verbatim
87 *> LDA is INTEGER
88 *> The leading dimension of A. It must be at least 1
89 *> and at least min( KA, N-1 ).
90 *> \endverbatim
91 *>
92 *> \param[in] D
93 *> \verbatim
94 *> D is DOUBLE PRECISION array, dimension (N)
95 *> The diagonal of the (symmetric tri-) diagonal matrix S.
96 *> \endverbatim
97 *>
98 *> \param[in] E
99 *> \verbatim
100 *> E is DOUBLE PRECISION array, dimension (N-1)
101 *> The off-diagonal of the (symmetric tri-) diagonal matrix S.
102 *> E(1) is the (1,2) and (2,1) element, E(2) is the (2,3) and
103 *> (3,2) element, etc.
104 *> Not referenced if KS=0.
105 *> \endverbatim
106 *>
107 *> \param[in] U
108 *> \verbatim
109 *> U is DOUBLE PRECISION array, dimension (LDU, N)
110 *> The orthogonal matrix in the decomposition, expressed as a
111 *> dense matrix (i.e., not as a product of Householder
112 *> transformations, Givens transformations, etc.)
113 *> \endverbatim
114 *>
115 *> \param[in] LDU
116 *> \verbatim
117 *> LDU is INTEGER
118 *> The leading dimension of U. LDU must be at least N and
119 *> at least 1.
120 *> \endverbatim
121 *>
122 *> \param[out] WORK
123 *> \verbatim
124 *> WORK is DOUBLE PRECISION array, dimension (N**2+N)
125 *> \endverbatim
126 *>
127 *> \param[out] RESULT
128 *> \verbatim
129 *> RESULT is DOUBLE PRECISION array, dimension (2)
130 *> The values computed by the two tests described above. The
131 *> values are currently limited to 1/ulp, to avoid overflow.
132 *> \endverbatim
133 *
134 * Authors:
135 * ========
136 *
137 *> \author Univ. of Tennessee
138 *> \author Univ. of California Berkeley
139 *> \author Univ. of Colorado Denver
140 *> \author NAG Ltd.
141 *
142 *> \date December 2016
143 *
144 *> \ingroup double_eig
145 *
146 * =====================================================================
147  SUBROUTINE dsbt21( UPLO, N, KA, KS, A, LDA, D, E, U, LDU, WORK,
148  $ RESULT )
149 *
150 * -- LAPACK test routine (version 3.7.0) --
151 * -- LAPACK is a software package provided by Univ. of Tennessee, --
152 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
153 * December 2016
154 *
155 * .. Scalar Arguments ..
156  CHARACTER UPLO
157  INTEGER KA, KS, LDA, LDU, N
158 * ..
159 * .. Array Arguments ..
160  DOUBLE PRECISION A( LDA, * ), D( * ), E( * ), RESULT( 2 ),
161  $ u( ldu, * ), work( * )
162 * ..
163 *
164 * =====================================================================
165 *
166 * .. Parameters ..
167  DOUBLE PRECISION ZERO, ONE
168  parameter( zero = 0.0d0, one = 1.0d0 )
169 * ..
170 * .. Local Scalars ..
171  LOGICAL LOWER
172  CHARACTER CUPLO
173  INTEGER IKA, J, JC, JR, LW
174  DOUBLE PRECISION ANORM, ULP, UNFL, WNORM
175 * ..
176 * .. External Functions ..
177  LOGICAL LSAME
178  DOUBLE PRECISION DLAMCH, DLANGE, DLANSB, DLANSP
179  EXTERNAL lsame, dlamch, dlange, dlansb, dlansp
180 * ..
181 * .. External Subroutines ..
182  EXTERNAL dgemm, dspr, dspr2
183 * ..
184 * .. Intrinsic Functions ..
185  INTRINSIC dble, max, min
186 * ..
187 * .. Executable Statements ..
188 *
189 * Constants
190 *
191  result( 1 ) = zero
192  result( 2 ) = zero
193  IF( n.LE.0 )
194  $ RETURN
195 *
196  ika = max( 0, min( n-1, ka ) )
197  lw = ( n*( n+1 ) ) / 2
198 *
199  IF( lsame( uplo, 'U' ) ) THEN
200  lower = .false.
201  cuplo = 'U'
202  ELSE
203  lower = .true.
204  cuplo = 'L'
205  END IF
206 *
207  unfl = dlamch( 'Safe minimum' )
208  ulp = dlamch( 'Epsilon' )*dlamch( 'Base' )
209 *
210 * Some Error Checks
211 *
212 * Do Test 1
213 *
214 * Norm of A:
215 *
216  anorm = max( dlansb( '1', cuplo, n, ika, a, lda, work ), unfl )
217 *
218 * Compute error matrix: Error = A - U S U**T
219 *
220 * Copy A from SB to SP storage format.
221 *
222  j = 0
223  DO 50 jc = 1, n
224  IF( lower ) THEN
225  DO 10 jr = 1, min( ika+1, n+1-jc )
226  j = j + 1
227  work( j ) = a( jr, jc )
228  10 CONTINUE
229  DO 20 jr = ika + 2, n + 1 - jc
230  j = j + 1
231  work( j ) = zero
232  20 CONTINUE
233  ELSE
234  DO 30 jr = ika + 2, jc
235  j = j + 1
236  work( j ) = zero
237  30 CONTINUE
238  DO 40 jr = min( ika, jc-1 ), 0, -1
239  j = j + 1
240  work( j ) = a( ika+1-jr, jc )
241  40 CONTINUE
242  END IF
243  50 CONTINUE
244 *
245  DO 60 j = 1, n
246  CALL dspr( cuplo, n, -d( j ), u( 1, j ), 1, work )
247  60 CONTINUE
248 *
249  IF( n.GT.1 .AND. ks.EQ.1 ) THEN
250  DO 70 j = 1, n - 1
251  CALL dspr2( cuplo, n, -e( j ), u( 1, j ), 1, u( 1, j+1 ), 1,
252  $ work )
253  70 CONTINUE
254  END IF
255  wnorm = dlansp( '1', cuplo, n, work, work( lw+1 ) )
256 *
257  IF( anorm.GT.wnorm ) THEN
258  result( 1 ) = ( wnorm / anorm ) / ( n*ulp )
259  ELSE
260  IF( anorm.LT.one ) THEN
261  result( 1 ) = ( min( wnorm, n*anorm ) / anorm ) / ( n*ulp )
262  ELSE
263  result( 1 ) = min( wnorm / anorm, dble( n ) ) / ( n*ulp )
264  END IF
265  END IF
266 *
267 * Do Test 2
268 *
269 * Compute U U**T - I
270 *
271  CALL dgemm( 'N', 'C', n, n, n, one, u, ldu, u, ldu, zero, work,
272  $ n )
273 *
274  DO 80 j = 1, n
275  work( ( n+1 )*( j-1 )+1 ) = work( ( n+1 )*( j-1 )+1 ) - one
276  80 CONTINUE
277 *
278  result( 2 ) = min( dlange( '1', n, n, work, n, work( n**2+1 ) ),
279  $ dble( n ) ) / ( n*ulp )
280 *
281  RETURN
282 *
283 * End of DSBT21
284 *
285  END
dspr
subroutine dspr(UPLO, N, ALPHA, X, INCX, AP)
DSPR
Definition: dspr.f:129
dgemm
subroutine dgemm(TRANSA, TRANSB, M, N, K, ALPHA, A, LDA, B, LDB, BETA, C, LDC)
DGEMM
Definition: dgemm.f:189
dsbt21
subroutine dsbt21(UPLO, N, KA, KS, A, LDA, D, E, U, LDU, WORK, RESULT)
DSBT21
Definition: dsbt21.f:149
dspr2
subroutine dspr2(UPLO, N, ALPHA, X, INCX, Y, INCY, AP)
DSPR2
Definition: dspr2.f:144