LAPACK  3.9.1
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'
 where Q (m by min(m,n)) and P' (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 * PT ) / ( n * norm(A) * EPS )
 where PT = P' and 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'.
[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'.
[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' in the reduction
          A = Q * B * P'.
[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') / ( n * norm(A) * EPS )
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.

Definition at line 138 of file sbdt01.f.

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