LAPACK  3.9.1
LAPACK: Linear Algebra PACKage

◆ zqrt17()

double precision function zqrt17 ( character  TRANS,
integer  IRESID,
integer  M,
integer  N,
integer  NRHS,
complex*16, dimension( lda, * )  A,
integer  LDA,
complex*16, dimension( ldx, * )  X,
integer  LDX,
complex*16, dimension( ldb, * )  B,
integer  LDB,
complex*16, dimension( ldb, * )  C,
complex*16, dimension( lwork )  WORK,
integer  LWORK 
)

ZQRT17

Purpose:
 ZQRT17 computes the ratio

    || R'*op(A) ||/(||A||*alpha*max(M,N,NRHS)*eps)

 where R = op(A)*X - B, op(A) is A or A', and

    alpha = ||B|| if IRESID = 1 (zero-residual problem)
    alpha = ||R|| if IRESID = 2 (otherwise).
Parameters
[in]TRANS
          TRANS is CHARACTER*1
          Specifies whether or not the transpose of A is used.
          = 'N':  No transpose, op(A) = A.
          = 'C':  Conjugate transpose, op(A) = A'.
[in]IRESID
          IRESID is INTEGER
          IRESID = 1 indicates zero-residual problem.
          IRESID = 2 indicates non-zero residual.
[in]M
          M is INTEGER
          The number of rows of the matrix A.
          If TRANS = 'N', the number of rows of the matrix B.
          If TRANS = 'C', the number of rows of the matrix X.
[in]N
          N is INTEGER
          The number of columns of the matrix  A.
          If TRANS = 'N', the number of rows of the matrix X.
          If TRANS = 'C', the number of rows of the matrix B.
[in]NRHS
          NRHS is INTEGER
          The number of columns of the matrices X and B.
[in]A
          A is COMPLEX*16 array, dimension (LDA,N)
          The m-by-n matrix A.
[in]LDA
          LDA is INTEGER
          The leading dimension of the array A. LDA >= M.
[in]X
          X is COMPLEX*16 array, dimension (LDX,NRHS)
          If TRANS = 'N', the n-by-nrhs matrix X.
          If TRANS = 'C', the m-by-nrhs matrix X.
[in]LDX
          LDX is INTEGER
          The leading dimension of the array X.
          If TRANS = 'N', LDX >= N.
          If TRANS = 'C', LDX >= M.
[in]B
          B is COMPLEX*16 array, dimension (LDB,NRHS)
          If TRANS = 'N', the m-by-nrhs matrix B.
          If TRANS = 'C', the n-by-nrhs matrix B.
[in]LDB
          LDB is INTEGER
          The leading dimension of the array B.
          If TRANS = 'N', LDB >= M.
          If TRANS = 'C', LDB >= N.
[out]C
          C is COMPLEX*16 array, dimension (LDB,NRHS)
[out]WORK
          WORK is COMPLEX*16 array, dimension (LWORK)
[in]LWORK
          LWORK is INTEGER
          The length of the array WORK.  LWORK >= NRHS*(M+N).
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.

Definition at line 148 of file zqrt17.f.

150 *
151 * -- LAPACK test routine --
152 * -- LAPACK is a software package provided by Univ. of Tennessee, --
153 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
154 *
155 * .. Scalar Arguments ..
156  CHARACTER TRANS
157  INTEGER IRESID, LDA, LDB, LDX, LWORK, M, N, NRHS
158 * ..
159 * .. Array Arguments ..
160  COMPLEX*16 A( LDA, * ), B( LDB, * ), C( LDB, * ),
161  $ WORK( LWORK ), X( LDX, * )
162 * ..
163 *
164 * =====================================================================
165 *
166 * .. Parameters ..
167  DOUBLE PRECISION ZERO, ONE
168  parameter( zero = 0.0d0, one = 1.0d0 )
169 * ..
170 * .. Local Scalars ..
171  INTEGER INFO, ISCL, NCOLS, NROWS
172  DOUBLE PRECISION BIGNUM, ERR, NORMA, NORMB, NORMRS, SMLNUM
173 * ..
174 * .. Local Arrays ..
175  DOUBLE PRECISION RWORK( 1 )
176 * ..
177 * .. External Functions ..
178  LOGICAL LSAME
179  DOUBLE PRECISION DLAMCH, ZLANGE
180  EXTERNAL lsame, dlamch, zlange
181 * ..
182 * .. External Subroutines ..
183  EXTERNAL xerbla, zgemm, zlacpy, zlascl
184 * ..
185 * .. Intrinsic Functions ..
186  INTRINSIC dble, dcmplx, max
187 * ..
188 * .. Executable Statements ..
189 *
190  zqrt17 = zero
191 *
192  IF( lsame( trans, 'N' ) ) THEN
193  nrows = m
194  ncols = n
195  ELSE IF( lsame( trans, 'C' ) ) THEN
196  nrows = n
197  ncols = m
198  ELSE
199  CALL xerbla( 'ZQRT17', 1 )
200  RETURN
201  END IF
202 *
203  IF( lwork.LT.ncols*nrhs ) THEN
204  CALL xerbla( 'ZQRT17', 13 )
205  RETURN
206  END IF
207 *
208  IF( m.LE.0 .OR. n.LE.0 .OR. nrhs.LE.0 )
209  $ RETURN
210 *
211  norma = zlange( 'One-norm', m, n, a, lda, rwork )
212  smlnum = dlamch( 'Safe minimum' ) / dlamch( 'Precision' )
213  bignum = one / smlnum
214  iscl = 0
215 *
216 * compute residual and scale it
217 *
218  CALL zlacpy( 'All', nrows, nrhs, b, ldb, c, ldb )
219  CALL zgemm( trans, 'No transpose', nrows, nrhs, ncols,
220  $ dcmplx( -one ), a, lda, x, ldx, dcmplx( one ), c,
221  $ ldb )
222  normrs = zlange( 'Max', nrows, nrhs, c, ldb, rwork )
223  IF( normrs.GT.smlnum ) THEN
224  iscl = 1
225  CALL zlascl( 'General', 0, 0, normrs, one, nrows, nrhs, c, ldb,
226  $ info )
227  END IF
228 *
229 * compute R'*A
230 *
231  CALL zgemm( 'Conjugate transpose', trans, nrhs, ncols, nrows,
232  $ dcmplx( one ), c, ldb, a, lda, dcmplx( zero ), work,
233  $ nrhs )
234 *
235 * compute and properly scale error
236 *
237  err = zlange( 'One-norm', nrhs, ncols, work, nrhs, rwork )
238  IF( norma.NE.zero )
239  $ err = err / norma
240 *
241  IF( iscl.EQ.1 )
242  $ err = err*normrs
243 *
244  IF( iresid.EQ.1 ) THEN
245  normb = zlange( 'One-norm', nrows, nrhs, b, ldb, rwork )
246  IF( normb.NE.zero )
247  $ err = err / normb
248  ELSE
249  IF( normrs.NE.zero )
250  $ err = err / normrs
251  END IF
252 *
253  zqrt17 = err / ( dlamch( 'Epsilon' )*dble( max( m, n, nrhs ) ) )
254  RETURN
255 *
256 * End of ZQRT17
257 *
double precision function dlamch(CMACH)
DLAMCH
Definition: dlamch.f:69
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:60
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:53
subroutine zgemm(TRANSA, TRANSB, M, N, K, ALPHA, A, LDA, B, LDB, BETA, C, LDC)
ZGEMM
Definition: zgemm.f:187
double precision function zqrt17(TRANS, IRESID, M, N, NRHS, A, LDA, X, LDX, B, LDB, C, WORK, LWORK)
ZQRT17
Definition: zqrt17.f:150
double precision function zlange(NORM, M, N, A, LDA, WORK)
ZLANGE returns the value of the 1-norm, Frobenius norm, infinity-norm, or the largest absolute value ...
Definition: zlange.f:115
subroutine zlascl(TYPE, KL, KU, CFROM, CTO, M, N, A, LDA, INFO)
ZLASCL multiplies a general rectangular matrix by a real scalar defined as cto/cfrom.
Definition: zlascl.f:143
subroutine zlacpy(UPLO, M, N, A, LDA, B, LDB)
ZLACPY copies all or part of one two-dimensional array to another.
Definition: zlacpy.f:103
Here is the call graph for this function: