LAPACK 3.12.0 LAPACK: Linear Algebra PACKage
Searching...
No Matches
dqrt15.f
Go to the documentation of this file.
1*> \brief \b DQRT15
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8* Definition:
9* ===========
10*
11* SUBROUTINE DQRT15( SCALE, RKSEL, M, N, NRHS, A, LDA, B, LDB, S,
12* RANK, NORMA, NORMB, ISEED, WORK, LWORK )
13*
14* .. Scalar Arguments ..
15* INTEGER LDA, LDB, LWORK, M, N, NRHS, RANK, RKSEL, SCALE
16* DOUBLE PRECISION NORMA, NORMB
17* ..
18* .. Array Arguments ..
19* INTEGER ISEED( 4 )
20* DOUBLE PRECISION A( LDA, * ), B( LDB, * ), S( * ), WORK( LWORK )
21* ..
22*
23*
24*> \par Purpose:
25* =============
26*>
27*> \verbatim
28*>
29*> DQRT15 generates a matrix with full or deficient rank and of various
30*> norms.
31*> \endverbatim
32*
33* Arguments:
34* ==========
35*
36*> \param[in] SCALE
37*> \verbatim
38*> SCALE is INTEGER
39*> SCALE = 1: normally scaled matrix
40*> SCALE = 2: matrix scaled up
41*> SCALE = 3: matrix scaled down
42*> \endverbatim
43*>
44*> \param[in] RKSEL
45*> \verbatim
46*> RKSEL is INTEGER
47*> RKSEL = 1: full rank matrix
48*> RKSEL = 2: rank-deficient matrix
49*> \endverbatim
50*>
51*> \param[in] M
52*> \verbatim
53*> M is INTEGER
54*> The number of rows of the matrix A.
55*> \endverbatim
56*>
57*> \param[in] N
58*> \verbatim
59*> N is INTEGER
60*> The number of columns of A.
61*> \endverbatim
62*>
63*> \param[in] NRHS
64*> \verbatim
65*> NRHS is INTEGER
66*> The number of columns of B.
67*> \endverbatim
68*>
69*> \param[out] A
70*> \verbatim
71*> A is DOUBLE PRECISION array, dimension (LDA,N)
72*> The M-by-N matrix A.
73*> \endverbatim
74*>
75*> \param[in] LDA
76*> \verbatim
77*> LDA is INTEGER
78*> The leading dimension of the array A.
79*> \endverbatim
80*>
81*> \param[out] B
82*> \verbatim
83*> B is DOUBLE PRECISION array, dimension (LDB, NRHS)
84*> A matrix that is in the range space of matrix A.
85*> \endverbatim
86*>
87*> \param[in] LDB
88*> \verbatim
89*> LDB is INTEGER
90*> The leading dimension of the array B.
91*> \endverbatim
92*>
93*> \param[out] S
94*> \verbatim
95*> S is DOUBLE PRECISION array, dimension MIN(M,N)
96*> Singular values of A.
97*> \endverbatim
98*>
99*> \param[out] RANK
100*> \verbatim
101*> RANK is INTEGER
102*> number of nonzero singular values of A.
103*> \endverbatim
104*>
105*> \param[out] NORMA
106*> \verbatim
107*> NORMA is DOUBLE PRECISION
108*> one-norm of A.
109*> \endverbatim
110*>
111*> \param[out] NORMB
112*> \verbatim
113*> NORMB is DOUBLE PRECISION
114*> one-norm of B.
115*> \endverbatim
116*>
117*> \param[in,out] ISEED
118*> \verbatim
119*> ISEED is integer array, dimension (4)
120*> seed for random number generator.
121*> \endverbatim
122*>
123*> \param[out] WORK
124*> \verbatim
125*> WORK is DOUBLE PRECISION array, dimension (LWORK)
126*> \endverbatim
127*>
128*> \param[in] LWORK
129*> \verbatim
130*> LWORK is INTEGER
131*> length of work space required.
132*> LWORK >= MAX(M+MIN(M,N),NRHS*MIN(M,N),2*N+M)
133*> \endverbatim
134*
135* Authors:
136* ========
137*
138*> \author Univ. of Tennessee
139*> \author Univ. of California Berkeley
140*> \author Univ. of Colorado Denver
141*> \author NAG Ltd.
142*
143*> \ingroup double_lin
144*
145* =====================================================================
146 SUBROUTINE dqrt15( SCALE, RKSEL, M, N, NRHS, A, LDA, B, LDB, S,
147 \$ RANK, NORMA, NORMB, ISEED, WORK, LWORK )
148*
149* -- LAPACK test routine --
150* -- LAPACK is a software package provided by Univ. of Tennessee, --
151* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
152*
153* .. Scalar Arguments ..
154 INTEGER LDA, LDB, LWORK, M, N, NRHS, RANK, RKSEL, SCALE
155 DOUBLE PRECISION NORMA, NORMB
156* ..
157* .. Array Arguments ..
158 INTEGER ISEED( 4 )
159 DOUBLE PRECISION A( LDA, * ), B( LDB, * ), S( * ), WORK( LWORK )
160* ..
161*
162* =====================================================================
163*
164* .. Parameters ..
165 DOUBLE PRECISION ZERO, ONE, TWO, SVMIN
166 parameter( zero = 0.0d0, one = 1.0d0, two = 2.0d0,
167 \$ svmin = 0.1d0 )
168* ..
169* .. Local Scalars ..
170 INTEGER INFO, J, MN
171 DOUBLE PRECISION BIGNUM, EPS, SMLNUM, TEMP
172* ..
173* .. Local Arrays ..
174 DOUBLE PRECISION DUMMY( 1 )
175* ..
176* .. External Functions ..
177 DOUBLE PRECISION DASUM, DLAMCH, DLANGE, DLARND, DNRM2
178 EXTERNAL dasum, dlamch, dlange, dlarnd, dnrm2
179* ..
180* .. External Subroutines ..
181 EXTERNAL dgemm, dlaord, dlarf, dlarnv, dlaror, dlascl,
183* ..
184* .. Intrinsic Functions ..
185 INTRINSIC abs, max, min
186* ..
187* .. Executable Statements ..
188*
189 mn = min( m, n )
190 IF( lwork.LT.max( m+mn, mn*nrhs, 2*n+m ) ) THEN
191 CALL xerbla( 'DQRT15', 16 )
192 RETURN
193 END IF
194*
195 smlnum = dlamch( 'Safe minimum' )
196 bignum = one / smlnum
197 eps = dlamch( 'Epsilon' )
198 smlnum = ( smlnum / eps ) / eps
199 bignum = one / smlnum
200*
201* Determine rank and (unscaled) singular values
202*
203 IF( rksel.EQ.1 ) THEN
204 rank = mn
205 ELSE IF( rksel.EQ.2 ) THEN
206 rank = ( 3*mn ) / 4
207 DO 10 j = rank + 1, mn
208 s( j ) = zero
209 10 CONTINUE
210 ELSE
211 CALL xerbla( 'DQRT15', 2 )
212 END IF
213*
214 IF( rank.GT.0 ) THEN
215*
216* Nontrivial case
217*
218 s( 1 ) = one
219 DO 30 j = 2, rank
220 20 CONTINUE
221 temp = dlarnd( 1, iseed )
222 IF( temp.GT.svmin ) THEN
223 s( j ) = abs( temp )
224 ELSE
225 GO TO 20
226 END IF
227 30 CONTINUE
228 CALL dlaord( 'Decreasing', rank, s, 1 )
229*
230* Generate 'rank' columns of a random orthogonal matrix in A
231*
232 CALL dlarnv( 2, iseed, m, work )
233 CALL dscal( m, one / dnrm2( m, work, 1 ), work, 1 )
234 CALL dlaset( 'Full', m, rank, zero, one, a, lda )
235 CALL dlarf( 'Left', m, rank, work, 1, two, a, lda,
236 \$ work( m+1 ) )
237*
238* workspace used: m+mn
239*
240* Generate consistent rhs in the range space of A
241*
242 CALL dlarnv( 2, iseed, rank*nrhs, work )
243 CALL dgemm( 'No transpose', 'No transpose', m, nrhs, rank, one,
244 \$ a, lda, work, rank, zero, b, ldb )
245*
246* work space used: <= mn *nrhs
247*
248* generate (unscaled) matrix A
249*
250 DO 40 j = 1, rank
251 CALL dscal( m, s( j ), a( 1, j ), 1 )
252 40 CONTINUE
253 IF( rank.LT.n )
254 \$ CALL dlaset( 'Full', m, n-rank, zero, zero, a( 1, rank+1 ),
255 \$ lda )
256 CALL dlaror( 'Right', 'No initialization', m, n, a, lda, iseed,
257 \$ work, info )
258*
259 ELSE
260*
261* work space used 2*n+m
262*
263* Generate null matrix and rhs
264*
265 DO 50 j = 1, mn
266 s( j ) = zero
267 50 CONTINUE
268 CALL dlaset( 'Full', m, n, zero, zero, a, lda )
269 CALL dlaset( 'Full', m, nrhs, zero, zero, b, ldb )
270*
271 END IF
272*
273* Scale the matrix
274*
275 IF( scale.NE.1 ) THEN
276 norma = dlange( 'Max', m, n, a, lda, dummy )
277 IF( norma.NE.zero ) THEN
278 IF( scale.EQ.2 ) THEN
279*
280* matrix scaled up
281*
282 CALL dlascl( 'General', 0, 0, norma, bignum, m, n, a,
283 \$ lda, info )
284 CALL dlascl( 'General', 0, 0, norma, bignum, mn, 1, s,
285 \$ mn, info )
286 CALL dlascl( 'General', 0, 0, norma, bignum, m, nrhs, b,
287 \$ ldb, info )
288 ELSE IF( scale.EQ.3 ) THEN
289*
290* matrix scaled down
291*
292 CALL dlascl( 'General', 0, 0, norma, smlnum, m, n, a,
293 \$ lda, info )
294 CALL dlascl( 'General', 0, 0, norma, smlnum, mn, 1, s,
295 \$ mn, info )
296 CALL dlascl( 'General', 0, 0, norma, smlnum, m, nrhs, b,
297 \$ ldb, info )
298 ELSE
299 CALL xerbla( 'DQRT15', 1 )
300 RETURN
301 END IF
302 END IF
303 END IF
304*
305 norma = dasum( mn, s, 1 )
306 normb = dlange( 'One-norm', m, nrhs, b, ldb, dummy )
307*
308 RETURN
309*
310* End of DQRT15
311*
312 END
subroutine xerbla(srname, info)
Definition cblat2.f:3285
subroutine dlaord(job, n, x, incx)
DLAORD
Definition dlaord.f:73
subroutine dlaror(side, init, m, n, a, lda, iseed, x, info)
DLAROR
Definition dlaror.f:146
subroutine dqrt15(scale, rksel, m, n, nrhs, a, lda, b, ldb, s, rank, norma, normb, iseed, work, lwork)
DQRT15
Definition dqrt15.f:148
subroutine dgemm(transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc)
DGEMM
Definition dgemm.f:188
subroutine dlarf(side, m, n, v, incv, tau, c, ldc, work)
DLARF applies an elementary reflector to a general rectangular matrix.
Definition dlarf.f:124
subroutine dlarnv(idist, iseed, n, x)
DLARNV returns a vector of random numbers from a uniform or normal distribution.
Definition dlarnv.f:97
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 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:110
subroutine dscal(n, da, dx, incx)
DSCAL
Definition dscal.f:79