LAPACK 3.12.0
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ dbdt01()

subroutine dbdt01 ( integer  m,
integer  n,
integer  kd,
double precision, dimension( lda, * )  a,
integer  lda,
double precision, dimension( ldq, * )  q,
integer  ldq,
double precision, dimension( * )  d,
double precision, dimension( * )  e,
double precision, dimension( ldpt, * )  pt,
integer  ldpt,
double precision, dimension( * )  work,
double precision  resid 
)

DBDT01

Purpose:
 DBDT01 reconstructs a general matrix A from its bidiagonal form
    A = Q * B * P**T
 where Q (m by min(m,n)) and P**T (min(m,n) by n) are orthogonal
 matrices and B is bidiagonal.

 The test ratio to test the reduction is
    RESID = norm(A - Q * B * P**T) / ( n * norm(A) * EPS )
 where EPS is the machine precision.
Parameters
[in]M
          M is INTEGER
          The number of rows of the matrices A and Q.
[in]N
          N is INTEGER
          The number of columns of the matrices A and P**T.
[in]KD
          KD is INTEGER
          If KD = 0, B is diagonal and the array E is not referenced.
          If KD = 1, the reduction was performed by xGEBRD; B is upper
          bidiagonal if M >= N, and lower bidiagonal if M < N.
          If KD = -1, the reduction was performed by xGBBRD; B is
          always upper bidiagonal.
[in]A
          A is DOUBLE PRECISION array, dimension (LDA,N)
          The m by n matrix A.
[in]LDA
          LDA is INTEGER
          The leading dimension of the array A.  LDA >= max(1,M).
[in]Q
          Q is DOUBLE PRECISION array, dimension (LDQ,N)
          The m by min(m,n) orthogonal matrix Q in the reduction
          A = Q * B * P**T.
[in]LDQ
          LDQ is INTEGER
          The leading dimension of the array Q.  LDQ >= max(1,M).
[in]D
          D is DOUBLE PRECISION array, dimension (min(M,N))
          The diagonal elements of the bidiagonal matrix B.
[in]E
          E is DOUBLE PRECISION array, dimension (min(M,N)-1)
          The superdiagonal elements of the bidiagonal matrix B if
          m >= n, or the subdiagonal elements of B if m < n.
[in]PT
          PT is DOUBLE PRECISION array, dimension (LDPT,N)
          The min(m,n) by n orthogonal matrix P**T in the reduction
          A = Q * B * P**T.
[in]LDPT
          LDPT is INTEGER
          The leading dimension of the array PT.
          LDPT >= max(1,min(M,N)).
[out]WORK
          WORK is DOUBLE PRECISION array, dimension (M+N)
[out]RESID
          RESID is DOUBLE PRECISION
          The test ratio:
          norm(A - Q * B * P**T) / ( n * norm(A) * EPS )
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.

Definition at line 139 of file dbdt01.f.

