LAPACK  3.8.0
LAPACK: Linear Algebra PACKage

◆ zunt01()

subroutine zunt01 ( character  ROWCOL,
integer  M,
integer  N,
complex*16, dimension( ldu, * )  U,
integer  LDU,
complex*16, dimension( * )  WORK,
integer  LWORK,
double precision, dimension( * )  RWORK,
double precision  RESID 
)

ZUNT01

Purpose:
 ZUNT01 checks that the matrix U is unitary by computing the ratio

    RESID = norm( I - U*U' ) / ( n * EPS ), if ROWCOL = 'R',
 or
    RESID = norm( I - U'*U ) / ( m * EPS ), if ROWCOL = 'C'.

 Alternatively, if there isn't sufficient workspace to form
 I - U*U' or I - U'*U, the ratio is computed as

    RESID = abs( I - U*U' ) / ( n * EPS ), if ROWCOL = 'R',
 or
    RESID = abs( I - U'*U ) / ( m * EPS ), if ROWCOL = 'C'.

 where EPS is the machine precision.  ROWCOL is used only if m = n;
 if m > n, ROWCOL is assumed to be 'C', and if m < n, ROWCOL is
 assumed to be 'R'.
Parameters
[in]ROWCOL
          ROWCOL is CHARACTER
          Specifies whether the rows or columns of U should be checked
          for orthogonality.  Used only if M = N.
          = 'R':  Check for orthogonal rows of U
          = 'C':  Check for orthogonal columns of U
[in]M
          M is INTEGER
          The number of rows of the matrix U.
[in]N
          N is INTEGER
          The number of columns of the matrix U.
[in]U
          U is COMPLEX*16 array, dimension (LDU,N)
          The unitary matrix U.  U is checked for orthogonal columns
          if m > n or if m = n and ROWCOL = 'C'.  U is checked for
          orthogonal rows if m < n or if m = n and ROWCOL = 'R'.
[in]LDU
          LDU is INTEGER
          The leading dimension of the array U.  LDU >= max(1,M).
[out]WORK
          WORK is COMPLEX*16 array, dimension (LWORK)
[in]LWORK
          LWORK is INTEGER
          The length of the array WORK.  For best performance, LWORK
          should be at least N*N if ROWCOL = 'C' or M*M if
          ROWCOL = 'R', but the test will be done even if LWORK is 0.
[out]RWORK
          RWORK is DOUBLE PRECISION array, dimension (min(M,N))
          Used only if LWORK is large enough to use the Level 3 BLAS
          code.
[out]RESID
          RESID is DOUBLE PRECISION
          RESID = norm( I - U * U' ) / ( n * EPS ), if ROWCOL = 'R', or
          RESID = norm( I - U' * U ) / ( m * EPS ), if ROWCOL = 'C'.
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
December 2016

Definition at line 128 of file zunt01.f.

128 *
129 * -- LAPACK test routine (version 3.7.0) --
130 * -- LAPACK is a software package provided by Univ. of Tennessee, --
131 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
132 * December 2016
133 *
134 * .. Scalar Arguments ..
135  CHARACTER rowcol
136  INTEGER ldu, lwork, m, n
137  DOUBLE PRECISION resid
138 * ..
139 * .. Array Arguments ..
140  DOUBLE PRECISION rwork( * )
141  COMPLEX*16 u( ldu, * ), work( * )
142 * ..
143 *
144 * =====================================================================
145 *
146 * .. Parameters ..
147  DOUBLE PRECISION zero, one
148  parameter( zero = 0.0d+0, one = 1.0d+0 )
149 * ..
150 * .. Local Scalars ..
151  CHARACTER transu
152  INTEGER i, j, k, ldwork, mnmin
153  DOUBLE PRECISION eps
154  COMPLEX*16 tmp, zdum
155 * ..
156 * .. External Functions ..
157  LOGICAL lsame
158  DOUBLE PRECISION dlamch, zlansy
159  COMPLEX*16 zdotc
160  EXTERNAL lsame, dlamch, zlansy, zdotc
161 * ..
162 * .. External Subroutines ..
163  EXTERNAL zherk, zlaset
164 * ..
165 * .. Intrinsic Functions ..
166  INTRINSIC abs, dble, dcmplx, dimag, max, min
167 * ..
168 * .. Statement Functions ..
169  DOUBLE PRECISION cabs1
170 * ..
171 * .. Statement Function definitions ..
172  cabs1( zdum ) = abs( dble( zdum ) ) + abs( dimag( zdum ) )
173 * ..
174 * .. Executable Statements ..
175 *
176  resid = zero
177 *
178 * Quick return if possible
179 *
180  IF( m.LE.0 .OR. n.LE.0 )
181  $ RETURN
182 *
183  eps = dlamch( 'Precision' )
184  IF( m.LT.n .OR. ( m.EQ.n .AND. lsame( rowcol, 'R' ) ) ) THEN
185  transu = 'N'
186  k = n
187  ELSE
188  transu = 'C'
189  k = m
190  END IF
191  mnmin = min( m, n )
192 *
193  IF( ( mnmin+1 )*mnmin.LE.lwork ) THEN
194  ldwork = mnmin
195  ELSE
196  ldwork = 0
197  END IF
198  IF( ldwork.GT.0 ) THEN
199 *
200 * Compute I - U*U' or I - U'*U.
201 *
202  CALL zlaset( 'Upper', mnmin, mnmin, dcmplx( zero ),
203  $ dcmplx( one ), work, ldwork )
204  CALL zherk( 'Upper', transu, mnmin, k, -one, u, ldu, one, work,
205  $ ldwork )
206 *
207 * Compute norm( I - U*U' ) / ( K * EPS ) .
208 *
209  resid = zlansy( '1', 'Upper', mnmin, work, ldwork, rwork )
210  resid = ( resid / dble( k ) ) / eps
211  ELSE IF( transu.EQ.'C' ) THEN
212 *
213 * Find the maximum element in abs( I - U'*U ) / ( m * EPS )
214 *
215  DO 20 j = 1, n
216  DO 10 i = 1, j
217  IF( i.NE.j ) THEN
218  tmp = zero
219  ELSE
220  tmp = one
221  END IF
222  tmp = tmp - zdotc( m, u( 1, i ), 1, u( 1, j ), 1 )
223  resid = max( resid, cabs1( tmp ) )
224  10 CONTINUE
225  20 CONTINUE
226  resid = ( resid / dble( m ) ) / eps
227  ELSE
228 *
229 * Find the maximum element in abs( I - U*U' ) / ( n * EPS )
230 *
231  DO 40 j = 1, m
232  DO 30 i = 1, j
233  IF( i.NE.j ) THEN
234  tmp = zero
235  ELSE
236  tmp = one
237  END IF
238  tmp = tmp - zdotc( n, u( j, 1 ), ldu, u( i, 1 ), ldu )
239  resid = max( resid, cabs1( tmp ) )
240  30 CONTINUE
241  40 CONTINUE
242  resid = ( resid / dble( n ) ) / eps
243  END IF
244  RETURN
245 *
246 * End of ZUNT01
247 *
double precision function dlamch(CMACH)
DLAMCH
Definition: dlamch.f:65
complex *16 function zdotc(N, ZX, INCX, ZY, INCY)
ZDOTC
Definition: zdotc.f:85
double precision function zlansy(NORM, UPLO, N, A, LDA, WORK)
ZLANSY returns the value of the 1-norm, or the Frobenius norm, or the infinity norm, or the element of largest absolute value of a complex symmetric matrix.
Definition: zlansy.f:125
subroutine zlaset(UPLO, M, N, ALPHA, BETA, A, LDA)
ZLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values...
Definition: zlaset.f:108
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55
subroutine zherk(UPLO, TRANS, N, K, ALPHA, A, LDA, BETA, C, LDC)
ZHERK
Definition: zherk.f:175
Here is the call graph for this function:
Here is the caller graph for this function: