LAPACK 3.12.0
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ zqrt12()

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

      || svlues - s||/(||s||*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.

Definition at line 95 of file zqrt12.f.

97*
98* -- LAPACK test routine --
99* -- LAPACK is a software package provided by Univ. of Tennessee, --
100* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
101*
102* .. Scalar Arguments ..
103 INTEGER LDA, LWORK, M, N
104* ..
105* .. Array Arguments ..
106 DOUBLE PRECISION RWORK( * ), S( * )
107 COMPLEX*16 A( LDA, * ), WORK( LWORK )
108* ..
109*
110* =====================================================================
111*
112* .. Parameters ..
113 DOUBLE PRECISION ZERO, ONE
114 parameter( zero = 0.0d0, one = 1.0d0 )
115* ..
116* .. Local Scalars ..
117 INTEGER I, INFO, ISCL, J, MN
118 DOUBLE PRECISION ANRM, BIGNUM, NRMSVL, SMLNUM
119* ..
120* .. Local Arrays ..
121 DOUBLE PRECISION DUMMY( 1 )
122* ..
123* .. External Functions ..
124 DOUBLE PRECISION DASUM, DLAMCH, DNRM2, ZLANGE
125 EXTERNAL dasum, dlamch, dnrm2, zlange
126* ..
127* .. External Subroutines ..
128 EXTERNAL daxpy, dbdsqr, dlascl, xerbla, zgebd2, zlascl,
129 $ zlaset
130* ..
131* .. Intrinsic Functions ..
132 INTRINSIC dble, dcmplx, max, min
133* ..
134* .. Executable Statements ..
135*
136 zqrt12 = zero
137*
138* Test that enough workspace is supplied
139*
140 IF( lwork.LT.m*n+2*min( m, n )+max( m, n ) ) THEN
141 CALL xerbla( 'ZQRT12', 7 )
142 RETURN
143 END IF
144*
145* Quick return if possible
146*
147 mn = min( m, n )
148 IF( mn.LE.zero )
149 $ RETURN
150*
151 nrmsvl = dnrm2( mn, s, 1 )
152*
153* Copy upper triangle of A into work
154*
155 CALL zlaset( 'Full', m, n, dcmplx( zero ), dcmplx( zero ), work,
156 $ m )
157 DO j = 1, n
158 DO i = 1, min( j, m )
159 work( ( j-1 )*m+i ) = a( i, j )
160 END DO
161 END DO
162*
163* Get machine parameters
164*
165 smlnum = dlamch( 'S' ) / dlamch( 'P' )
166 bignum = one / smlnum
167*
168* Scale work if max entry outside range [SMLNUM,BIGNUM]
169*
170 anrm = zlange( 'M', m, n, work, m, dummy )
171 iscl = 0
172 IF( anrm.GT.zero .AND. anrm.LT.smlnum ) THEN
173*
174* Scale matrix norm up to SMLNUM
175*
176 CALL zlascl( 'G', 0, 0, anrm, smlnum, m, n, work, m, info )
177 iscl = 1
178 ELSE IF( anrm.GT.bignum ) THEN
179*
180* Scale matrix norm down to BIGNUM
181*
182 CALL zlascl( 'G', 0, 0, anrm, bignum, m, n, work, m, info )
183 iscl = 1
184 END IF
185*
186 IF( anrm.NE.zero ) THEN
187*
188* Compute SVD of work
189*
190 CALL zgebd2( m, n, work, m, rwork( 1 ), rwork( mn+1 ),
191 $ work( m*n+1 ), work( m*n+mn+1 ),
192 $ work( m*n+2*mn+1 ), info )
193 CALL dbdsqr( 'Upper', mn, 0, 0, 0, rwork( 1 ), rwork( mn+1 ),
194 $ dummy, mn, dummy, 1, dummy, mn, rwork( 2*mn+1 ),
195 $ info )
196*
197 IF( iscl.EQ.1 ) THEN
198 IF( anrm.GT.bignum ) THEN
199 CALL dlascl( 'G', 0, 0, bignum, anrm, mn, 1, rwork( 1 ),
200 $ mn, info )
201 END IF
202 IF( anrm.LT.smlnum ) THEN
203 CALL dlascl( 'G', 0, 0, smlnum, anrm, mn, 1, rwork( 1 ),
204 $ mn, info )
205 END IF
206 END IF
207*
208 ELSE
209*
210 DO i = 1, mn
211 rwork( i ) = zero
212 END DO
213 END IF
214*
215* Compare s and singular values of work
216*
217 CALL daxpy( mn, -one, s, 1, rwork( 1 ), 1 )
218 zqrt12 = dasum( mn, rwork( 1 ), 1 ) /
219 $ ( dlamch( 'Epsilon' )*dble( max( m, n ) ) )
220*
221 IF( nrmsvl.NE.zero )
222 $ zqrt12 = zqrt12 / nrmsvl
223*
224 RETURN
225*
226* End of ZQRT12
227*
subroutine xerbla(srname, info)
Definition cblat2.f:3285
double precision function dasum(n, dx, incx)
DASUM
Definition dasum.f:71
subroutine daxpy(n, da, dx, incx, dy, incy)
DAXPY
Definition daxpy.f:89
subroutine dbdsqr(uplo, n, ncvt, nru, ncc, d, e, vt, ldvt, u, ldu, c, ldc, work, info)
DBDSQR
Definition dbdsqr.f:241
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:189
double precision function dlamch(cmach)
DLAMCH
Definition dlamch.f:69
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:115
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:143
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:143
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:106
real(wp) function dnrm2(n, x, incx)
DNRM2
Definition dnrm2.f90:89
double precision function zqrt12(m, n, a, lda, s, work, lwork, rwork)
ZQRT12
Definition zqrt12.f:97
Here is the call graph for this function:
Here is the caller graph for this function: