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

◆ cqrt15()

subroutine cqrt15 ( integer scale,
integer rksel,
integer m,
integer n,
integer nrhs,
complex, dimension( lda, * ) a,
integer lda,
complex, dimension( ldb, * ) b,
integer ldb,
real, dimension( * ) s,
integer rank,
real norma,
real normb,
integer, dimension( 4 ) iseed,
complex, dimension( lwork ) work,
integer lwork )

CQRT15

Purpose:
!>
!> CQRT15 generates a matrix with full or deficient rank and of various
!> norms.
!> 
Parameters
[in]SCALE
!>          SCALE is INTEGER
!>          SCALE = 1: normally scaled matrix
!>          SCALE = 2: matrix scaled up
!>          SCALE = 3: matrix scaled down
!> 
[in]RKSEL
!>          RKSEL is INTEGER
!>          RKSEL = 1: full rank matrix
!>          RKSEL = 2: rank-deficient matrix
!> 
[in]M
!>          M is INTEGER
!>          The number of rows of the matrix A.
!> 
[in]N
!>          N is INTEGER
!>          The number of columns of A.
!> 
[in]NRHS
!>          NRHS is INTEGER
!>          The number of columns of B.
!> 
[out]A
!>          A is COMPLEX array, dimension (LDA,N)
!>          The M-by-N matrix A.
!> 
[in]LDA
!>          LDA is INTEGER
!>          The leading dimension of the array A.
!> 
[out]B
!>          B is COMPLEX array, dimension (LDB, NRHS)
!>          A matrix that is in the range space of matrix A.
!> 
[in]LDB
!>          LDB is INTEGER
!>          The leading dimension of the array B.
!> 
[out]S
!>          S is REAL array, dimension MIN(M,N)
!>          Singular values of A.
!> 
[out]RANK
!>          RANK is INTEGER
!>          number of nonzero singular values of A.
!> 
[out]NORMA
!>          NORMA is REAL
!>          one-norm norm of A.
!> 
[out]NORMB
!>          NORMB is REAL
!>          one-norm norm of B.
!> 
[in,out]ISEED
!>          ISEED is integer array, dimension (4)
!>          seed for random number generator.
!> 
[out]WORK
!>          WORK is COMPLEX array, dimension (LWORK)
!> 
[in]LWORK
!>          LWORK is INTEGER
!>          length of work space required.
!>          LWORK >= MAX(M+MIN(M,N),NRHS*MIN(M,N),2*N+M)
!> 
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.

