LAPACK  3.8.0
LAPACK: Linear Algebra PACKage

◆ slqt05()

subroutine slqt05 ( integer  M,
integer  N,
integer  L,
integer  NB,
real, dimension(6)  RESULT 
)
Purpose:

SQRT05 tests STPLQT and STPMLQT.

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 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 slqt05.f.

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