LAPACK 3.3.1
Linear Algebra PACKage

cget54.f

Go to the documentation of this file.
00001       SUBROUTINE CGET54( N, A, LDA, B, LDB, S, LDS, T, LDT, U, LDU, V,
00002      $                   LDV, WORK, RESULT )
00003 *
00004 *  -- LAPACK test routine (version 3.1) --
00005 *     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
00006 *     November 2006
00007 *
00008 *     .. Scalar Arguments ..
00009       INTEGER            LDA, LDB, LDS, LDT, LDU, LDV, N
00010       REAL               RESULT
00011 *     ..
00012 *     .. Array Arguments ..
00013       COMPLEX            A( LDA, * ), B( LDB, * ), S( LDS, * ),
00014      $                   T( LDT, * ), U( LDU, * ), V( LDV, * ),
00015      $                   WORK( * )
00016 *     ..
00017 *
00018 *  Purpose
00019 *  =======
00020 *
00021 *  CGET54 checks a generalized decomposition of the form
00022 *
00023 *           A = U*S*V'  and B = U*T* V'
00024 *
00025 *  where ' means conjugate transpose and U and V are unitary.
00026 *
00027 *  Specifically,
00028 *
00029 *    RESULT = ||( A - U*S*V', B - U*T*V' )|| / (||( A, B )||*n*ulp )
00030 *
00031 *  Arguments
00032 *  =========
00033 *
00034 *  N       (input) INTEGER
00035 *          The size of the matrix.  If it is zero, SGET54 does nothing.
00036 *          It must be at least zero.
00037 *
00038 *  A       (input) COMPLEX array, dimension (LDA, N)
00039 *          The original (unfactored) matrix A.
00040 *
00041 *  LDA     (input) INTEGER
00042 *          The leading dimension of A.  It must be at least 1
00043 *          and at least N.
00044 *
00045 *  B       (input) COMPLEX array, dimension (LDB, N)
00046 *          The original (unfactored) matrix B.
00047 *
00048 *  LDB     (input) INTEGER
00049 *          The leading dimension of B.  It must be at least 1
00050 *          and at least N.
00051 *
00052 *  S       (input) COMPLEX array, dimension (LDS, N)
00053 *          The factored matrix S.
00054 *
00055 *  LDS     (input) INTEGER
00056 *          The leading dimension of S.  It must be at least 1
00057 *          and at least N.
00058 *
00059 *  T       (input) COMPLEX array, dimension (LDT, N)
00060 *          The factored matrix T.
00061 *
00062 *  LDT     (input) INTEGER
00063 *          The leading dimension of T.  It must be at least 1
00064 *          and at least N.
00065 *
00066 *  U       (input) COMPLEX array, dimension (LDU, N)
00067 *          The orthogonal matrix on the left-hand side in the
00068 *          decomposition.
00069 *
00070 *  LDU     (input) INTEGER
00071 *          The leading dimension of U.  LDU must be at least N and
00072 *          at least 1.
00073 *
00074 *  V       (input) COMPLEX array, dimension (LDV, N)
00075 *          The orthogonal matrix on the left-hand side in the
00076 *          decomposition.
00077 *
00078 *  LDV     (input) INTEGER
00079 *          The leading dimension of V.  LDV must be at least N and
00080 *          at least 1.
00081 *
00082 *  WORK    (workspace) COMPLEX array, dimension (3*N**2)
00083 *
00084 *  RESULT  (output) REAL
00085 *          The value RESULT, It is currently limited to 1/ulp, to
00086 *          avoid overflow. Errors are flagged by RESULT=10/ulp.
00087 *
00088 *  =====================================================================
00089 *
00090 *     .. Parameters ..
00091       REAL               ZERO, ONE
00092       PARAMETER          ( ZERO = 0.0E+0, ONE = 1.0E+0 )
00093       COMPLEX            CZERO, CONE
00094       PARAMETER          ( CZERO = ( 0.0E+0, 0.0E+0 ),
00095      $                   CONE = ( 1.0E+0, 0.0E+0 ) )
00096 *     ..
00097 *     .. Local Scalars ..
00098       REAL               ABNORM, ULP, UNFL, WNORM
00099 *     ..
00100 *     .. Local Arrays ..
00101       REAL               DUM( 1 )
00102 *     ..
00103 *     .. External Functions ..
00104       REAL               CLANGE, SLAMCH
00105       EXTERNAL           CLANGE, SLAMCH
00106 *     ..
00107 *     .. External Subroutines ..
00108       EXTERNAL           CGEMM, CLACPY
00109 *     ..
00110 *     .. Intrinsic Functions ..
00111       INTRINSIC          MAX, MIN, REAL
00112 *     ..
00113 *     .. Executable Statements ..
00114 *
00115       RESULT = ZERO
00116       IF( N.LE.0 )
00117      $   RETURN
00118 *
00119 *     Constants
00120 *
00121       UNFL = SLAMCH( 'Safe minimum' )
00122       ULP = SLAMCH( 'Epsilon' )*SLAMCH( 'Base' )
00123 *
00124 *     compute the norm of (A,B)
00125 *
00126       CALL CLACPY( 'Full', N, N, A, LDA, WORK, N )
00127       CALL CLACPY( 'Full', N, N, B, LDB, WORK( N*N+1 ), N )
00128       ABNORM = MAX( CLANGE( '1', N, 2*N, WORK, N, DUM ), UNFL )
00129 *
00130 *     Compute W1 = A - U*S*V', and put in the array WORK(1:N*N)
00131 *
00132       CALL CLACPY( ' ', N, N, A, LDA, WORK, N )
00133       CALL CGEMM( 'N', 'N', N, N, N, CONE, U, LDU, S, LDS, CZERO,
00134      $            WORK( N*N+1 ), N )
00135 *
00136       CALL CGEMM( 'N', 'C', N, N, N, -CONE, WORK( N*N+1 ), N, V, LDV,
00137      $            CONE, WORK, N )
00138 *
00139 *     Compute W2 = B - U*T*V', and put in the workarray W(N*N+1:2*N*N)
00140 *
00141       CALL CLACPY( ' ', N, N, B, LDB, WORK( N*N+1 ), N )
00142       CALL CGEMM( 'N', 'N', N, N, N, CONE, U, LDU, T, LDT, CZERO,
00143      $            WORK( 2*N*N+1 ), N )
00144 *
00145       CALL CGEMM( 'N', 'C', N, N, N, -CONE, WORK( 2*N*N+1 ), N, V, LDV,
00146      $            CONE, WORK( N*N+1 ), N )
00147 *
00148 *     Compute norm(W)/ ( ulp*norm((A,B)) )
00149 *
00150       WNORM = CLANGE( '1', N, 2*N, WORK, N, DUM )
00151 *
00152       IF( ABNORM.GT.WNORM ) THEN
00153          RESULT = ( WNORM / ABNORM ) / ( 2*N*ULP )
00154       ELSE
00155          IF( ABNORM.LT.ONE ) THEN
00156             RESULT = ( MIN( WNORM, 2*N*ABNORM ) / ABNORM ) / ( 2*N*ULP )
00157          ELSE
00158             RESULT = MIN( WNORM / ABNORM, REAL( 2*N ) ) / ( 2*N*ULP )
00159          END IF
00160       END IF
00161 *
00162       RETURN
00163 *
00164 *     End of CGET54
00165 *
00166       END
 All Files Functions