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
zlqt01.f
Go to the documentation of this file.
1  SUBROUTINE zlqt01( M, N, 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 lda, lwork, m, n
12  INTEGER t( 2 )
13 * ..
14 * .. Array Arguments ..
15  DOUBLE PRECISION result( * ), rwork( * )
16  COMPLEX*16 a( lda, * ), af( lda, * ), l( lda, * ),
17  $ q( lda, * ), work( lwork )
18 * ..
19 *
20 * Purpose
21 * =======
22 *
23 * ZLQT01 tests ZGELQF, which computes the LQ factorization of an m-by-n
24 * matrix A, and partially tests ZUNGLQ which forms the n-by-n
25 * orthogonal matrix Q.
26 *
27 * ZLQT01 compares L with A*Q', and checks that Q is orthogonal.
28 *
29 * Arguments
30 * =========
31 *
32 * M (input) INTEGER
33 * The number of rows of the matrix A. M >= 0.
34 *
35 * N (input) INTEGER
36 * The number of columns of the matrix A. N >= 0.
37 *
38 * A (input) COMPLEX*16 array, dimension (LDA,N)
39 * The m-by-n matrix A.
40 *
41 * AF (output) COMPLEX*16 array, dimension (LDA,N)
42 * Details of the LQ factorization of A, as returned by ZGELQF.
43 * See ZGELQF for further details.
44 *
45 * Q (output) COMPLEX*16 array, dimension (LDA,N)
46 * The n-by-n orthogonal matrix Q.
47 *
48 * L (workspace) COMPLEX*16 array, dimension (LDA,max(M,N))
49 *
50 * LDA (input) INTEGER
51 * The leading dimension of the arrays A, AF, Q and L.
52 * LDA >= max(M,N).
53 *
54 * TAU (output) COMPLEX*16 array, dimension (min(M,N))
55 * The scalar factors of the elementary reflectors, as returned
56 * by ZGELQF.
57 *
58 * WORK (workspace) COMPLEX*16 array, dimension (LWORK)
59 *
60 * LWORK (input) INTEGER
61 * The dimension of the array WORK.
62 *
63 * RWORK (workspace) DOUBLE PRECISION array, dimension (max(M,N))
64 *
65 * RESULT (output) DOUBLE PRECISION array, dimension (2)
66 * The test ratios:
67 * RESULT(1) = norm( L - A*Q' ) / ( N * norm(A) * EPS )
68 * RESULT(2) = norm( I - Q*Q' ) / ( N * EPS )
69 *
70 * =====================================================================
71 *
72 * .. Parameters ..
73  DOUBLE PRECISION zero, one
74  parameter( zero = 0.0d+0, one = 1.0d+0 )
75  COMPLEX*16 rogue
76  parameter( rogue = ( -1.0d+10, -1.0d+10 ) )
77 * ..
78 * .. Local Scalars ..
79  INTEGER info, minmn
80  DOUBLE PRECISION anorm, eps, resid
81 * ..
82 * .. External Functions ..
83  DOUBLE PRECISION dlamch, zlange, zlansy
84  EXTERNAL dlamch, zlange, zlansy
85 * ..
86 * .. External Subroutines ..
87  EXTERNAL zgelqf, zgemm, zherk, zlacpy, zlaset, zunglq
88 * ..
89 * .. Intrinsic Functions ..
90  INTRINSIC dble, dcmplx, max, min
91 * ..
92 * .. Scalars in Common ..
93  CHARACTER*32 srnamt
94 * ..
95 * .. Common blocks ..
96  common / srnamc / srnamt
97 * ..
98 * .. Executable Statements ..
99 *
100  minmn = min( m, n )
101  eps = dlamch( 'Epsilon' )
102 *
103 * Copy the matrix A to the array AF.
104 *
105  CALL zlacpy( 'Full', m, n, a, lda, af, lda )
106 *
107 * Factorize the matrix A in the array AF.
108 *
109  srnamt = 'ZGELQF'
110  CALL plasma_zgelqf( m, n, af, lda, t, info )
111 *
112 * Copy details of Q
113 *
114  CALL zlaset( 'Full', m, n, dcmplx( zero ), dcmplx( one ), q, lda )
115 *
116 * Generate the n-by-n matrix Q
117 *
118  srnamt = 'ZUNGLQ'
119  CALL plasma_zunglq( m, n, minmn, af, lda, t, q, lda, info )
120 *
121 * Copy L
122 *
123  CALL zlaset( 'Full', m, m, dcmplx( zero ), dcmplx( zero ), l,
124  $ lda )
125  CALL zlacpy( 'Lower', m, n, af, lda, l, lda )
126 *
127 * Compute L - A*Q'
128 *
129  CALL zgemm( 'No transpose', 'Conjugate transpose', m, m, n,
130  $ dcmplx( -one ), a, lda, q, lda, dcmplx( one ), l,
131  $ lda )
132 *
133 * Compute norm( L - Q'*A ) / ( N * norm(A) * EPS ) .
134 *
135  anorm = zlange( '1', m, n, a, lda, rwork )
136  resid = zlange( '1', m, m, l, lda, rwork )
137  IF( anorm.GT.zero ) THEN
138  result( 1 ) = ( ( resid / dble( max( 1, n ) ) ) / anorm ) / eps
139  ELSE
140  result( 1 ) = zero
141  END IF
142 *
143 * Compute I - Q*Q'
144 *
145  CALL zlaset( 'Full', m, m, dcmplx( zero ), dcmplx( one ), l, lda )
146  CALL zherk( 'Upper', 'No transpose', m, n, one, q, lda, -one, l,
147  $ lda )
148 *
149 * Compute norm( I - Q*Q' ) / ( N * EPS ) .
150 *
151  resid = zlansy( '1', 'Upper', m, l, lda, rwork )
152 *
153  result( 2 ) = ( resid / dble( max( 1, m ) ) ) / eps
154 *
155  return
156 *
157 * End of ZLQT01
158 *
159  END