Definition at line 147 of file cqrt15.f.

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 eps = slamch( 'Epsilon' )
203 smlnum = ( smlnum / eps ) / eps
204 bignum = one / smlnum
205*
206* Determine rank and (unscaled) singular values
207*
208 IF( rksel.EQ.1 ) THEN
209 rank = mn
210 ELSE IF( rksel.EQ.2 ) THEN
211 rank = ( 3*mn ) / 4
212 DO 10 j = rank + 1, mn
213 s( j ) = zero
214 10 CONTINUE
215 ELSE
216 CALL xerbla( 'CQRT15', 2 )
217 END IF
218*
219 IF( rank.GT.0 ) THEN
220*
221* Nontrivial case
222*
223 s( 1 ) = one
224 DO 30 j = 2, rank
225 20 CONTINUE
226 temp = slarnd( 1, iseed )
227 IF( temp.GT.svmin ) THEN
228 s( j ) = abs( temp )
229 ELSE
230 GO TO 20
231 END IF
232 30 CONTINUE
233 CALL slaord( 'Decreasing', rank, s, 1 )
234*
235* Generate 'rank' columns of a random orthogonal matrix in A
236*
237 CALL clarnv( 2, iseed, m, work )
238 CALL csscal( m, one / scnrm2( m, work, 1 ), work, 1 )
239 CALL claset( 'Full', m, rank, czero, cone, a, lda )
240 CALL clarf( 'Left', m, rank, work, 1, cmplx( two ), a, lda,
241 $ work( m+1 ) )
242*
243* workspace used: m+mn
244*
245* Generate consistent rhs in the range space of A
246*
247 CALL clarnv( 2, iseed, rank*nrhs, work )
248 CALL cgemm( 'No transpose', 'No transpose', m, nrhs, rank,
249 $ cone, a, lda, work, rank, czero, b, ldb )
250*
251* work space used: <= mn *nrhs
252*
253* generate (unscaled) matrix A
254*
255 DO 40 j = 1, rank
256 CALL csscal( m, s( j ), a( 1, j ), 1 )
257 40 CONTINUE
258 IF( rank.LT.n )
259 $ CALL claset( 'Full', m, n-rank, czero, czero,
260 $ a( 1, rank+1 ), lda )
261 CALL claror( 'Right', 'No initialization', m, n, a, lda, iseed,
262 $ work, info )
263*
264 ELSE
265*
266* work space used 2*n+m
267*
268* Generate null matrix and rhs
269*
270 DO 50 j = 1, mn
271 s( j ) = zero
272 50 CONTINUE
273 CALL claset( 'Full', m, n, czero, czero, a, lda )
274 CALL claset( 'Full', m, nrhs, czero, czero, b, ldb )
275*
276 END IF
277*
278* Scale the matrix
279*
280 IF( scale.NE.1 ) THEN
281 norma = clange( 'Max', m, n, a, lda, dummy )
282 IF( norma.NE.zero ) THEN
283 IF( scale.EQ.2 ) THEN
284*
285* matrix scaled up
286*
287 CALL clascl( 'General', 0, 0, norma, bignum, m, n, a,
288 $ lda, info )
289 CALL slascl( 'General', 0, 0, norma, bignum, mn, 1, s,
290 $ mn, info )
291 CALL clascl( 'General', 0, 0, norma, bignum, m, nrhs, b,
292 $ ldb, info )
293 ELSE IF( scale.EQ.3 ) THEN
294*
295* matrix scaled down
296*
297 CALL clascl( 'General', 0, 0, norma, smlnum, m, n, a,
298 $ lda, info )
299 CALL slascl( 'General', 0, 0, norma, smlnum, mn, 1, s,
300 $ mn, info )
301 CALL clascl( 'General', 0, 0, norma, smlnum, m, nrhs, b,
302 $ ldb, info )
303 ELSE
304 CALL xerbla( 'CQRT15', 1 )
305 RETURN
306 END IF
307 END IF
308 END IF
309*
310 norma = sasum( mn, s, 1 )
311 normb = clange( 'One-norm', m, nrhs, b, ldb, dummy )
312*
313 RETURN
314*
315* End of CQRT15
316*
subroutine xerbla(srname, info)
Definition cblat2.f:3285
subroutine claror(side, init, m, n, a, lda, iseed, x, info)
CLAROR
Definition claror.f:158
real function sasum(n, sx, incx)
SASUM
Definition sasum.f:72
subroutine cgemm(transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc)
CGEMM
Definition cgemm.f:188
real function slamch(cmach)
SLAMCH
Definition slamch.f:68
real function clange(norm, m, n, a, lda, work)
CLANGE returns the value of the 1-norm, Frobenius norm, infinity-norm, or the largest absolute value ...
Definition clange.f:113
subroutine clarf(side, m, n, v, incv, tau, c, ldc, work)
CLARF applies an elementary reflector to a general rectangular matrix.
Definition clarf.f:126
subroutine clarnv(idist, iseed, n, x)
CLARNV returns a vector of random numbers from a uniform or normal distribution.
Definition clarnv.f:97
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:142
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:142
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:104
real(wp) function scnrm2(n, x, incx)
SCNRM2
Definition scnrm2.f90:90
subroutine csscal(n, sa, cx, incx)
CSSCAL
Definition csscal.f:78
subroutine slaord(job, n, x, incx)
SLAORD
Definition slaord.f:73
real function slarnd(idist, iseed)
SLARND
Definition slarnd.f:73
Here is the call graph for this function:
Here is the caller graph for this function: