LAPACK  3.8.0
LAPACK: Linear Algebra PACKage

◆ slqt04()

subroutine slqt04 ( integer  M,
integer  N,
integer  NB,
real, dimension(6)  RESULT 
)

SLQT04

Purpose:
 SLQT04 tests SGELQT and SGEMLQT.
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 - L Q |
          RESULT(2) = | I - Q Q^H |
          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 slqt04.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 m, n, nb, ldt
84 * .. Return values ..
85  REAL result(6)
86 *
87 * =====================================================================
88 *
89 * ..
90 * .. Local allocatable arrays
91  REAL, ALLOCATABLE :: af(:,:), q(:,:),
92  $ l(:,:), 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, ll, lwork
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 * .. Intrinsic Functions ..
112  INTRINSIC max, min
113 * ..
114 * .. Data statements ..
115  DATA iseed / 1988, 1989, 1990, 1991 /
116 *
117  eps = slamch( 'Epsilon' )
118  k = min(m,n)
119  ll = max(m,n)
120  lwork = max(2,ll)*max(2,ll)*nb
121 *
122 * Dynamically allocate local arrays
123 *
124  ALLOCATE ( a(m,n), af(m,n), q(n,n), l(ll,n), rwork(ll),
125  $ work(lwork), t(nb,n), c(m,n), cf(m,n),
126  $ d(n,m), df(n,m) )
127 *
128 * Put random numbers into A and copy to AF
129 *
130  ldt=nb
131  DO j=1,n
132  CALL slarnv( 2, iseed, m, a( 1, j ) )
133  END DO
134  CALL slacpy( 'Full', m, n, a, m, af, m )
135 *
136 * Factor the matrix A in the array AF.
137 *
138  CALL sgelqt( m, n, nb, af, m, t, ldt, work, info )
139 *
140 * Generate the n-by-n matrix Q
141 *
142  CALL slaset( 'Full', n, n, zero, one, q, n )
143  CALL sgemlqt( 'R', 'N', n, n, k, nb, af, m, t, ldt, q, n,
144  $ work, info )
145 *
146 * Copy R
147 *
148  CALL slaset( 'Full', m, n, zero, zero, l, ll )
149  CALL slacpy( 'Lower', m, n, af, m, l, ll )
150 *
151 * Compute |L - A*Q'| / |A| and store in RESULT(1)
152 *
153  CALL sgemm( 'N', 'T', m, n, n, -one, a, m, q, n, one, l, ll )
154  anorm = slange( '1', m, n, a, m, rwork )
155  resid = slange( '1', m, n, l, ll, rwork )
156  IF( anorm.GT.zero ) THEN
157  result( 1 ) = resid / (eps*max(1,m)*anorm)
158  ELSE
159  result( 1 ) = zero
160  END IF
161 *
162 * Compute |I - Q'*Q| and store in RESULT(2)
163 *
164  CALL slaset( 'Full', n, n, zero, one, l, ll )
165  CALL ssyrk( 'U', 'C', n, n, -one, q, n, one, l, ll )
166  resid = slansy( '1', 'Upper', n, l, ll, rwork )
167  result( 2 ) = resid / (eps*max(1,n))
168 *
169 * Generate random m-by-n matrix C and a copy CF
170 *
171  DO j=1,m
172  CALL slarnv( 2, iseed, n, d( 1, j ) )
173  END DO
174  dnorm = slange( '1', n, m, d, n, rwork)
175  CALL slacpy( 'Full', n, m, d, n, df, n )
176 *
177 * Apply Q to C as Q*C
178 *
179  CALL sgemlqt( 'L', 'N', n, m, k, nb, af, m, t, nb, df, n,
180  $ work, info)
181 *
182 * Compute |Q*D - Q*D| / |D|
183 *
184  CALL sgemm( 'N', 'N', n, m, n, -one, q, n, d, n, one, df, n )
185  resid = slange( '1', n, m, df, n, rwork )
186  IF( dnorm.GT.zero ) THEN
187  result( 3 ) = resid / (eps*max(1,m)*dnorm)
188  ELSE
189  result( 3 ) = zero
190  END IF
191 *
192 * Copy D into DF again
193 *
194  CALL slacpy( 'Full', n, m, d, n, df, n )
195 *
196 * Apply Q to D as QT*D
197 *
198  CALL sgemlqt( 'L', 'T', n, m, k, nb, af, m, t, nb, df, n,
199  $ work, info)
200 *
201 * Compute |QT*D - QT*D| / |D|
202 *
203  CALL sgemm( 'T', 'N', n, m, n, -one, q, n, d, n, one, df, n )
204  resid = slange( '1', n, m, df, n, rwork )
205  IF( dnorm.GT.zero ) THEN
206  result( 4 ) = resid / (eps*max(1,m)*dnorm)
207  ELSE
208  result( 4 ) = zero
209  END IF
210 *
211 * Generate random n-by-m matrix D and a copy DF
212 *
213  DO j=1,n
214  CALL slarnv( 2, iseed, m, c( 1, j ) )
215  END DO
216  cnorm = slange( '1', m, n, c, m, rwork)
217  CALL slacpy( 'Full', m, n, c, m, cf, m )
218 *
219 * Apply Q to C as C*Q
220 *
221  CALL sgemlqt( 'R', 'N', m, n, k, nb, af, m, t, nb, cf, m,
222  $ work, info)
223 *
224 * Compute |C*Q - C*Q| / |C|
225 *
226  CALL sgemm( 'N', 'N', m, n, n, -one, c, m, q, n, one, cf, m )
227  resid = slange( '1', n, m, df, n, rwork )
228  IF( cnorm.GT.zero ) THEN
229  result( 5 ) = resid / (eps*max(1,m)*dnorm)
230  ELSE
231  result( 5 ) = zero
232  END IF
233 *
234 * Copy C into CF again
235 *
236  CALL slacpy( 'Full', m, n, c, m, cf, m )
237 *
238 * Apply Q to D as D*QT
239 *
240  CALL sgemlqt( 'R', 'T', m, n, k, nb, af, m, t, nb, cf, m,
241  $ work, info)
242 *
243 * Compute |C*QT - C*QT| / |C|
244 *
245  CALL sgemm( 'N', 'T', m, n, n, -one, c, m, q, n, one, cf, m )
246  resid = slange( '1', m, n, cf, m, rwork )
247  IF( cnorm.GT.zero ) THEN
248  result( 6 ) = resid / (eps*max(1,m)*dnorm)
249  ELSE
250  result( 6 ) = zero
251  END IF
252 *
253 * Deallocate all arrays
254 *
255  DEALLOCATE ( a, af, q, l, rwork, work, t, c, d, cf, df)
256 *
257  RETURN
subroutine sgelqt(M, N, MB, A, LDA, T, LDT, WORK, INFO)
Definition: sgelqt.f:124
subroutine sgemlqt(SIDE, TRANS, M, N, K, MB, V, LDV, T, LDT, C, LDC, WORK, INFO)
Definition: sgemlqt.f:153
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
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: