LAPACK  3.10.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.

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  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  IF( rank.LT.n )
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  IF( scale.NE.1 ) THEN
282  norma = clange( 'Max', m, n, a, lda, dummy )
283  IF( norma.NE.zero ) THEN
284  IF( scale.EQ.2 ) 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  ELSE IF( scale.EQ.3 ) 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 *
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 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 claror(SIDE, INIT, M, N, A, LDA, ISEED, X, INFO)
CLAROR
Definition: claror.f:158
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:115
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 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 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 clarnv(IDIST, ISEED, N, X)
CLARNV returns a vector of random numbers from a uniform or normal distribution.
Definition: clarnv.f:99
real function slarnd(IDIST, ISEED)
SLARND
Definition: slarnd.f:73
real(wp) function scnrm2(n, x, incx)
SCNRM2
Definition: scnrm2.f90:90
real function sasum(N, SX, INCX)
SASUM
Definition: sasum.f:72
subroutine slaord(JOB, N, X, INCX)
SLAORD
Definition: slaord.f:73
real function slamch(CMACH)
SLAMCH
Definition: slamch.f:68
Here is the call graph for this function:
Here is the caller graph for this function: