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
dlqt01.f
Go to the documentation of this file.
1  SUBROUTINE dlqt01( 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 a( lda, * ), af( lda, * ), l( lda, * ),
16  $ q( lda, * ), result( * ), rwork( * ),
17  $ work( lwork )
18 * ..
19 *
20 * Purpose
21 * =======
22 *
23 * DLQT01 tests DGELQF, which computes the LQ factorization of an m-by-n
24 * matrix A, and partially tests DORGLQ which forms the n-by-n
25 * orthogonal matrix Q.
26 *
27 * DLQT01 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) DOUBLE PRECISION array, dimension (LDA,N)
39 * The m-by-n matrix A.
40 *
41 * AF (output) DOUBLE PRECISION array, dimension (LDA,N)
42 * Details of the LQ factorization of A, as returned by DGELQF.
43 * See DGELQF for further details.
44 *
45 * Q (output) DOUBLE PRECISION array, dimension (LDA,N)
46 * The n-by-n orthogonal matrix Q.
47 *
48 * L (workspace) DOUBLE PRECISION 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) DOUBLE PRECISION array, dimension (min(M,N))
55 * The scalar factors of the elementary reflectors, as returned
56 * by DGELQF.
57 *
58 * WORK (workspace) DOUBLE PRECISION 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  DOUBLE PRECISION rogue
76  parameter( rogue = -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, dlange, dlansy
84  EXTERNAL dlamch, dlange, dlansy
85 * ..
86 * .. External Subroutines ..
87  EXTERNAL dgelqf, dgemm, dlacpy, dlaset, dorglq, dsyrk
88 * ..
89 * .. Intrinsic Functions ..
90  INTRINSIC dble, 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 dlacpy( 'Full', m, n, a, lda, af, lda )
106 *
107 * Factorize the matrix A in the array AF.
108 *
109  srnamt = 'DGELQF'
110  CALL plasma_dgelqf( m, n, af, lda, t, info )
111 *
112 * Copy details of Q
113 *
114  CALL dlaset( 'Full', m, n, zero, one, q, lda )
115 *
116 * Generate the n-by-n matrix Q
117 *
118  srnamt = 'DORGLQ'
119  CALL plasma_dorglq( m, n, minmn, af, lda, t, q, lda, info )
120 *
121 * Copy L
122 *
123  CALL dlaset( 'Full', m, m, zero, zero, l, lda )
124  CALL dlacpy( 'Lower', m, n, af, lda, l, lda )
125 *
126 * Compute L - A*Q'
127 *
128  CALL dgemm( 'No transpose', 'Transpose', m, m, n, -one, a, lda, q,
129  $ lda, one, l, lda )
130 *
131 * Compute norm( L - Q'*A ) / ( N * norm(A) * EPS ) .
132 *
133  anorm = dlange( '1', m, n, a, lda, rwork )
134  resid = dlange( '1', m, m, l, lda, rwork )
135  IF( anorm.GT.zero ) THEN
136  result( 1 ) = ( ( resid / dble( max( 1, n ) ) ) / anorm ) / eps
137  ELSE
138  result( 1 ) = zero
139  END IF
140 *
141 * Compute I - Q*Q'
142 *
143  CALL dlaset( 'Full', m, m, zero, one, l, lda )
144  CALL dsyrk( 'Upper', 'No transpose', m, n, one, q, lda, -one, l,
145  $ lda )
146 *
147 * Compute norm( I - Q*Q' ) / ( N * EPS ) .
148 *
149  resid = dlansy( '1', 'Upper', m, l, lda, rwork )
150 *
151  result( 2 ) = ( resid / dble( max( 1, m ) ) ) / eps
152 *
153  return
154 *
155 * End of DLQT01
156 *
157  END