LAPACK  3.9.1
LAPACK: Linear Algebra PACKage

◆ cbdt01()

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

CBDT01

Purpose:
 CBDT01 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 unitary
 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 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]Q
          Q is COMPLEX array, dimension (LDQ,N)
          The m by min(m,n) unitary 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 COMPLEX array, dimension (LDPT,N)
          The min(m,n) by n unitary 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 COMPLEX array, dimension (M+N)
[out]RWORK
          RWORK is REAL array, dimension (M)
[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 144 of file cbdt01.f.

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