141*
142* -- LAPACK test routine --
143* -- LAPACK is a software package provided by Univ. of Tennessee, --
144* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
145*
146* .. Scalar Arguments ..
147 INTEGER KD, LDA, LDPT, LDQ, M, N
148 DOUBLE PRECISION RESID
149* ..
150* .. Array Arguments ..
151 DOUBLE PRECISION A( LDA, * ), D( * ), E( * ), PT( LDPT, * ),
152 $ Q( LDQ, * ), WORK( * )
153* ..
154*
155* =====================================================================
156*
157* .. Parameters ..
158 DOUBLE PRECISION ZERO, ONE
159 parameter( zero = 0.0d+0, one = 1.0d+0 )
160* ..
161* .. Local Scalars ..
162 INTEGER I, J
163 DOUBLE PRECISION ANORM, EPS
164* ..
165* .. External Functions ..
166 DOUBLE PRECISION DASUM, DLAMCH, DLANGE
167 EXTERNAL dasum, dlamch, dlange
168* ..
169* .. External Subroutines ..
170 EXTERNAL dcopy, dgemv
171* ..
172* .. Intrinsic Functions ..
173 INTRINSIC dble, max, min
174* ..
175* .. Executable Statements ..
176*
177* Quick return if possible
178*
179 IF( m.LE.0 .OR. n.LE.0 ) THEN
180 resid = zero
181 RETURN
182 END IF
183*
184* Compute A - Q * B * P**T one column at a time.
185*
186 resid = zero
187 IF( kd.NE.0 ) THEN
188*
189* B is bidiagonal.
190*
191 IF( kd.NE.0 .AND. m.GE.n ) THEN
192*
193* B is upper bidiagonal and M >= N.
194*
195 DO 20 j = 1, n
196 CALL dcopy( m, a( 1, j ), 1, work, 1 )
197 DO 10 i = 1, n - 1
198 work( m+i ) = d( i )*pt( i, j ) + e( i )*pt( i+1, j )
199 10 CONTINUE
200 work( m+n ) = d( n )*pt( n, j )
201 CALL dgemv( 'No transpose', m, n, -one, q, ldq,
202 $ work( m+1 ), 1, one, work, 1 )
203 resid = max( resid, dasum( m, work, 1 ) )
204 20 CONTINUE
205 ELSE IF( kd.LT.0 ) THEN
206*
207* B is upper bidiagonal and M < N.
208*
209 DO 40 j = 1, n
210 CALL dcopy( m, a( 1, j ), 1, work, 1 )
211 DO 30 i = 1, m - 1
212 work( m+i ) = d( i )*pt( i, j ) + e( i )*pt( i+1, j )
213 30 CONTINUE
214 work( m+m ) = d( m )*pt( m, j )
215 CALL dgemv( 'No transpose', m, m, -one, q, ldq,
216 $ work( m+1 ), 1, one, work, 1 )
217 resid = max( resid, dasum( m, work, 1 ) )
218 40 CONTINUE
219 ELSE
220*
221* B is lower bidiagonal.
222*
223 DO 60 j = 1, n
224 CALL dcopy( m, a( 1, j ), 1, work, 1 )
225 work( m+1 ) = d( 1 )*pt( 1, j )
226 DO 50 i = 2, m
227 work( m+i ) = e( i-1 )*pt( i-1, j ) +
228 $ d( i )*pt( i, j )
229 50 CONTINUE
230 CALL dgemv( 'No transpose', m, m, -one, q, ldq,
231 $ work( m+1 ), 1, one, work, 1 )
232 resid = max( resid, dasum( m, work, 1 ) )
233 60 CONTINUE
234 END IF
235 ELSE
236*
237* B is diagonal.
238*
239 IF( m.GE.n ) THEN
240 DO 80 j = 1, n
241 CALL dcopy( m, a( 1, j ), 1, work, 1 )
242 DO 70 i = 1, n
243 work( m+i ) = d( i )*pt( i, j )
244 70 CONTINUE
245 CALL dgemv( 'No transpose', m, n, -one, q, ldq,
246 $ work( m+1 ), 1, one, work, 1 )
247 resid = max( resid, dasum( m, work, 1 ) )
248 80 CONTINUE
249 ELSE
250 DO 100 j = 1, n
251 CALL dcopy( m, a( 1, j ), 1, work, 1 )
252 DO 90 i = 1, m
253 work( m+i ) = d( i )*pt( i, j )
254 90 CONTINUE
255 CALL dgemv( 'No transpose', m, m, -one, q, ldq,
256 $ work( m+1 ), 1, one, work, 1 )
257 resid = max( resid, dasum( m, work, 1 ) )
258 100 CONTINUE
259 END IF
260 END IF
261*
262* Compute norm(A - Q * B * P**T) / ( n * norm(A) * EPS )
263*
264 anorm = dlange( '1', m, n, a, lda, work )
265 eps = dlamch( 'Precision' )
266*
267 IF( anorm.LE.zero ) THEN
268 IF( resid.NE.zero )
269 $ resid = one / eps
270 ELSE
271 IF( anorm.GE.resid ) THEN
272 resid = ( resid / anorm ) / ( dble( n )*eps )
273 ELSE
274 IF( anorm.LT.one ) THEN
275 resid = ( min( resid, dble( n )*anorm ) / anorm ) /
276 $ ( dble( n )*eps )
277 ELSE
278 resid = min( resid / anorm, dble( n ) ) /
279 $ ( dble( n )*eps )
280 END IF
281 END IF
282 END IF
283*
284 RETURN
285*
286* End of DBDT01
287*
double precision function dasum(n, dx, incx)
DASUM
Definition dasum.f:71
subroutine dcopy(n, dx, incx, dy, incy)
DCOPY
Definition dcopy.f:82
subroutine dgemv(trans, m, n, alpha, a, lda, x, incx, beta, y, incy)
DGEMV
Definition dgemv.f:158
double precision function dlamch(cmach)
DLAMCH
Definition dlamch.f:69
double precision function dlange(norm, m, n, a, lda, work)
DLANGE returns the value of the 1-norm, Frobenius norm, infinity-norm, or the largest absolute value ...
Definition dlange.f:114
Here is the call graph for this function:
Here is the caller graph for this function: