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

DQRT12

Purpose:
``` DQRT12 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 DOUBLE PRECISION 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 DOUBLE PRECISION array, dimension (LWORK)` [in] LWORK ``` LWORK is INTEGER The length of the array WORK. LWORK >= max(M*N + 4*min(M,N) + max(M,N), M*N+2*MIN( M, N )+4*N).```
Date
November 2011

Definition at line 91 of file dqrt12.f.

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

Here is the call graph for this function: