LAPACK  3.8.0
LAPACK: Linear Algebra PACKage

◆ dqrt05()

subroutine dqrt05 ( integer  M,
integer  N,
integer  L,
integer  NB,
double precision, dimension(6)  RESULT 
)

DQRT05

Purpose:
 DQRT05 tests DTPQRT and DTPMQRT.
Parameters
[in]M
          M is INTEGER
          Number of rows in lower part of the test matrix.
[in]N
          N is INTEGER
          Number of columns in test matrix.
[in]L
          L is INTEGER
          The number of rows of the upper trapezoidal part the
          lower test matrix.  0 <= L <= M.
[in]NB
          NB is INTEGER
          Block size of test matrix.  NB <= N.
[out]RESULT
          RESULT is DOUBLE PRECISION 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 82 of file dqrt05.f.

82  IMPLICIT NONE
83 *
84 * -- LAPACK test routine (version 3.7.0) --
85 * -- LAPACK is a software package provided by Univ. of Tennessee, --
86 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
87 * April 2012
88 *
89 * .. Scalar Arguments ..
90  INTEGER lwork, m, n, l, nb, ldt
91 * .. Return values ..
92  DOUBLE PRECISION result(6)
93 *
94 * =====================================================================
95 *
96 * ..
97 * .. Local allocatable arrays
98  DOUBLE PRECISION, ALLOCATABLE :: af(:,:), q(:,:),
99  $ r(:,:), rwork(:), work( : ), t(:,:),
100  $ cf(:,:), df(:,:), a(:,:), c(:,:), d(:,:)
101 *
102 * .. Parameters ..
103  DOUBLE PRECISION one, zero
104  parameter( zero = 0.0, one = 1.0 )
105 * ..
106 * .. Local Scalars ..
107  INTEGER info, j, k, m2, np1
108  DOUBLE PRECISION anorm, eps, resid, cnorm, dnorm
109 * ..
110 * .. Local Arrays ..
111  INTEGER iseed( 4 )
112 * ..
113 * .. External Functions ..
114  DOUBLE PRECISION dlamch, dlange, dlansy
115  LOGICAL lsame
116  EXTERNAL dlamch, dlange, dlansy, lsame
117 * ..
118 * .. Data statements ..
119  DATA iseed / 1988, 1989, 1990, 1991 /
120 *
121  eps = dlamch( 'Epsilon' )
122  k = n
123  m2 = m+n
124  IF( m.GT.0 ) THEN
125  np1 = n+1
126  ELSE
127  np1 = 1
128  END IF
129  lwork = m2*m2*nb
130 *
131 * Dynamically allocate all arrays
132 *
133  ALLOCATE(a(m2,n),af(m2,n),q(m2,m2),r(m2,m2),rwork(m2),
134  $ work(lwork),t(nb,n),c(m2,n),cf(m2,n),
135  $ d(n,m2),df(n,m2) )
136 *
137 * Put random stuff into A
138 *
139  ldt=nb
140  CALL dlaset( 'Full', m2, n, zero, zero, a, m2 )
141  CALL dlaset( 'Full', nb, n, zero, zero, t, nb )
142  DO j=1,n
143  CALL dlarnv( 2, iseed, j, a( 1, j ) )
144  END DO
145  IF( m.GT.0 ) THEN
146  DO j=1,n
147  CALL dlarnv( 2, iseed, m-l, a( min(n+m,n+1), j ) )
148  END DO
149  END IF
150  IF( l.GT.0 ) THEN
151  DO j=1,n
152  CALL dlarnv( 2, iseed, min(j,l), a( min(n+m,n+m-l+1), j ) )
153  END DO
154  END IF
155 *
156 * Copy the matrix A to the array AF.
157 *
158  CALL dlacpy( 'Full', m2, n, a, m2, af, m2 )
159 *
160 * Factor the matrix A in the array AF.
161 *
162  CALL dtpqrt( m,n,l,nb,af,m2,af(np1,1),m2,t,ldt,work,info)
163 *
164 * Generate the (M+N)-by-(M+N) matrix Q by applying H to I
165 *
166  CALL dlaset( 'Full', m2, m2, zero, one, q, m2 )
167  CALL dgemqrt( 'R', 'N', m2, m2, k, nb, af, m2, t, ldt, q, m2,
168  $ work, info )
169 *
170 * Copy R
171 *
172  CALL dlaset( 'Full', m2, n, zero, zero, r, m2 )
173  CALL dlacpy( 'Upper', m2, n, af, m2, r, m2 )
174 *
175 * Compute |R - Q'*A| / |A| and store in RESULT(1)
176 *
177  CALL dgemm( 'T', 'N', m2, n, m2, -one, q, m2, a, m2, one, r, m2 )
178  anorm = dlange( '1', m2, n, a, m2, rwork )
179  resid = dlange( '1', m2, n, r, m2, rwork )
180  IF( anorm.GT.zero ) THEN
181  result( 1 ) = resid / (eps*anorm*max(1,m2))
182  ELSE
183  result( 1 ) = zero
184  END IF
185 *
186 * Compute |I - Q'*Q| and store in RESULT(2)
187 *
188  CALL dlaset( 'Full', m2, m2, zero, one, r, m2 )
189  CALL dsyrk( 'U', 'C', m2, m2, -one, q, m2, one, r, m2 )
190  resid = dlansy( '1', 'Upper', m2, r, m2, rwork )
191  result( 2 ) = resid / (eps*max(1,m2))
192 *
193 * Generate random m-by-n matrix C and a copy CF
194 *
195  DO j=1,n
196  CALL dlarnv( 2, iseed, m2, c( 1, j ) )
197  END DO
198  cnorm = dlange( '1', m2, n, c, m2, rwork)
199  CALL dlacpy( 'Full', m2, n, c, m2, cf, m2 )
200 *
201 * Apply Q to C as Q*C
202 *
203  CALL dtpmqrt( 'L','N', m,n,k,l,nb,af(np1,1),m2,t,ldt,cf,m2,
204  $ cf(np1,1),m2,work,info)
205 *
206 * Compute |Q*C - Q*C| / |C|
207 *
208  CALL dgemm( 'N', 'N', m2, n, m2, -one, q, m2, c, m2, one, cf, m2 )
209  resid = dlange( '1', m2, n, cf, m2, rwork )
210  IF( cnorm.GT.zero ) THEN
211  result( 3 ) = resid / (eps*max(1,m2)*cnorm)
212  ELSE
213  result( 3 ) = zero
214  END IF
215 *
216 * Copy C into CF again
217 *
218  CALL dlacpy( 'Full', m2, n, c, m2, cf, m2 )
219 *
220 * Apply Q to C as QT*C
221 *
222  CALL dtpmqrt( 'L','T',m,n,k,l,nb,af(np1,1),m2,t,ldt,cf,m2,
223  $ cf(np1,1),m2,work,info)
224 *
225 * Compute |QT*C - QT*C| / |C|
226 *
227  CALL dgemm('T','N',m2,n,m2,-one,q,m2,c,m2,one,cf,m2)
228  resid = dlange( '1', m2, n, cf, m2, rwork )
229  IF( cnorm.GT.zero ) THEN
230  result( 4 ) = resid / (eps*max(1,m2)*cnorm)
231  ELSE
232  result( 4 ) = zero
233  END IF
234 *
235 * Generate random n-by-m matrix D and a copy DF
236 *
237  DO j=1,m2
238  CALL dlarnv( 2, iseed, n, d( 1, j ) )
239  END DO
240  dnorm = dlange( '1', n, m2, d, n, rwork)
241  CALL dlacpy( 'Full', n, m2, d, n, df, n )
242 *
243 * Apply Q to D as D*Q
244 *
245  CALL dtpmqrt('R','N',n,m,n,l,nb,af(np1,1),m2,t,ldt,df,n,
246  $ df(1,np1),n,work,info)
247 *
248 * Compute |D*Q - D*Q| / |D|
249 *
250  CALL dgemm('N','N',n,m2,m2,-one,d,n,q,m2,one,df,n)
251  resid = dlange('1',n, m2,df,n,rwork )
252  IF( cnorm.GT.zero ) THEN
253  result( 5 ) = resid / (eps*max(1,m2)*dnorm)
254  ELSE
255  result( 5 ) = zero
256  END IF
257 *
258 * Copy D into DF again
259 *
260  CALL dlacpy('Full',n,m2,d,n,df,n )
261 *
262 * Apply Q to D as D*QT
263 *
264  CALL dtpmqrt('R','T',n,m,n,l,nb,af(np1,1),m2,t,ldt,df,n,
265  $ df(1,np1),n,work,info)
266 
267 *
268 * Compute |D*QT - D*QT| / |D|
269 *
270  CALL dgemm( 'N', 'T', n, m2, m2, -one, d, n, q, m2, one, df, n )
271  resid = dlange( '1', n, m2, df, n, rwork )
272  IF( cnorm.GT.zero ) THEN
273  result( 6 ) = resid / (eps*max(1,m2)*dnorm)
274  ELSE
275  result( 6 ) = zero
276  END IF
277 *
278 * Deallocate all arrays
279 *
280  DEALLOCATE ( a, af, q, r, rwork, work, t, c, d, cf, df)
281  RETURN
subroutine dlacpy(UPLO, M, N, A, LDA, B, LDB)
DLACPY copies all or part of one two-dimensional array to another.
Definition: dlacpy.f:105
double precision function dlamch(CMACH)
DLAMCH
Definition: dlamch.f:65
subroutine dtpmqrt(SIDE, TRANS, M, N, K, L, NB, V, LDV, T, LDT, A, LDA, B, LDB, WORK, INFO)
DTPMQRT
Definition: dtpmqrt.f:218
double precision function dlansy(NORM, UPLO, N, A, LDA, WORK)
DLANSY returns the value of the 1-norm, or the Frobenius norm, or the infinity norm, or the element of largest absolute value of a real symmetric matrix.
Definition: dlansy.f:124
subroutine dgemqrt(SIDE, TRANS, M, N, K, NB, V, LDV, T, LDT, C, LDC, WORK, INFO)
DGEMQRT
Definition: dgemqrt.f:170
subroutine dlarnv(IDIST, ISEED, N, X)
DLARNV returns a vector of random numbers from a uniform or normal distribution.
Definition: dlarnv.f:99
subroutine dlaset(UPLO, M, N, ALPHA, BETA, A, LDA)
DLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values...
Definition: dlaset.f:112
subroutine dgemm(TRANSA, TRANSB, M, N, K, ALPHA, A, LDA, B, LDB, BETA, C, LDC)
DGEMM
Definition: dgemm.f:189
subroutine dtpqrt(M, N, L, NB, A, LDA, B, LDB, T, LDT, WORK, INFO)
DTPQRT
Definition: dtpqrt.f:191
subroutine dsyrk(UPLO, TRANS, N, K, ALPHA, A, LDA, BETA, C, LDC)
DSYRK
Definition: dsyrk.f:171
double precision function dlange(NORM, M, N, A, LDA, WORK)
DLANGE returns the value of the 1-norm, Frobenius norm, infinity-norm, or the largest absolute value ...
Definition: dlange.f:116
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55
Here is the call graph for this function:
Here is the caller graph for this function: