LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
double precision function zqrt14 ( character  TRANS,
integer  M,
integer  N,
integer  NRHS,
complex*16, dimension( lda, * )  A,
integer  LDA,
complex*16, dimension( ldx, * )  X,
integer  LDX,
complex*16, dimension( lwork )  WORK,
integer  LWORK 
)

ZQRT14

Purpose:
 ZQRT14 checks whether X is in the row space of A or A'.  It does so
 by scaling both X and A such that their norms are in the range
 [sqrt(eps), 1/sqrt(eps)], then computing a QR factorization of [A,X]
 (if TRANS = 'C') or an LQ factorization of [A',X]' (if TRANS = 'N'),
 and returning the norm of the trailing triangle, scaled by
 MAX(M,N,NRHS)*eps.
Parameters
[in]TRANS
          TRANS is CHARACTER*1
          = 'N':  No transpose, check for X in the row space of A
          = 'C':  Conjugate transpose, check for X in row space of A'.
[in]M
          M is INTEGER
          The number of rows of the matrix A.
[in]N
          N is INTEGER
          The number of columns of the matrix A.
[in]NRHS
          NRHS is INTEGER
          The number of right hand sides, i.e., the number of columns
          of X.
[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.
[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.
[out]WORK
          WORK is COMPLEX*16 array dimension (LWORK)
[in]LWORK
          LWORK is INTEGER
          length of workspace array required
          If TRANS = 'N', LWORK >= (M+NRHS)*(N+2);
          if TRANS = 'C', LWORK >= (N+NRHS)*(M+2).
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
November 2011

Definition at line 118 of file zqrt14.f.

118 *
119 * -- LAPACK test routine (version 3.4.0) --
120 * -- LAPACK is a software package provided by Univ. of Tennessee, --
121 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
122 * November 2011
123 *
124 * .. Scalar Arguments ..
125  CHARACTER trans
126  INTEGER lda, ldx, lwork, m, n, nrhs
127 * ..
128 * .. Array Arguments ..
129  COMPLEX*16 a( lda, * ), work( lwork ), x( ldx, * )
130 * ..
131 *
132 * =====================================================================
133 *
134 * .. Parameters ..
135  DOUBLE PRECISION zero, one
136  parameter ( zero = 0.0d0, one = 1.0d0 )
137 * ..
138 * .. Local Scalars ..
139  LOGICAL tpsd
140  INTEGER i, info, j, ldwork
141  DOUBLE PRECISION anrm, err, xnrm
142 * ..
143 * .. Local Arrays ..
144  DOUBLE PRECISION rwork( 1 )
145 * ..
146 * .. External Functions ..
147  LOGICAL lsame
148  DOUBLE PRECISION dlamch, zlange
149  EXTERNAL lsame, dlamch, zlange
150 * ..
151 * .. External Subroutines ..
152  EXTERNAL xerbla, zgelq2, zgeqr2, zlacpy, zlascl
153 * ..
154 * .. Intrinsic Functions ..
155  INTRINSIC abs, dble, dconjg, max, min
156 * ..
157 * .. Executable Statements ..
158 *
159  zqrt14 = zero
160  IF( lsame( trans, 'N' ) ) THEN
161  ldwork = m + nrhs
162  tpsd = .false.
163  IF( lwork.LT.( m+nrhs )*( n+2 ) ) THEN
164  CALL xerbla( 'ZQRT14', 10 )
165  RETURN
166  ELSE IF( n.LE.0 .OR. nrhs.LE.0 ) THEN
167  RETURN
168  END IF
169  ELSE IF( lsame( trans, 'C' ) ) THEN
170  ldwork = m
171  tpsd = .true.
172  IF( lwork.LT.( n+nrhs )*( m+2 ) ) THEN
173  CALL xerbla( 'ZQRT14', 10 )
174  RETURN
175  ELSE IF( m.LE.0 .OR. nrhs.LE.0 ) THEN
176  RETURN
177  END IF
178  ELSE
179  CALL xerbla( 'ZQRT14', 1 )
180  RETURN
181  END IF
182 *
183 * Copy and scale A
184 *
185  CALL zlacpy( 'All', m, n, a, lda, work, ldwork )
186  anrm = zlange( 'M', m, n, work, ldwork, rwork )
187  IF( anrm.NE.zero )
188  $ CALL zlascl( 'G', 0, 0, anrm, one, m, n, work, ldwork, info )
189 *
190 * Copy X or X' into the right place and scale it
191 *
192  IF( tpsd ) THEN
193 *
194 * Copy X into columns n+1:n+nrhs of work
195 *
196  CALL zlacpy( 'All', m, nrhs, x, ldx, work( n*ldwork+1 ),
197  $ ldwork )
198  xnrm = zlange( 'M', m, nrhs, work( n*ldwork+1 ), ldwork,
199  $ rwork )
200  IF( xnrm.NE.zero )
201  $ CALL zlascl( 'G', 0, 0, xnrm, one, m, nrhs,
202  $ work( n*ldwork+1 ), ldwork, info )
203  anrm = zlange( 'One-norm', m, n+nrhs, work, ldwork, rwork )
204 *
205 * Compute QR factorization of X
206 *
207  CALL zgeqr2( m, n+nrhs, work, ldwork,
208  $ work( ldwork*( n+nrhs )+1 ),
209  $ work( ldwork*( n+nrhs )+min( m, n+nrhs )+1 ),
210  $ info )
211 *
212 * Compute largest entry in upper triangle of
213 * work(n+1:m,n+1:n+nrhs)
214 *
215  err = zero
216  DO 20 j = n + 1, n + nrhs
217  DO 10 i = n + 1, min( m, j )
218  err = max( err, abs( work( i+( j-1 )*m ) ) )
219  10 CONTINUE
220  20 CONTINUE
221 *
222  ELSE
223 *
224 * Copy X' into rows m+1:m+nrhs of work
225 *
226  DO 40 i = 1, n
227  DO 30 j = 1, nrhs
228  work( m+j+( i-1 )*ldwork ) = dconjg( x( i, j ) )
229  30 CONTINUE
230  40 CONTINUE
231 *
232  xnrm = zlange( 'M', nrhs, n, work( m+1 ), ldwork, rwork )
233  IF( xnrm.NE.zero )
234  $ CALL zlascl( 'G', 0, 0, xnrm, one, nrhs, n, work( m+1 ),
235  $ ldwork, info )
236 *
237 * Compute LQ factorization of work
238 *
239  CALL zgelq2( ldwork, n, work, ldwork, work( ldwork*n+1 ),
240  $ work( ldwork*( n+1 )+1 ), info )
241 *
242 * Compute largest entry in lower triangle in
243 * work(m+1:m+nrhs,m+1:n)
244 *
245  err = zero
246  DO 60 j = m + 1, n
247  DO 50 i = j, ldwork
248  err = max( err, abs( work( i+( j-1 )*ldwork ) ) )
249  50 CONTINUE
250  60 CONTINUE
251 *
252  END IF
253 *
254  zqrt14 = err / ( dble( max( m, n, nrhs ) )*dlamch( 'Epsilon' ) )
255 *
256  RETURN
257 *
258 * End of ZQRT14
259 *
subroutine zlacpy(UPLO, M, N, A, LDA, B, LDB)
ZLACPY copies all or part of one two-dimensional array to another.
Definition: zlacpy.f:105
double precision function dlamch(CMACH)
DLAMCH
Definition: dlamch.f:65
double precision function zqrt14(TRANS, M, N, NRHS, A, LDA, X, LDX, WORK, LWORK)
ZQRT14
Definition: zqrt14.f:118
subroutine zgelq2(M, N, A, LDA, TAU, WORK, INFO)
ZGELQ2 computes the LQ factorization of a general rectangular matrix using an unblocked algorithm...
Definition: zgelq2.f:123
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
subroutine zgeqr2(M, N, A, LDA, TAU, WORK, INFO)
ZGEQR2 computes the QR factorization of a general rectangular matrix using an unblocked algorithm...
Definition: zgeqr2.f:123
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:117
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:145
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55

Here is the call graph for this function: