OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
cqrt15.f
Go to the documentation of this file.
1*> \brief \b CQRT15
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 CQRT15( 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* REAL NORMA, NORMB
17* ..
18* .. Array Arguments ..
19* INTEGER ISEED( 4 )
20* REAL S( * )
21* COMPLEX A( LDA, * ), B( LDB, * ), WORK( LWORK )
22* ..
23*
24*
25*> \par Purpose:
26* =============
27*>
28*> \verbatim
29*>
30*> CQRT15 generates a matrix with full or deficient rank and of various
31*> norms.
32*> \endverbatim
33*
34* Arguments:
35* ==========
36*
37*> \param[in] SCALE
38*> \verbatim
39*> SCALE is INTEGER
40*> SCALE = 1: normally scaled matrix
41*> SCALE = 2: matrix scaled up
42*> SCALE = 3: matrix scaled down
43*> \endverbatim
44*>
45*> \param[in] RKSEL
46*> \verbatim
47*> RKSEL is INTEGER
48*> RKSEL = 1: full rank matrix
49*> RKSEL = 2: rank-deficient matrix
50*> \endverbatim
51*>
52*> \param[in] M
53*> \verbatim
54*> M is INTEGER
55*> The number of rows of the matrix A.
56*> \endverbatim
57*>
58*> \param[in] N
59*> \verbatim
60*> N is INTEGER
61*> The number of columns of A.
62*> \endverbatim
63*>
64*> \param[in] NRHS
65*> \verbatim
66*> NRHS is INTEGER
67*> The number of columns of B.
68*> \endverbatim
69*>
70*> \param[out] A
71*> \verbatim
72*> A is COMPLEX array, dimension (LDA,N)
73*> The M-by-N matrix A.
74*> \endverbatim
75*>
76*> \param[in] LDA
77*> \verbatim
78*> LDA is INTEGER
79*> The leading dimension of the array A.
80*> \endverbatim
81*>
82*> \param[out] B
83*> \verbatim
84*> B is COMPLEX array, dimension (LDB, NRHS)
85*> A matrix that is in the range space of matrix A.
86*> \endverbatim
87*>
88*> \param[in] LDB
89*> \verbatim
90*> LDB is INTEGER
91*> The leading dimension of the array B.
92*> \endverbatim
93*>
94*> \param[out] S
95*> \verbatim
96*> S is REAL array, dimension MIN(M,N)
97*> Singular values of A.
98*> \endverbatim
99*>
100*> \param[out] RANK
101*> \verbatim
102*> RANK is INTEGER
103*> number of nonzero singular values of A.
104*> \endverbatim
105*>
106*> \param[out] NORMA
107*> \verbatim
108*> NORMA is REAL
109*> one-norm norm of A.
110*> \endverbatim
111*>
112*> \param[out] NORMB
113*> \verbatim
114*> NORMB is REAL
115*> one-norm norm of B.
116*> \endverbatim
117*>
118*> \param[in,out] ISEED
119*> \verbatim
120*> ISEED is integer array, dimension (4)
121*> seed for random number generator.
122*> \endverbatim
123*>
124*> \param[out] WORK
125*> \verbatim
126*> WORK is COMPLEX array, dimension (LWORK)
127*> \endverbatim
128*>
129*> \param[in] LWORK
130*> \verbatim
131*> LWORK is INTEGER
132*> length of work space required.
133*> LWORK >= MAX(M+MIN(M,N),NRHS*MIN(M,N),2*N+M)
134*> \endverbatim
135*
136* Authors:
137* ========
138*
139*> \author Univ. of Tennessee
140*> \author Univ. of California Berkeley
141*> \author Univ. of Colorado Denver
142*> \author NAG Ltd.
143*
144*> \ingroup complex_lin
145*
146* =====================================================================
147 SUBROUTINE cqrt15( SCALE, RKSEL, M, N, NRHS, A, LDA, B, LDB, S,
148 $ RANK, NORMA, NORMB, ISEED, WORK, LWORK )
149*
150* -- LAPACK test routine --
151* -- LAPACK is a software package provided by Univ. of Tennessee, --
152* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
153*
154* .. Scalar Arguments ..
155 INTEGER LDA, LDB, LWORK, M, N, NRHS, RANK, RKSEL, SCALE
156 REAL NORMA, NORMB
157* ..
158* .. Array Arguments ..
159 INTEGER ISEED( 4 )
160 REAL S( * )
161 COMPLEX A( LDA, * ), B( LDB, * ), WORK( LWORK )
162* ..
163*
164* =====================================================================
165*
166* .. Parameters ..
167 REAL ZERO, ONE, TWO, SVMIN
168 parameter( zero = 0.0e+0, one = 1.0e+0, two = 2.0e+0,
169 $ svmin = 0.1e+0 )
170 COMPLEX CZERO, CONE
171 parameter( czero = ( 0.0e+0, 0.0e+0 ),
172 $ cone = ( 1.0e+0, 0.0e+0 ) )
173* ..
174* .. Local Scalars ..
175 INTEGER INFO, J, MN
176 REAL BIGNUM, EPS, SMLNUM, TEMP
177* ..
178* .. Local Arrays ..
179 REAL DUMMY( 1 )
180* ..
181* .. External Functions ..
182 REAL CLANGE, SASUM, SCNRM2, SLAMCH, SLARND
183 EXTERNAL clange, sasum, scnrm2, slamch, slarnd
184* ..
185* .. External Subroutines ..
186 EXTERNAL cgemm, clarf, clarnv, claror, clascl, claset,
188* ..
189* .. Intrinsic Functions ..
190 INTRINSIC abs, cmplx, max, min
191* ..
192* .. Executable Statements ..
193*
194 mn = min( m, n )
195 IF( lwork.LT.max( m+mn, mn*nrhs, 2*n+m ) ) THEN
196 CALL xerbla( 'CQRT15', 16 )
197 RETURN
198 END IF
199*
200 smlnum = slamch( 'Safe minimum' )
201 bignum = one / smlnum
202 CALL slabad( smlnum, bignum )
203 eps = slamch( 'Epsilon' )
204 smlnum = ( smlnum / eps ) / eps
205 bignum = one / smlnum
206*
207* Determine rank and (unscaled) singular values
208*
209 IF( rksel.EQ.1 ) THEN
210 rank = mn
211 ELSE IF( rksel.EQ.2 ) THEN
212 rank = ( 3*mn ) / 4
213 DO 10 j = rank + 1, mn
214 s( j ) = zero
215 10 CONTINUE
216 ELSE
217 CALL xerbla( 'CQRT15', 2 )
218 END IF
219*
220 IF( rank.GT.0 ) THEN
221*
222* Nontrivial case
223*
224 s( 1 ) = one
225 DO 30 j = 2, rank
226 20 CONTINUE
227 temp = slarnd( 1, iseed )
228 IF( temp.GT.svmin ) THEN
229 s( j ) = abs( temp )
230 ELSE
231 GO TO 20
232 END IF
233 30 CONTINUE
234 CALL slaord( 'Decreasing', rank, s, 1 )
235*
236* Generate 'rank' columns of a random orthogonal matrix in A
237*
238 CALL clarnv( 2, iseed, m, work )
239 CALL csscal( m, one / scnrm2( m, work, 1 ), work, 1 )
240 CALL claset( 'Full', m, rank, czero, cone, a, lda )
241 CALL clarf( 'Left', m, rank, work, 1, cmplx( two ), a, lda,
242 $ work( m+1 ) )
243*
244* workspace used: m+mn
245*
246* Generate consistent rhs in the range space of A
247*
248 CALL clarnv( 2, iseed, rank*nrhs, work )
249 CALL cgemm( 'no transpose', 'no transpose', M, NRHS, RANK,
250 $ CONE, A, LDA, WORK, RANK, CZERO, B, LDB )
251*
252* work space used: <= mn *nrhs
253*
254* generate (unscaled) matrix A
255*
256 DO 40 J = 1, RANK
257 CALL CSSCAL( M, S( J ), A( 1, J ), 1 )
258 40 CONTINUE
259.LT. IF( RANKN )
260 $ CALL CLASET( 'full', M, N-RANK, CZERO, CZERO,
261 $ A( 1, RANK+1 ), LDA )
262 CALL CLAROR( 'right', 'no initialization', M, N, A, LDA, ISEED,
263 $ WORK, INFO )
264*
265 ELSE
266*
267* work space used 2*n+m
268*
269* Generate null matrix and rhs
270*
271 DO 50 J = 1, MN
272 S( J ) = ZERO
273 50 CONTINUE
274 CALL CLASET( 'full', M, N, CZERO, CZERO, A, LDA )
275 CALL CLASET( 'full', M, NRHS, CZERO, CZERO, B, LDB )
276*
277 END IF
278*
279* Scale the matrix
280*
281.NE. IF( SCALE1 ) THEN
282 NORMA = CLANGE( 'max', M, N, A, LDA, DUMMY )
283.NE. IF( NORMAZERO ) THEN
284.EQ. IF( SCALE2 ) THEN
285*
286* matrix scaled up
287*
288 CALL CLASCL( 'general', 0, 0, NORMA, BIGNUM, M, N, A,
289 $ LDA, INFO )
290 CALL SLASCL( 'general', 0, 0, NORMA, BIGNUM, MN, 1, S,
291 $ MN, INFO )
292 CALL CLASCL( 'general', 0, 0, NORMA, BIGNUM, M, NRHS, B,
293 $ LDB, INFO )
294.EQ. ELSE IF( SCALE3 ) THEN
295*
296* matrix scaled down
297*
298 CALL CLASCL( 'general', 0, 0, NORMA, SMLNUM, M, N, A,
299 $ LDA, INFO )
300 CALL SLASCL( 'general', 0, 0, NORMA, SMLNUM, MN, 1, S,
301 $ MN, INFO )
302 CALL CLASCL( 'general', 0, 0, NORMA, SMLNUM, M, NRHS, B,
303 $ LDB, INFO )
304 ELSE
305 CALL XERBLA( 'cqrt15', 1 )
306 RETURN
307 END IF
308 END IF
309 END IF
310*
311 NORMA = SASUM( MN, S, 1 )
312 NORMB = CLANGE( 'one-norm', M, NRHS, B, LDB, DUMMY )
313*
314 RETURN
315*
316* End of CQRT15
317*
318 END
float cmplx[2]
Definition pblas.h:136
norm(diag(diag(diag(inv(mat))) -id.SOL), 2) % destroy mumps instance id.JOB
subroutine slabad(small, large)
SLABAD
Definition slabad.f:74
subroutine slascl(type, kl, ku, cfrom, cto, m, n, a, lda, info)
SLASCL multiplies a general rectangular matrix by a real scalar defined as cto/cfrom.
Definition slascl.f:143
subroutine xerbla(srname, info)
XERBLA
Definition xerbla.f:60
subroutine clascl(type, kl, ku, cfrom, cto, m, n, a, lda, info)
CLASCL multiplies a general rectangular matrix by a real scalar defined as cto/cfrom.
Definition clascl.f:143
subroutine claset(uplo, m, n, alpha, beta, a, lda)
CLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values.
Definition claset.f:106
subroutine clarnv(idist, iseed, n, x)
CLARNV returns a vector of random numbers from a uniform or normal distribution.
Definition clarnv.f:99
subroutine clarf(side, m, n, v, incv, tau, c, ldc, work)
CLARF applies an elementary reflector to a general rectangular matrix.
Definition clarf.f:128
subroutine csscal(n, sa, cx, incx)
CSSCAL
Definition csscal.f:78
subroutine cgemm(transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc)
CGEMM
Definition cgemm.f:187
subroutine cqrt15(scale, rksel, m, n, nrhs, a, lda, b, ldb, s, rank, norma, normb, iseed, work, lwork)
CQRT15
Definition cqrt15.f:149
subroutine claror(side, init, m, n, a, lda, iseed, x, info)
CLAROR
Definition claror.f:158
subroutine slaord(job, n, x, incx)
SLAORD
Definition slaord.f:73
#define min(a, b)
Definition macros.h:20
#define max(a, b)
Definition macros.h:21