LAPACK  3.9.1
LAPACK: Linear Algebra PACKage

◆ cbdt05()

subroutine cbdt05 ( integer  M,
integer  N,
complex, dimension( lda, * )  A,
integer  LDA,
real, dimension( * )  S,
integer  NS,
complex, dimension( * )  U,
integer  LDU,
complex, dimension( ldvt, * )  VT,
integer  LDVT,
complex, dimension( * )  WORK,
real  RESID 
)

CBDT05

Purpose:
 CBDT05 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 COMPLEX 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 REAL 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 COMPLEX 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 COMPLEX 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 COMPLEX array, dimension (M,N)
[out]RESID
          RESID is REAL
          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 123 of file cbdt05.f.

125 *
126 * -- LAPACK test routine --
127 * -- LAPACK is a software package provided by Univ. of Tennessee, --
128 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
129 *
130 * .. Scalar Arguments ..
131  INTEGER LDA, LDU, LDVT, M, N, NS
132  REAL RESID
133 * ..
134 * .. Array Arguments ..
135  REAL S( * )
136  COMPLEX A( LDA, * ), U( * ), VT( LDVT, * ), WORK( * )
137 * ..
138 *
139 * ======================================================================
140 *
141 * .. Parameters ..
142  REAL ZERO, ONE
143  parameter( zero = 0.0e+0, one = 1.0e+0 )
144  COMPLEX CZERO, CONE
145  parameter( czero = ( 0.0e+0, 0.0e+0 ),
146  $ cone = ( 1.0e+0, 0.0e+0 ) )
147 * ..
148 * .. Local Scalars ..
149  INTEGER I, J
150  REAL ANORM, EPS
151 * ..
152 * .. Local Arrays ..
153  REAL DUM( 1 )
154 * ..
155 * .. External Functions ..
156  LOGICAL LSAME
157  INTEGER ISAMAX
158  REAL SASUM, SLAMCH, CLANGE
159  EXTERNAL lsame, isamax, sasum, slamch, clange
160  REAL SCASUM
161 * ..
162 * .. External Subroutines ..
163  EXTERNAL cgemm
164 * ..
165 * .. Intrinsic Functions ..
166  INTRINSIC abs, real, max, min
167 * ..
168 * .. Executable Statements ..
169 *
170 * Quick return if possible.
171 *
172  resid = zero
173  IF( min( m, n ).LE.0 .OR. ns.LE.0 )
174  $ RETURN
175 *
176  eps = slamch( 'Precision' )
177  anorm = clange( 'M', m, n, a, lda, dum )
178 *
179 * Compute U' * A * V.
180 *
181  CALL cgemm( 'N', 'C', m, ns, n, cone, a, lda, vt,
182  $ ldvt, czero, work( 1+ns*ns ), m )
183  CALL cgemm( 'C', 'N', ns, ns, m, -cone, u, ldu, work( 1+ns*ns ),
184  $ m, czero, work, ns )
185 *
186 * norm(S - U' * B * V)
187 *
188  j = 0
189  DO 10 i = 1, ns
190  work( j+i ) = work( j+i ) + cmplx( s( i ), zero )
191  resid = max( resid, scasum( ns, work( j+1 ), 1 ) )
192  j = j + ns
193  10 CONTINUE
194 *
195  IF( anorm.LE.zero ) THEN
196  IF( resid.NE.zero )
197  $ resid = one / eps
198  ELSE
199  IF( anorm.GE.resid ) THEN
200  resid = ( resid / anorm ) / ( real( n )*eps )
201  ELSE
202  IF( anorm.LT.one ) THEN
203  resid = ( min( resid, real( n )*anorm ) / anorm ) /
204  $ ( real( n )*eps )
205  ELSE
206  resid = min( resid / anorm, real( n ) ) /
207  $ ( real( n )*eps )
208  END IF
209  END IF
210  END IF
211 *
212  RETURN
213 *
214 * End of CBDT05
215 *
integer function isamax(N, SX, INCX)
ISAMAX
Definition: isamax.f:71
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:53
subroutine cgemm(TRANSA, TRANSB, M, N, K, ALPHA, A, LDA, B, LDB, BETA, C, LDC)
CGEMM
Definition: cgemm.f:187
real function clange(NORM, M, N, A, LDA, WORK)
CLANGE returns the value of the 1-norm, Frobenius norm, infinity-norm, or the largest absolute value ...
Definition: clange.f:115
real function scasum(N, CX, INCX)
SCASUM
Definition: scasum.f:72
real function sasum(N, SX, INCX)
SASUM
Definition: sasum.f:72
real function slamch(CMACH)
SLAMCH
Definition: slamch.f:68
Here is the call graph for this function:
Here is the caller graph for this function: