PLASMA  2.4.5
PLASMA - Parallel Linear Algebra for Scalable Multi-core Architectures
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
slqt02.f
Go to the documentation of this file.
1  SUBROUTINE slqt02( M, N, K, A, AF, Q, L, LDA, T, WORK, LWORK,
2  $ rwork, result )
3 *
4  include 'plasmaf.h'
5 *
6 * -- LAPACK test routine (version 3.1) --
7 * Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
8 * November 2006
9 *
10 * .. Scalar Arguments ..
11  INTEGER k, lda, lwork, m, n
12  INTEGER t( 2 )
13 * ..
14 * .. Array Arguments ..
15  REAL a( lda, * ), af( lda, * ), l( lda, * ),
16  $ q( lda, * ), result( * ), rwork( * ),
17  $ work( lwork )
18 * ..
19 *
20 * Purpose
21 * =======
22 *
23 * SLQT02 tests SORGLQ, which generates an m-by-n matrix Q with
24 * orthonornmal rows that is defined as the product of k elementary
25 * reflectors.
26 *
27 * Given the LQ factorization of an m-by-n matrix A, SLQT02 generates
28 * the orthogonal matrix Q defined by the factorization of the first k
29 * rows of A; it compares L(1:k,1:m) with A(1:k,1:n)*Q(1:m,1:n)', and
30 * checks that the rows of Q are orthonormal.
31 *
32 * Arguments
33 * =========
34 *
35 * M (input) INTEGER
36 * The number of rows of the matrix Q to be generated. M >= 0.
37 *
38 * N (input) INTEGER
39 * The number of columns of the matrix Q to be generated.
40 * N >= M >= 0.
41 *
42 * K (input) INTEGER
43 * The number of elementary reflectors whose product defines the
44 * matrix Q. M >= K >= 0.
45 *
46 * A (input) REAL array, dimension (LDA,N)
47 * The m-by-n matrix A which was factorized by SLQT01.
48 *
49 * AF (input) REAL array, dimension (LDA,N)
50 * Details of the LQ factorization of A, as returned by SGELQF.
51 * See SGELQF for further details.
52 *
53 * Q (workspace) REAL array, dimension (LDA,N)
54 *
55 * L (workspace) REAL array, dimension (LDA,M)
56 *
57 * LDA (input) INTEGER
58 * The leading dimension of the arrays A, AF, Q and L. LDA >= N.
59 *
60 * TAU (input) REAL array, dimension (M)
61 * The scalar factors of the elementary reflectors corresponding
62 * to the LQ factorization in AF.
63 *
64 * WORK (workspace) REAL array, dimension (LWORK)
65 *
66 * LWORK (input) INTEGER
67 * The dimension of the array WORK.
68 *
69 * RWORK (workspace) REAL array, dimension (M)
70 *
71 * RESULT (output) REAL array, dimension (2)
72 * The test ratios:
73 * RESULT(1) = norm( L - A*Q' ) / ( N * norm(A) * EPS )
74 * RESULT(2) = norm( I - Q*Q' ) / ( N * EPS )
75 *
76 * =====================================================================
77 *
78 * .. Parameters ..
79  REAL zero, one
80  parameter( zero = 0.0e+0, one = 1.0e+0 )
81  REAL rogue
82  parameter( rogue = -1.0e+10 )
83 * ..
84 * .. Local Scalars ..
85  INTEGER info
86  REAL anorm, eps, resid
87 * ..
88 * .. External Functions ..
89  REAL slamch, slange, slansy
90  EXTERNAL slamch, slange, slansy
91 * ..
92 * .. External Subroutines ..
93  EXTERNAL sgemm, slacpy, slaset, sorglq, ssyrk
94 * ..
95 * .. Intrinsic Functions ..
96  INTRINSIC max, real
97 * ..
98 * .. Scalars in Common ..
99  CHARACTER*32 srnamt
100 * ..
101 * .. Common blocks ..
102  common / srnamc / srnamt
103 * ..
104 * .. Executable Statements ..
105 *
106  eps = slamch( 'Epsilon' )
107 *
108 * Copy the first k rows of the factorization to the array Q
109 *
110  CALL slaset( 'Full', m, n, zero, one, q, lda )
111 *
112 * Generate the first n columns of the matrix Q
113 *
114  srnamt = 'SORGLQ'
115  CALL plasma_sorglq( m, n, k, af, lda, t, q, lda, info )
116 *
117 * Copy L(1:k,1:m)
118 *
119  CALL slaset( 'Full', k, m, zero, zero, l, lda )
120  CALL slacpy( 'Lower', k, m, af, lda, l, lda )
121 *
122 * Compute L(1:k,1:m) - A(1:k,1:n) * Q(1:m,1:n)'
123 *
124  CALL sgemm( 'No transpose', 'Transpose', k, m, n, -one, a, lda, q,
125  $ lda, one, l, lda )
126 *
127 * Compute norm( L - A*Q' ) / ( N * norm(A) * EPS ) .
128 *
129  anorm = slange( '1', k, n, a, lda, rwork )
130  resid = slange( '1', k, m, l, lda, rwork )
131  IF( anorm.GT.zero ) THEN
132  result( 1 ) = ( ( resid / REAL( MAX( 1, N ) ) ) / anorm ) / eps
133  ELSE
134  result( 1 ) = zero
135  END IF
136 *
137 * Compute I - Q*Q'
138 *
139  CALL slaset( 'Full', m, m, zero, one, l, lda )
140  CALL ssyrk( 'Upper', 'No transpose', m, n, -one, q, lda, one, l,
141  $ lda )
142 *
143 * Compute norm( I - Q*Q' ) / ( N * EPS ) .
144 *
145  resid = slansy( '1', 'Upper', m, l, lda, rwork )
146 *
147  result( 2 ) = ( resid / REAL( MAX( 1, N ) ) ) / eps
148 *
149  return
150 *
151 * End of SLQT02
152 *
153  END