LAPACK  3.10.0
LAPACK: Linear Algebra PACKage

◆ sbdt01()

subroutine sbdt01 ( integer  M,
integer  N,
integer  KD,
real, dimension( lda, * )  A,
integer  LDA,
real, dimension( ldq, * )  Q,
integer  LDQ,
real, dimension( * )  D,
real, dimension( * )  E,
real, dimension( ldpt, * )  PT,
integer  LDPT,
real, dimension( * )  WORK,
real  RESID 
)

SBDT01

Purpose:
 SBDT01 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 REAL 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 REAL 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 REAL array, dimension (min(M,N))
          The diagonal elements of the bidiagonal matrix B.
[in]E
          E is REAL 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 REAL 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 REAL array, dimension (M+N)
[out]RESID
          RESID is REAL
          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 sbdt01.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  REAL RESID
149 * ..
150 * .. Array Arguments ..
151  REAL A( LDA, * ), D( * ), E( * ), PT( LDPT, * ),
152  $ Q( LDQ, * ), WORK( * )
153 * ..
154 *
155 * =====================================================================
156 *
157 * .. Parameters ..
158  REAL ZERO, ONE
159  parameter( zero = 0.0e+0, one = 1.0e+0 )
160 * ..
161 * .. Local Scalars ..
162  INTEGER I, J
163  REAL ANORM, EPS
164 * ..
165 * .. External Functions ..
166  REAL SASUM, SLAMCH, SLANGE
167  EXTERNAL sasum, slamch, slange
168 * ..
169 * .. External Subroutines ..
170  EXTERNAL scopy, sgemv
171 * ..
172 * .. Intrinsic Functions ..
173  INTRINSIC max, min, real
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 scopy( 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 sgemv( 'No transpose', m, n, -one, q, ldq,
202  $ work( m+1 ), 1, one, work, 1 )
203  resid = max( resid, sasum( 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 scopy( 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 sgemv( 'No transpose', m, m, -one, q, ldq,
216  $ work( m+1 ), 1, one, work, 1 )
217  resid = max( resid, sasum( m, work, 1 ) )
218  40 CONTINUE
219  ELSE
220 *
221 * B is lower bidiagonal.
222 *
223  DO 60 j = 1, n
224  CALL scopy( 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 sgemv( 'No transpose', m, m, -one, q, ldq,
231  $ work( m+1 ), 1, one, work, 1 )
232  resid = max( resid, sasum( 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 scopy( 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 sgemv( 'No transpose', m, n, -one, q, ldq,
246  $ work( m+1 ), 1, one, work, 1 )
247  resid = max( resid, sasum( m, work, 1 ) )
248  80 CONTINUE
249  ELSE
250  DO 100 j = 1, n
251  CALL scopy( 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 sgemv( 'No transpose', m, m, -one, q, ldq,
256  $ work( m+1 ), 1, one, work, 1 )
257  resid = max( resid, sasum( 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 = slange( '1', m, n, a, lda, work )
265  eps = slamch( '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 ) / ( real( n )*eps )
273  ELSE
274  IF( anorm.LT.one ) THEN
275  resid = ( min( resid, real( n )*anorm ) / anorm ) /
276  $ ( real( n )*eps )
277  ELSE
278  resid = min( resid / anorm, real( n ) ) /
279  $ ( real( n )*eps )
280  END IF
281  END IF
282  END IF
283 *
284  RETURN
285 *
286 * End of SBDT01
287 *
real function slange(NORM, M, N, A, LDA, WORK)
SLANGE returns the value of the 1-norm, Frobenius norm, infinity-norm, or the largest absolute value ...
Definition: slange.f:114
subroutine scopy(N, SX, INCX, SY, INCY)
SCOPY
Definition: scopy.f:82
real function sasum(N, SX, INCX)
SASUM
Definition: sasum.f:72
subroutine sgemv(TRANS, M, N, ALPHA, A, LDA, X, INCX, BETA, Y, INCY)
SGEMV
Definition: sgemv.f:156
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: