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

◆ dbdt05()

subroutine dbdt05 ( integer  m,
integer  n,
double precision, dimension( lda, * )  a,
integer  lda,
double precision, dimension( * )  s,
integer  ns,
double precision, dimension( ldu, * )  u,
integer  ldu,
double precision, dimension( ldvt, * )  vt,
integer  ldvt,
double precision, dimension( * )  work,
double precision  resid 
)

DBDT05

Purpose:
 DBDT05 reconstructs a bidiagonal matrix B from its (partial) SVD:
    S = U' * B * V
 where U and V are orthogonal matrices and S is diagonal.

 The test ratio to test the singular value decomposition is
    RESID = norm( S - U' * B * V ) / ( n * norm(B) * EPS )
 where VT = V' and EPS is the machine precision.
Parameters
[in]M
          M is INTEGER
          The number of rows of the matrices A and U.
[in]N
          N is INTEGER
          The number of columns of the matrices A and VT.
[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]S
          S is DOUBLE PRECISION array, dimension (NS)
          The singular values from the (partial) SVD of B, sorted in
          decreasing order.
[in]NS
          NS is INTEGER
          The number of singular values/vectors from the (partial)
          SVD of B.
[in]U
          U is DOUBLE PRECISION array, dimension (LDU,NS)
          The n by ns orthogonal matrix U in S = U' * B * V.
[in]LDU
          LDU is INTEGER
          The leading dimension of the array U.  LDU >= max(1,N)
[in]VT
          VT is DOUBLE PRECISION array, dimension (LDVT,N)
          The n by ns orthogonal matrix V in S = U' * B * V.
[in]LDVT
          LDVT is INTEGER
          The leading dimension of the array VT.
[out]WORK
          WORK is DOUBLE PRECISION array, dimension (M,N)
[out]RESID
          RESID is DOUBLE PRECISION
          The test ratio:  norm(S - U' * A * V) / ( n * norm(A) * EPS )
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.

Definition at line 125 of file dbdt05.f.

127*
128* -- LAPACK test routine --
129* -- LAPACK is a software package provided by Univ. of Tennessee, --
130* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
131*
132* .. Scalar Arguments ..
133 INTEGER LDA, LDU, LDVT, M, N, NS
134 DOUBLE PRECISION RESID
135* ..
136* .. Array Arguments ..
137 DOUBLE PRECISION A( LDA, * ), S( * ), U( LDU, * ),
138 $ VT( LDVT, * ), WORK( * )
139* ..
140*
141* ======================================================================
142*
143* .. Parameters ..
144 DOUBLE PRECISION ZERO, ONE
145 parameter( zero = 0.0d+0, one = 1.0d+0 )
146* ..
147* .. Local Scalars ..
148 INTEGER I, J
149 DOUBLE PRECISION ANORM, EPS
150* ..
151* .. External Functions ..
152 LOGICAL LSAME
153 INTEGER IDAMAX
154 DOUBLE PRECISION DASUM, DLAMCH, DLANGE
155 EXTERNAL lsame, idamax, dasum, dlamch, dlange
156* ..
157* .. External Subroutines ..
158 EXTERNAL dgemm
159* ..
160* .. Intrinsic Functions ..
161 INTRINSIC abs, dble, max, min
162* ..
163* .. Executable Statements ..
164*
165* Quick return if possible.
166*
167 resid = zero
168 IF( min( m, n ).LE.0 .OR. ns.LE.0 )
169 $ RETURN
170*
171 eps = dlamch( 'Precision' )
172 anorm = dlange( 'M', m, n, a, lda, work )
173*
174* Compute U' * A * V.
175*
176 CALL dgemm( 'N', 'T', m, ns, n, one, a, lda, vt,
177 $ ldvt, zero, work( 1+ns*ns ), m )
178 CALL dgemm( 'T', 'N', ns, ns, m, -one, u, ldu, work( 1+ns*ns ),
179 $ m, zero, work, ns )
180*
181* norm(S - U' * B * V)
182*
183 j = 0
184 DO 10 i = 1, ns
185 work( j+i ) = work( j+i ) + s( i )
186 resid = max( resid, dasum( ns, work( j+1 ), 1 ) )
187 j = j + ns
188 10 CONTINUE
189*
190 IF( anorm.LE.zero ) THEN
191 IF( resid.NE.zero )
192 $ resid = one / eps
193 ELSE
194 IF( anorm.GE.resid ) THEN
195 resid = ( resid / anorm ) / ( dble( n )*eps )
196 ELSE
197 IF( anorm.LT.one ) THEN
198 resid = ( min( resid, dble( n )*anorm ) / anorm ) /
199 $ ( dble( n )*eps )
200 ELSE
201 resid = min( resid / anorm, dble( n ) ) /
202 $ ( dble( n )*eps )
203 END IF
204 END IF
205 END IF
206*
207 RETURN
208*
209* End of DBDT05
210*
double precision function dasum(n, dx, incx)
DASUM
Definition dasum.f:71
subroutine dgemm(transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc)
DGEMM
Definition dgemm.f:188
integer function idamax(n, dx, incx)
IDAMAX
Definition idamax.f:71
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
logical function lsame(ca, cb)
LSAME
Definition lsame.f:48
Here is the call graph for this function:
Here is the caller graph for this function: