LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
subroutine cqrt04 ( integer  M,
integer  N,
integer  NB,
real, dimension(6)  RESULT 
)

CQRT04

Purpose:
 CQRT04 tests CGEQRT and CGEMQRT.
Parameters
[in]M
          M is INTEGER
          Number of rows in test matrix.
[in]N
          N is INTEGER
          Number of columns in test matrix.
[in]NB
          NB is INTEGER
          Block size of test matrix.  NB <= Min(M,N).
[out]RESULT
          RESULT is REAL array, dimension (6)
          Results of each of the six tests below.

          RESULT(1) = | A - Q R |
          RESULT(2) = | I - Q^H Q |
          RESULT(3) = | Q C - Q C |
          RESULT(4) = | Q^H C - Q^H C |
          RESULT(5) = | C Q - C Q | 
          RESULT(6) = | C Q^H - C Q^H |
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
April 2012

Definition at line 75 of file cqrt04.f.

75  IMPLICIT NONE
76 *
77 * -- LAPACK test routine (version 3.6.1) --
78 * -- LAPACK is a software package provided by Univ. of Tennessee, --
79 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
80 * April 2012
81 *
82 * .. Scalar Arguments ..
83  INTEGER m, n, nb, ldt
84 * .. Return values ..
85  REAL result(6)
86 *
87 * =====================================================================
88 *
89 * ..
90 * .. Local allocatable arrays
91  COMPLEX, ALLOCATABLE :: af(:,:), q(:,:),
92  $ r(:,:), work( : ), t(:,:),
93  $ cf(:,:), df(:,:), a(:,:), c(:,:), d(:,:)
94  REAL, ALLOCATABLE :: rwork(:)
95 *
96 * .. Parameters ..
97  REAL zero
98  COMPLEX one, czero
99  parameter( zero = 0.0, one = (1.0,0.0), czero=(0.0,0.0) )
100 * ..
101 * .. Local Scalars ..
102  INTEGER info, j, k, l, lwork
103  REAL anorm, eps, resid, cnorm, dnorm
104 * ..
105 * .. Local Arrays ..
106  INTEGER iseed( 4 )
107 * ..
108 * .. External Functions ..
109  REAL slamch
110  REAL clange, clansy
111  LOGICAL lsame
112  EXTERNAL slamch, clange, clansy, lsame
113 * ..
114 * .. Intrinsic Functions ..
115  INTRINSIC max, min
116 * ..
117 * .. Data statements ..
118  DATA iseed / 1988, 1989, 1990, 1991 /
119 *
120  eps = slamch( 'Epsilon' )
121  k = min(m,n)
122  l = max(m,n)
123  lwork = max(2,l)*max(2,l)*nb
124 *
125 * Dynamically allocate local arrays
126 *
127  ALLOCATE ( a(m,n), af(m,n), q(m,m), r(m,l), rwork(l),
128  $ work(lwork), t(nb,n), c(m,n), cf(m,n),
129  $ d(n,m), df(n,m) )
130 *
131 * Put random numbers into A and copy to AF
132 *
133  ldt=nb
134  DO j=1,n
135  CALL clarnv( 2, iseed, m, a( 1, j ) )
136  END DO
137  CALL clacpy( 'Full', m, n, a, m, af, m )
138 *
139 * Factor the matrix A in the array AF.
140 *
141  CALL cgeqrt( m, n, nb, af, m, t, ldt, work, info )
142 *
143 * Generate the m-by-m matrix Q
144 *
145  CALL claset( 'Full', m, m, czero, one, q, m )
146  CALL cgemqrt( 'R', 'N', m, m, k, nb, af, m, t, ldt, q, m,
147  $ work, info )
148 *
149 * Copy R
150 *
151  CALL claset( 'Full', m, n, czero, czero, r, m )
152  CALL clacpy( 'Upper', m, n, af, m, r, m )
153 *
154 * Compute |R - Q'*A| / |A| and store in RESULT(1)
155 *
156  CALL cgemm( 'C', 'N', m, n, m, -one, q, m, a, m, one, r, m )
157  anorm = clange( '1', m, n, a, m, rwork )
158  resid = clange( '1', m, n, r, m, rwork )
159  IF( anorm.GT.zero ) THEN
160  result( 1 ) = resid / (eps*max(1,m)*anorm)
161  ELSE
162  result( 1 ) = zero
163  END IF
164 *
165 * Compute |I - Q'*Q| and store in RESULT(2)
166 *
167  CALL claset( 'Full', m, m, czero, one, r, m )
168  CALL cherk( 'U', 'C', m, m, REAL(-ONE), q, m, REAL(ONE), r, m )
169  resid = clansy( '1', 'Upper', m, r, m, rwork )
170  result( 2 ) = resid / (eps*max(1,m))
171 *
172 * Generate random m-by-n matrix C and a copy CF
173 *
174  DO j=1,n
175  CALL clarnv( 2, iseed, m, c( 1, j ) )
176  END DO
177  cnorm = clange( '1', m, n, c, m, rwork)
178  CALL clacpy( 'Full', m, n, c, m, cf, m )
179 *
180 * Apply Q to C as Q*C
181 *
182  CALL cgemqrt( 'L', 'N', m, n, k, nb, af, m, t, nb, cf, m,
183  $ work, info)
184 *
185 * Compute |Q*C - Q*C| / |C|
186 *
187  CALL cgemm( 'N', 'N', m, n, m, -one, q, m, c, m, one, cf, m )
188  resid = clange( '1', m, n, cf, m, rwork )
189  IF( cnorm.GT.zero ) THEN
190  result( 3 ) = resid / (eps*max(1,m)*cnorm)
191  ELSE
192  result( 3 ) = zero
193  END IF
194 *
195 * Copy C into CF again
196 *
197  CALL clacpy( 'Full', m, n, c, m, cf, m )
198 *
199 * Apply Q to C as QT*C
200 *
201  CALL cgemqrt( 'L', 'C', m, n, k, nb, af, m, t, nb, cf, m,
202  $ work, info)
203 *
204 * Compute |QT*C - QT*C| / |C|
205 *
206  CALL cgemm( 'C', 'N', m, n, m, -one, q, m, c, m, one, cf, m )
207  resid = clange( '1', m, n, cf, m, rwork )
208  IF( cnorm.GT.zero ) THEN
209  result( 4 ) = resid / (eps*max(1,m)*cnorm)
210  ELSE
211  result( 4 ) = zero
212  END IF
213 *
214 * Generate random n-by-m matrix D and a copy DF
215 *
216  DO j=1,m
217  CALL clarnv( 2, iseed, n, d( 1, j ) )
218  END DO
219  dnorm = clange( '1', n, m, d, n, rwork)
220  CALL clacpy( 'Full', n, m, d, n, df, n )
221 *
222 * Apply Q to D as D*Q
223 *
224  CALL cgemqrt( 'R', 'N', n, m, k, nb, af, m, t, nb, df, n,
225  $ work, info)
226 *
227 * Compute |D*Q - D*Q| / |D|
228 *
229  CALL cgemm( 'N', 'N', n, m, m, -one, d, n, q, m, one, df, n )
230  resid = clange( '1', n, m, df, n, rwork )
231  IF( cnorm.GT.zero ) THEN
232  result( 5 ) = resid / (eps*max(1,m)*dnorm)
233  ELSE
234  result( 5 ) = zero
235  END IF
236 *
237 * Copy D into DF again
238 *
239  CALL clacpy( 'Full', n, m, d, n, df, n )
240 *
241 * Apply Q to D as D*QT
242 *
243  CALL cgemqrt( 'R', 'C', n, m, k, nb, af, m, t, nb, df, n,
244  $ work, info)
245 *
246 * Compute |D*QT - D*QT| / |D|
247 *
248  CALL cgemm( 'N', 'C', n, m, m, -one, d, n, q, m, one, df, n )
249  resid = clange( '1', n, m, df, n, rwork )
250  IF( cnorm.GT.zero ) THEN
251  result( 6 ) = resid / (eps*max(1,m)*dnorm)
252  ELSE
253  result( 6 ) = zero
254  END IF
255 *
256 * Deallocate all arrays
257 *
258  DEALLOCATE ( a, af, q, r, rwork, work, t, c, d, cf, df)
259 *
260  RETURN
subroutine cherk(UPLO, TRANS, N, K, ALPHA, A, LDA, BETA, C, LDC)
CHERK
Definition: cherk.f:175
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 clarnv(IDIST, ISEED, N, X)
CLARNV returns a vector of random numbers from a uniform or normal distribution.
Definition: clarnv.f:101
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 cgemqrt(SIDE, TRANS, M, N, K, NB, V, LDV, T, LDT, C, LDC, WORK, INFO)
CGEMQRT
Definition: cgemqrt.f:170
real function clansy(NORM, UPLO, N, A, LDA, WORK)
CLANSY 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: clansy.f:125
subroutine clacpy(UPLO, M, N, A, LDA, B, LDB)
CLACPY copies all or part of one two-dimensional array to another.
Definition: clacpy.f:105
real function slamch(CMACH)
SLAMCH
Definition: slamch.f:69
subroutine cgemm(TRANSA, TRANSB, M, N, K, ALPHA, A, LDA, B, LDB, BETA, C, LDC)
CGEMM
Definition: cgemm.f:189
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55
subroutine cgeqrt(M, N, NB, A, LDA, T, LDT, WORK, INFO)
CGEQRT
Definition: cgeqrt.f:143

Here is the call graph for this function:

Here is the caller graph for this function: