1 REAL FUNCTION SQRT11( M, K, A, LDA, TAU, WORK, LWORK )
2 *
3 * -- LAPACK routine (version 3.1) --
4 * Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
5 * November 2006
6 *
7 * .. Scalar Arguments ..
8 INTEGER K, LDA, LWORK, M
9 * ..
10 * .. Array Arguments ..
11 REAL A( LDA, * ), TAU( * ), WORK( LWORK )
12 * ..
13 *
14 * Purpose
15 * =======
16 *
17 * SQRT11 computes the test ratio
18 *
19 * || Q'*Q - I || / (eps * m)
20 *
21 * where the orthogonal matrix Q is represented as a product of
22 * elementary transformations. Each transformation has the form
23 *
24 * H(k) = I - tau(k) v(k) v(k)'
25 *
26 * where tau(k) is stored in TAU(k) and v(k) is an m-vector of the form
27 * [ 0 ... 0 1 x(k) ]', where x(k) is a vector of length m-k stored
28 * in A(k+1:m,k).
29 *
30 * Arguments
31 * =========
32 *
33 * M (input) INTEGER
34 * The number of rows of the matrix A.
35 *
36 * K (input) INTEGER
37 * The number of columns of A whose subdiagonal entries
38 * contain information about orthogonal transformations.
39 *
40 * A (input) REAL array, dimension (LDA,K)
41 * The (possibly partial) output of a QR reduction routine.
42 *
43 * LDA (input) INTEGER
44 * The leading dimension of the array A.
45 *
46 * TAU (input) REAL array, dimension (K)
47 * The scaling factors tau for the elementary transformations as
48 * computed by the QR factorization routine.
49 *
50 * WORK (workspace) REAL array, dimension (LWORK)
51 *
52 * LWORK (input) INTEGER
53 * The length of the array WORK. LWORK >= M*M + M.
54 *
55 * =====================================================================
56 *
57 * .. Parameters ..
58 REAL ZERO, ONE
59 PARAMETER ( ZERO = 0.0E0, ONE = 1.0E0 )
60 * ..
61 * .. Local Scalars ..
62 INTEGER INFO, J
63 * ..
64 * .. External Functions ..
65 REAL SLAMCH, SLANGE
66 EXTERNAL SLAMCH, SLANGE
67 * ..
68 * .. External Subroutines ..
69 EXTERNAL SLASET, SORM2R, XERBLA
70 * ..
71 * .. Intrinsic Functions ..
72 INTRINSIC REAL
73 * ..
74 * .. Local Arrays ..
75 REAL RDUMMY( 1 )
76 * ..
77 * .. Executable Statements ..
78 *
79 SQRT11 = ZERO
80 *
81 * Test for sufficient workspace
82 *
83 IF( LWORK.LT.M*M+M ) THEN
84 CALL XERBLA( 'SQRT11', 7 )
85 RETURN
86 END IF
87 *
88 * Quick return if possible
89 *
90 IF( M.LE.0 )
91 $ RETURN
92 *
93 CALL SLASET( 'Full', M, M, ZERO, ONE, WORK, M )
94 *
95 * Form Q
96 *
97 CALL SORM2R( 'Left', 'No transpose', M, M, K, A, LDA, TAU, WORK,
98 $ M, WORK( M*M+1 ), INFO )
99 *
100 * Form Q'*Q
101 *
102 CALL SORM2R( 'Left', 'Transpose', M, M, K, A, LDA, TAU, WORK, M,
103 $ WORK( M*M+1 ), INFO )
104 *
105 DO 10 J = 1, M
106 WORK( ( J-1 )*M+J ) = WORK( ( J-1 )*M+J ) - ONE
107 10 CONTINUE
108 *
109 SQRT11 = SLANGE( 'One-norm', M, M, WORK, M, RDUMMY ) /
110 $ ( REAL( M )*SLAMCH( 'Epsilon' ) )
111 *
112 RETURN
113 *
114 * End of SQRT11
115 *
116 END
2 *
3 * -- LAPACK routine (version 3.1) --
4 * Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
5 * November 2006
6 *
7 * .. Scalar Arguments ..
8 INTEGER K, LDA, LWORK, M
9 * ..
10 * .. Array Arguments ..
11 REAL A( LDA, * ), TAU( * ), WORK( LWORK )
12 * ..
13 *
14 * Purpose
15 * =======
16 *
17 * SQRT11 computes the test ratio
18 *
19 * || Q'*Q - I || / (eps * m)
20 *
21 * where the orthogonal matrix Q is represented as a product of
22 * elementary transformations. Each transformation has the form
23 *
24 * H(k) = I - tau(k) v(k) v(k)'
25 *
26 * where tau(k) is stored in TAU(k) and v(k) is an m-vector of the form
27 * [ 0 ... 0 1 x(k) ]', where x(k) is a vector of length m-k stored
28 * in A(k+1:m,k).
29 *
30 * Arguments
31 * =========
32 *
33 * M (input) INTEGER
34 * The number of rows of the matrix A.
35 *
36 * K (input) INTEGER
37 * The number of columns of A whose subdiagonal entries
38 * contain information about orthogonal transformations.
39 *
40 * A (input) REAL array, dimension (LDA,K)
41 * The (possibly partial) output of a QR reduction routine.
42 *
43 * LDA (input) INTEGER
44 * The leading dimension of the array A.
45 *
46 * TAU (input) REAL array, dimension (K)
47 * The scaling factors tau for the elementary transformations as
48 * computed by the QR factorization routine.
49 *
50 * WORK (workspace) REAL array, dimension (LWORK)
51 *
52 * LWORK (input) INTEGER
53 * The length of the array WORK. LWORK >= M*M + M.
54 *
55 * =====================================================================
56 *
57 * .. Parameters ..
58 REAL ZERO, ONE
59 PARAMETER ( ZERO = 0.0E0, ONE = 1.0E0 )
60 * ..
61 * .. Local Scalars ..
62 INTEGER INFO, J
63 * ..
64 * .. External Functions ..
65 REAL SLAMCH, SLANGE
66 EXTERNAL SLAMCH, SLANGE
67 * ..
68 * .. External Subroutines ..
69 EXTERNAL SLASET, SORM2R, XERBLA
70 * ..
71 * .. Intrinsic Functions ..
72 INTRINSIC REAL
73 * ..
74 * .. Local Arrays ..
75 REAL RDUMMY( 1 )
76 * ..
77 * .. Executable Statements ..
78 *
79 SQRT11 = ZERO
80 *
81 * Test for sufficient workspace
82 *
83 IF( LWORK.LT.M*M+M ) THEN
84 CALL XERBLA( 'SQRT11', 7 )
85 RETURN
86 END IF
87 *
88 * Quick return if possible
89 *
90 IF( M.LE.0 )
91 $ RETURN
92 *
93 CALL SLASET( 'Full', M, M, ZERO, ONE, WORK, M )
94 *
95 * Form Q
96 *
97 CALL SORM2R( 'Left', 'No transpose', M, M, K, A, LDA, TAU, WORK,
98 $ M, WORK( M*M+1 ), INFO )
99 *
100 * Form Q'*Q
101 *
102 CALL SORM2R( 'Left', 'Transpose', M, M, K, A, LDA, TAU, WORK, M,
103 $ WORK( M*M+1 ), INFO )
104 *
105 DO 10 J = 1, M
106 WORK( ( J-1 )*M+J ) = WORK( ( J-1 )*M+J ) - ONE
107 10 CONTINUE
108 *
109 SQRT11 = SLANGE( 'One-norm', M, M, WORK, M, RDUMMY ) /
110 $ ( REAL( M )*SLAMCH( 'Epsilon' ) )
111 *
112 RETURN
113 *
114 * End of SQRT11
115 *
116 END