LAPACK  3.8.0
LAPACK: Linear Algebra PACKage

◆ 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.
Date
December 2016

Definition at line 151 of file cqrt15.f.

151 *
152 * -- LAPACK test routine (version 3.7.0) --
153 * -- LAPACK is a software package provided by Univ. of Tennessee, --
154 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
155 * December 2016
156 *
157 * .. Scalar Arguments ..
158  INTEGER lda, ldb, lwork, m, n, nrhs, rank, rksel, scale
159  REAL norma, normb
160 * ..
161 * .. Array Arguments ..
162  INTEGER iseed( 4 )
163  REAL s( * )
164  COMPLEX a( lda, * ), b( ldb, * ), work( lwork )
165 * ..
166 *
167 * =====================================================================
168 *
169 * .. Parameters ..
170  REAL zero, one, two, svmin
171  parameter( zero = 0.0e+0, one = 1.0e+0, two = 2.0e+0,
172  $ svmin = 0.1e+0 )
173  COMPLEX czero, cone
174  parameter( czero = ( 0.0e+0, 0.0e+0 ),
175  $ cone = ( 1.0e+0, 0.0e+0 ) )
176 * ..
177 * .. Local Scalars ..
178  INTEGER info, j, mn
179  REAL bignum, eps, smlnum, temp
180 * ..
181 * .. Local Arrays ..
182  REAL dummy( 1 )
183 * ..
184 * .. External Functions ..
185  REAL clange, sasum, scnrm2, slamch, slarnd
186  EXTERNAL clange, sasum, scnrm2, slamch, slarnd
187 * ..
188 * .. External Subroutines ..
189  EXTERNAL cgemm, clarf, clarnv, claror, clascl, claset,
191 * ..
192 * .. Intrinsic Functions ..
193  INTRINSIC abs, cmplx, max, min
194 * ..
195 * .. Executable Statements ..
196 *
197  mn = min( m, n )
198  IF( lwork.LT.max( m+mn, mn*nrhs, 2*n+m ) ) THEN
199  CALL xerbla( 'CQRT15', 16 )
200  RETURN
201  END IF
202 *
203  smlnum = slamch( 'Safe minimum' )
204  bignum = one / smlnum
205  CALL slabad( smlnum, bignum )
206  eps = slamch( 'Epsilon' )
207  smlnum = ( smlnum / eps ) / eps
208  bignum = one / smlnum
209 *
210 * Determine rank and (unscaled) singular values
211 *
212  IF( rksel.EQ.1 ) THEN
213  rank = mn
214  ELSE IF( rksel.EQ.2 ) THEN
215  rank = ( 3*mn ) / 4
216  DO 10 j = rank + 1, mn
217  s( j ) = zero
218  10 CONTINUE
219  ELSE
220  CALL xerbla( 'CQRT15', 2 )
221  END IF
222 *
223  IF( rank.GT.0 ) THEN
224 *
225 * Nontrivial case
226 *
227  s( 1 ) = one
228  DO 30 j = 2, rank
229  20 CONTINUE
230  temp = slarnd( 1, iseed )
231  IF( temp.GT.svmin ) THEN
232  s( j ) = abs( temp )
233  ELSE
234  GO TO 20
235  END IF
236  30 CONTINUE
237  CALL slaord( 'Decreasing', rank, s, 1 )
238 *
239 * Generate 'rank' columns of a random orthogonal matrix in A
240 *
241  CALL clarnv( 2, iseed, m, work )
242  CALL csscal( m, one / scnrm2( m, work, 1 ), work, 1 )
243  CALL claset( 'Full', m, rank, czero, cone, a, lda )
244  CALL clarf( 'Left', m, rank, work, 1, cmplx( two ), a, lda,
245  $ work( m+1 ) )
246 *
247 * workspace used: m+mn
248 *
249 * Generate consistent rhs in the range space of A
250 *
251  CALL clarnv( 2, iseed, rank*nrhs, work )
252  CALL cgemm( 'No transpose', 'No transpose', m, nrhs, rank,
253  $ cone, a, lda, work, rank, czero, b, ldb )
254 *
255 * work space used: <= mn *nrhs
256 *
257 * generate (unscaled) matrix A
258 *
259  DO 40 j = 1, rank
260  CALL csscal( m, s( j ), a( 1, j ), 1 )
261  40 CONTINUE
262  IF( rank.LT.n )
263  $ CALL claset( 'Full', m, n-rank, czero, czero,
264  $ a( 1, rank+1 ), lda )
265  CALL claror( 'Right', 'No initialization', m, n, a, lda, iseed,
266  $ work, info )
267 *
268  ELSE
269 *
270 * work space used 2*n+m
271 *
272 * Generate null matrix and rhs
273 *
274  DO 50 j = 1, mn
275  s( j ) = zero
276  50 CONTINUE
277  CALL claset( 'Full', m, n, czero, czero, a, lda )
278  CALL claset( 'Full', m, nrhs, czero, czero, b, ldb )
279 *
280  END IF
281 *
282 * Scale the matrix
283 *
284  IF( scale.NE.1 ) THEN
285  norma = clange( 'Max', m, n, a, lda, dummy )
286  IF( norma.NE.zero ) THEN
287  IF( scale.EQ.2 ) THEN
288 *
289 * matrix scaled up
290 *
291  CALL clascl( 'General', 0, 0, norma, bignum, m, n, a,
292  $ lda, info )
293  CALL slascl( 'General', 0, 0, norma, bignum, mn, 1, s,
294  $ mn, info )
295  CALL clascl( 'General', 0, 0, norma, bignum, m, nrhs, b,
296  $ ldb, info )
297  ELSE IF( scale.EQ.3 ) THEN
298 *
299 * matrix scaled down
300 *
301  CALL clascl( 'General', 0, 0, norma, smlnum, m, n, a,
302  $ lda, info )
303  CALL slascl( 'General', 0, 0, norma, smlnum, mn, 1, s,
304  $ mn, info )
305  CALL clascl( 'General', 0, 0, norma, smlnum, m, nrhs, b,
306  $ ldb, info )
307  ELSE
308  CALL xerbla( 'CQRT15', 1 )
309  RETURN
310  END IF
311  END IF
312  END IF
313 *
314  norma = sasum( mn, s, 1 )
315  normb = clange( 'One-norm', m, nrhs, b, ldb, dummy )
316 *
317  RETURN
318 *
319 * End of CQRT15
320 *
real function scnrm2(N, X, INCX)
SCNRM2
Definition: scnrm2.f:77
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:108
subroutine claror(SIDE, INIT, M, N, A, LDA, ISEED, X, INFO)
CLAROR
Definition: claror.f:160
subroutine clarnv(IDIST, ISEED, N, X)
CLARNV returns a vector of random numbers from a uniform or normal distribution.
Definition: clarnv.f:101
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:145
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:117
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
real function slarnd(IDIST, ISEED)
SLARND
Definition: slarnd.f:75
real function sasum(N, SX, INCX)
SASUM
Definition: sasum.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:145
real function slamch(CMACH)
SLAMCH
Definition: slamch.f:69
subroutine slabad(SMALL, LARGE)
SLABAD
Definition: slabad.f:76
subroutine slaord(JOB, N, X, INCX)
SLAORD
Definition: slaord.f:75
subroutine clarf(SIDE, M, N, V, INCV, TAU, C, LDC, WORK)
CLARF applies an elementary reflector to a general rectangular matrix.
Definition: clarf.f:130
subroutine cgemm(TRANSA, TRANSB, M, N, K, ALPHA, A, LDA, B, LDB, BETA, C, LDC)
CGEMM
Definition: cgemm.f:189
subroutine csscal(N, SA, CX, INCX)
CSSCAL
Definition: csscal.f:80
Here is the call graph for this function:
Here is the caller graph for this function: