1 * =========== DOCUMENTATION ===========
3 * Online html documentation available at
4 * http://www.netlib.org/lapack/explore-html/
9 * SUBROUTINE SBDT05( M, N, A, LDA, S, NS, U, LDU,
10 * VT, LDVT, WORK, RESID )
12 * .. Scalar Arguments ..
13 * INTEGER LDA, LDU, LDVT, N, NS
16 * .. Array Arguments ..
17 * REAL D( * ), E( * ), S( * ), U( LDU, * ),
18 * $ VT( LDVT, * ), WORK( * )
27 *> SBDT05 reconstructs a bidiagonal matrix B from its (partial) SVD:
29 *> where U and V are orthogonal matrices and S is diagonal.
31 *> The test ratio to test the singular value decomposition is
32 *> RESID = norm( S - U' * B * V ) / ( n * norm(B) * EPS )
33 *> where VT = V' and EPS is the machine precision.
42 *> The number of rows of the matrices A and U.
48 *> The number of columns of the matrices A and VT.
53 *> A is REAL array, dimension (LDA,N)
54 *> The m by n matrix A.
59 *> The leading dimension of the array A. LDA >= max(1,M).
64 *> S is REAL array, dimension (NS)
65 *> The singular values from the (partial) SVD of B, sorted in
72 *> The number of singular values/vectors from the (partial)
78 *> U is REAL array, dimension (LDU,NS)
79 *> The n by ns orthogonal matrix U in S = U' * B * V.
85 *> The leading dimension of the array U. LDU >= max(1,N)
90 *> VT is REAL array, dimension (LDVT,N)
91 *> The n by ns orthogonal matrix V in S = U' * B * V.
97 *> The leading dimension of the array VT.
102 *> WORK is REAL array, dimension (M,N)
108 *> The test ratio: norm(S - U' * A * V) / ( n * norm(A) * EPS )
114 *> \author Univ. of Tennessee
115 *> \author Univ. of California Berkeley
116 *> \author Univ. of Colorado Denver
119 *> \date November 2011
121 *> \ingroup double_eig
123 * =====================================================================
124 SUBROUTINE SBDT05( M, N, A, LDA, S, NS, U, LDU,
125 $ VT, LDVT, WORK, RESID )
127 * -- LAPACK test routine (version 3.4.0) --
128 * -- LAPACK is a software package provided by Univ. of Tennessee, --
129 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
132 * .. Scalar Arguments ..
134 INTEGER LDA, LDU, LDVT, M, N, NS
137 * .. Array Arguments ..
138 REAL A( LDA, * ), S( * ), U( LDU, * ),
139 $ VT( LDVT, * ), WORK( * )
142 * ======================================================================
146 PARAMETER ( ZERO = 0.0E+0, ONE = 1.0E+0 )
148 * .. Local Scalars ..
152 * .. External Functions ..
155 REAL SASUM, SLAMCH, SLANGE
156 EXTERNAL LSAME, ISAMAX, SASUM, SLAMCH, SLANGE
158 * .. External Subroutines ..
161 * .. Intrinsic Functions ..
162 INTRINSIC ABS, REAL, MAX, MIN
164 * .. Executable Statements ..
166 * Quick return if possible.
169 IF( MIN( M, N ).LE.0 .OR. NS.LE.0 )
172 EPS = SLAMCH( 'Precision' )
173 ANORM = SLANGE( 'M', M, N, A, LDA, WORK )
175 * Compute U' * A * V.
177 CALL SGEMM( 'N', 'T', M, NS, N, ONE, A, LDA, VT,
178 $ LDVT, ZERO, WORK( 1+NS*NS ), M )
179 CALL SGEMM( 'T', 'N', NS, NS, M, -ONE, U, LDU, WORK( 1+NS*NS ),
180 $ M, ZERO, WORK, NS )
182 * norm(S - U' * B * V)
186 WORK( J+I ) = WORK( J+I ) + S( I )
187 RESID = MAX( RESID, SASUM( NS, WORK( J+1 ), 1 ) )
191 IF( ANORM.LE.ZERO ) THEN
195 IF( ANORM.GE.RESID ) THEN
196 RESID = ( RESID / ANORM ) / ( REAL( N )*EPS )
198 IF( ANORM.LT.ONE ) THEN
199 RESID = ( MIN( RESID, REAL( N )*ANORM ) / ANORM ) /
202 RESID = MIN( RESID / ANORM, REAL( N ) ) /