3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
11 * SUBROUTINE DORT03( RC, MU, MV, N, K, U, LDU, V, LDV, WORK, LWORK,
14 * .. Scalar Arguments ..
16 * INTEGER INFO, K, LDU, LDV, LWORK, MU, MV, N
17 * DOUBLE PRECISION RESULT
19 * .. Array Arguments ..
20 * DOUBLE PRECISION U( LDU, * ), V( LDV, * ), WORK( * )
29 *> DORT03 compares two orthogonal matrices U and V to see if their
30 *> corresponding rows or columns span the same spaces. The rows are
31 *> checked if RC = 'R', and the columns are checked if RC = 'C'.
33 *> RESULT is the maximum of
35 *> | V*V' - I | / ( MV ulp ), if RC = 'R', or
37 *> | V'*V - I | / ( MV ulp ), if RC = 'C',
39 *> and the maximum over rows (or columns) 1 to K of
41 *> | U(i) - S*V(i) |/ ( N ulp )
43 *> where S is +-1 (chosen to minimize the expression), U(i) is the i-th
44 *> row (column) of U, and V(i) is the i-th row (column) of V.
53 *> If RC = 'R' the rows of U and V are to be compared.
54 *> If RC = 'C' the columns of U and V are to be compared.
60 *> The number of rows of U if RC = 'R', and the number of
61 *> columns if RC = 'C'. If MU = 0 DORT03 does nothing.
62 *> MU must be at least zero.
68 *> The number of rows of V if RC = 'R', and the number of
69 *> columns if RC = 'C'. If MV = 0 DORT03 does nothing.
70 *> MV must be at least zero.
76 *> If RC = 'R', the number of columns in the matrices U and V,
77 *> and if RC = 'C', the number of rows in U and V. If N = 0
78 *> DORT03 does nothing. N must be at least zero.
84 *> The number of rows or columns of U and V to compare.
85 *> 0 <= K <= max(MU,MV).
90 *> U is DOUBLE PRECISION array, dimension (LDU,N)
91 *> The first matrix to compare. If RC = 'R', U is MU by N, and
92 *> if RC = 'C', U is N by MU.
98 *> The leading dimension of U. If RC = 'R', LDU >= max(1,MU),
99 *> and if RC = 'C', LDU >= max(1,N).
104 *> V is DOUBLE PRECISION array, dimension (LDV,N)
105 *> The second matrix to compare. If RC = 'R', V is MV by N, and
106 *> if RC = 'C', V is N by MV.
112 *> The leading dimension of V. If RC = 'R', LDV >= max(1,MV),
113 *> and if RC = 'C', LDV >= max(1,N).
118 *> WORK is DOUBLE PRECISION array, dimension (LWORK)
124 *> The length of the array WORK. For best performance, LWORK
125 *> should be at least N*N if RC = 'C' or M*M if RC = 'R', but
126 *> the tests will be done even if LWORK is 0.
129 *> \param[out] RESULT
131 *> RESULT is DOUBLE PRECISION
132 *> The value computed by the test described above. RESULT is
133 *> limited to 1/ulp to avoid overflow.
139 *> 0 indicates a successful exit
140 *> -k indicates the k-th parameter had an illegal value
146 *> \author Univ. of Tennessee
147 *> \author Univ. of California Berkeley
148 *> \author Univ. of Colorado Denver
151 *> \date November 2011
153 *> \ingroup double_eig
155 * =====================================================================
156 SUBROUTINE DORT03( RC, MU, MV, N, K, U, LDU, V, LDV, WORK, LWORK,
159 * -- LAPACK test routine (version 3.4.0) --
160 * -- LAPACK is a software package provided by Univ. of Tennessee, --
161 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
164 * .. Scalar Arguments ..
166 INTEGER INFO, K, LDU, LDV, LWORK, MU, MV, N
167 DOUBLE PRECISION RESULT
169 * .. Array Arguments ..
170 DOUBLE PRECISION U( LDU, * ), V( LDV, * ), WORK( * )
173 * =====================================================================
176 DOUBLE PRECISION ZERO, ONE
177 PARAMETER ( ZERO = 0.0D0, ONE = 1.0D0 )
179 * .. Local Scalars ..
180 INTEGER I, IRC, J, LMX
181 DOUBLE PRECISION RES1, RES2, S, ULP
183 * .. External Functions ..
186 DOUBLE PRECISION DLAMCH
187 EXTERNAL LSAME, IDAMAX, DLAMCH
189 * .. Intrinsic Functions ..
190 INTRINSIC ABS, DBLE, MAX, MIN, SIGN
192 * .. External Subroutines ..
193 EXTERNAL DORT01, XERBLA
195 * .. Executable Statements ..
200 IF( LSAME( RC, 'R' ) ) THEN
202 ELSE IF( LSAME( RC, 'C' ) ) THEN
209 ELSE IF( MU.LT.0 ) THEN
211 ELSE IF( MV.LT.0 ) THEN
213 ELSE IF( N.LT.0 ) THEN
215 ELSE IF( K.LT.0 .OR. K.GT.MAX( MU, MV ) ) THEN
217 ELSE IF( ( IRC.EQ.0 .AND. LDU.LT.MAX( 1, MU ) ) .OR.
218 $ ( IRC.EQ.1 .AND. LDU.LT.MAX( 1, N ) ) ) THEN
220 ELSE IF( ( IRC.EQ.0 .AND. LDV.LT.MAX( 1, MV ) ) .OR.
221 $ ( IRC.EQ.1 .AND. LDV.LT.MAX( 1, N ) ) ) THEN
225 CALL XERBLA( 'DORT03', -INFO )
232 IF( MU.EQ.0 .OR. MV.EQ.0 .OR. N.EQ.0 )
237 ULP = DLAMCH( 'Precision' )
245 LMX = IDAMAX( N, U( I, 1 ), LDU )
246 S = SIGN( ONE, U( I, LMX ) )*SIGN( ONE, V( I, LMX ) )
248 RES1 = MAX( RES1, ABS( U( I, J )-S*V( I, J ) ) )
251 RES1 = RES1 / ( DBLE( N )*ULP )
253 * Compute orthogonality of rows of V.
255 CALL DORT01( 'Rows', MV, N, V, LDV, WORK, LWORK, RES2 )
263 LMX = IDAMAX( N, U( 1, I ), 1 )
264 S = SIGN( ONE, U( LMX, I ) )*SIGN( ONE, V( LMX, I ) )
266 RES1 = MAX( RES1, ABS( U( J, I )-S*V( J, I ) ) )
269 RES1 = RES1 / ( DBLE( N )*ULP )
271 * Compute orthogonality of columns of V.
273 CALL DORT01( 'Columns', N, MV, V, LDV, WORK, LWORK, RES2 )
276 RESULT = MIN( MAX( RES1, RES2 ), ONE / ULP )