LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
double precision function zqrt12 ( integer  M,
integer  N,
complex*16, dimension( lda, * )  A,
integer  LDA,
double precision, dimension( * )  S,
complex*16, dimension( lwork )  WORK,
integer  LWORK,
double precision, dimension( * )  RWORK 
)

ZQRT12

Purpose:
 ZQRT12 computes the singular values `svlues' of the upper trapezoid
 of A(1:M,1:N) and returns the ratio

      || s - svlues||/(||svlues||*eps*max(M,N))
Parameters
[in]M
          M is INTEGER
          The number of rows of the matrix A.
[in]N
          N is INTEGER
          The number of columns of the matrix A.
[in]A
          A is COMPLEX*16 array, dimension (LDA,N)
          The M-by-N matrix A. Only the upper trapezoid is referenced.
[in]LDA
          LDA is INTEGER
          The leading dimension of the array A.
[in]S
          S is DOUBLE PRECISION array, dimension (min(M,N))
          The singular values of the matrix A.
[out]WORK
          WORK is COMPLEX*16 array, dimension (LWORK)
[in]LWORK
          LWORK is INTEGER
          The length of the array WORK. LWORK >= M*N + 2*min(M,N) +
          max(M,N).
[out]RWORK
          RWORK is DOUBLE PRECISION array, dimension (2*min(M,N))
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
November 2011

Definition at line 99 of file zqrt12.f.

99 *
100 * -- LAPACK test routine (version 3.4.0) --
101 * -- LAPACK is a software package provided by Univ. of Tennessee, --
102 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
103 * November 2011
104 *
105 * .. Scalar Arguments ..
106  INTEGER lda, lwork, m, n
107 * ..
108 * .. Array Arguments ..
109  DOUBLE PRECISION rwork( * ), s( * )
110  COMPLEX*16 a( lda, * ), work( lwork )
111 * ..
112 *
113 * =====================================================================
114 *
115 * .. Parameters ..
116  DOUBLE PRECISION zero, one
117  parameter ( zero = 0.0d0, one = 1.0d0 )
118 * ..
119 * .. Local Scalars ..
120  INTEGER i, info, iscl, j, mn
121  DOUBLE PRECISION anrm, bignum, nrmsvl, smlnum
122 * ..
123 * .. Local Arrays ..
124  DOUBLE PRECISION dummy( 1 )
125 * ..
126 * .. External Functions ..
127  DOUBLE PRECISION dasum, dlamch, dnrm2, zlange
128  EXTERNAL dasum, dlamch, dnrm2, zlange
129 * ..
130 * .. External Subroutines ..
131  EXTERNAL daxpy, dbdsqr, dlabad, dlascl, xerbla, zgebd2,
132  $ zlascl, zlaset
133 * ..
134 * .. Intrinsic Functions ..
135  INTRINSIC dble, dcmplx, max, min
136 * ..
137 * .. Executable Statements ..
138 *
139  zqrt12 = zero
140 *
141 * Test that enough workspace is supplied
142 *
143  IF( lwork.LT.m*n+2*min( m, n )+max( m, n ) ) THEN
144  CALL xerbla( 'ZQRT12', 7 )
145  RETURN
146  END IF
147 *
148 * Quick return if possible
149 *
150  mn = min( m, n )
151  IF( mn.LE.zero )
152  $ RETURN
153 *
154  nrmsvl = dnrm2( mn, s, 1 )
155 *
156 * Copy upper triangle of A into work
157 *
158  CALL zlaset( 'Full', m, n, dcmplx( zero ), dcmplx( zero ), work,
159  $ m )
160  DO 20 j = 1, n
161  DO 10 i = 1, min( j, m )
162  work( ( j-1 )*m+i ) = a( i, j )
163  10 CONTINUE
164  20 CONTINUE
165 *
166 * Get machine parameters
167 *
168  smlnum = dlamch( 'S' ) / dlamch( 'P' )
169  bignum = one / smlnum
170  CALL dlabad( smlnum, bignum )
171 *
172 * Scale work if max entry outside range [SMLNUM,BIGNUM]
173 *
174  anrm = zlange( 'M', m, n, work, m, dummy )
175  iscl = 0
176  IF( anrm.GT.zero .AND. anrm.LT.smlnum ) THEN
177 *
178 * Scale matrix norm up to SMLNUM
179 *
180  CALL zlascl( 'G', 0, 0, anrm, smlnum, m, n, work, m, info )
181  iscl = 1
182  ELSE IF( anrm.GT.bignum ) THEN
183 *
184 * Scale matrix norm down to BIGNUM
185 *
186  CALL zlascl( 'G', 0, 0, anrm, bignum, m, n, work, m, info )
187  iscl = 1
188  END IF
189 *
190  IF( anrm.NE.zero ) THEN
191 *
192 * Compute SVD of work
193 *
194  CALL zgebd2( m, n, work, m, rwork( 1 ), rwork( mn+1 ),
195  $ work( m*n+1 ), work( m*n+mn+1 ),
196  $ work( m*n+2*mn+1 ), info )
197  CALL dbdsqr( 'Upper', mn, 0, 0, 0, rwork( 1 ), rwork( mn+1 ),
198  $ dummy, mn, dummy, 1, dummy, mn, rwork( 2*mn+1 ),
199  $ info )
200 *
201  IF( iscl.EQ.1 ) THEN
202  IF( anrm.GT.bignum ) THEN
203  CALL dlascl( 'G', 0, 0, bignum, anrm, mn, 1, rwork( 1 ),
204  $ mn, info )
205  END IF
206  IF( anrm.LT.smlnum ) THEN
207  CALL dlascl( 'G', 0, 0, smlnum, anrm, mn, 1, rwork( 1 ),
208  $ mn, info )
209  END IF
210  END IF
211 *
212  ELSE
213 *
214  DO 30 i = 1, mn
215  rwork( i ) = zero
216  30 CONTINUE
217  END IF
218 *
219 * Compare s and singular values of work
220 *
221  CALL daxpy( mn, -one, s, 1, rwork( 1 ), 1 )
222  zqrt12 = dasum( mn, rwork( 1 ), 1 ) /
223  $ ( dlamch( 'Epsilon' )*dble( max( m, n ) ) )
224  IF( nrmsvl.NE.zero )
225  $ zqrt12 = zqrt12 / nrmsvl
226 *
227  RETURN
228 *
229 * End of ZQRT12
230 *
double precision function zqrt12(M, N, A, LDA, S, WORK, LWORK, RWORK)
ZQRT12
Definition: zqrt12.f:99
double precision function dlamch(CMACH)
DLAMCH
Definition: dlamch.f:65
subroutine dlascl(TYPE, KL, KU, CFROM, CTO, M, N, A, LDA, INFO)
DLASCL multiplies a general rectangular matrix by a real scalar defined as cto/cfrom.
Definition: dlascl.f:145
subroutine daxpy(N, DA, DX, INCX, DY, INCY)
DAXPY
Definition: daxpy.f:54
subroutine zlaset(UPLO, M, N, ALPHA, BETA, A, LDA)
ZLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values...
Definition: zlaset.f:108
subroutine dbdsqr(UPLO, N, NCVT, NRU, NCC, D, E, VT, LDVT, U, LDU, C, LDC, WORK, INFO)
DBDSQR
Definition: dbdsqr.f:232
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
subroutine dlabad(SMALL, LARGE)
DLABAD
Definition: dlabad.f:76
double precision function zlange(NORM, M, N, A, LDA, WORK)
ZLANGE returns the value of the 1-norm, Frobenius norm, infinity-norm, or the largest absolute value ...
Definition: zlange.f:117
double precision function dnrm2(N, X, INCX)
DNRM2
Definition: dnrm2.f:56
subroutine zgebd2(M, N, A, LDA, D, E, TAUQ, TAUP, WORK, INFO)
ZGEBD2 reduces a general matrix to bidiagonal form using an unblocked algorithm.
Definition: zgebd2.f:191
double precision function dasum(N, DX, INCX)
DASUM
Definition: dasum.f:53
subroutine zlascl(TYPE, KL, KU, CFROM, CTO, M, N, A, LDA, INFO)
ZLASCL multiplies a general rectangular matrix by a real scalar defined as cto/cfrom.
Definition: zlascl.f:145

Here is the call graph for this function: