1*> \brief \b CGET10
2*
3*  =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6*            http://www.netlib.org/lapack/explore-html/
7*
8*  Definition:
9*  ===========
10*
11*       SUBROUTINE CGET10( M, N, A, LDA, B, LDB, WORK, RWORK, RESULT )
12*
13*       .. Scalar Arguments ..
14*       INTEGER            LDA, LDB, M, N
15*       REAL               RESULT
16*       ..
17*       .. Array Arguments ..
18*       REAL               RWORK( * )
19*       COMPLEX            A( LDA, * ), B( LDB, * ), WORK( * )
20*       ..
21*
22*
23*> \par Purpose:
24*  =============
25*>
26*> \verbatim
27*>
28*> CGET10 compares two matrices A and B and computes the ratio
29*> RESULT = norm( A - B ) / ( norm(A) * M * EPS )
30*> \endverbatim
31*
32*  Arguments:
33*  ==========
34*
35*> \param[in] M
36*> \verbatim
37*>          M is INTEGER
38*>          The number of rows of the matrices A and B.
39*> \endverbatim
40*>
41*> \param[in] N
42*> \verbatim
43*>          N is INTEGER
44*>          The number of columns of the matrices A and B.
45*> \endverbatim
46*>
47*> \param[in] A
48*> \verbatim
49*>          A is COMPLEX array, dimension (LDA,N)
50*>          The m by n matrix A.
51*> \endverbatim
52*>
53*> \param[in] LDA
54*> \verbatim
55*>          LDA is INTEGER
56*>          The leading dimension of the array A.  LDA >= max(1,M).
57*> \endverbatim
58*>
59*> \param[in] B
60*> \verbatim
61*>          B is COMPLEX array, dimension (LDB,N)
62*>          The m by n matrix B.
63*> \endverbatim
64*>
65*> \param[in] LDB
66*> \verbatim
67*>          LDB is INTEGER
68*>          The leading dimension of the array B.  LDB >= max(1,M).
69*> \endverbatim
70*>
71*> \param[out] WORK
72*> \verbatim
73*>          WORK is COMPLEX array, dimension (M)
74*> \endverbatim
75*>
76*> \param[out] RWORK
77*> \verbatim
78*>          RWORK is COMPLEX array, dimension (M)
79*> \endverbatim
80*>
81*> \param[out] RESULT
82*> \verbatim
83*>          RESULT is REAL
84*>          RESULT = norm( A - B ) / ( norm(A) * M * EPS )
85*> \endverbatim
86*
87*  Authors:
88*  ========
89*
90*> \author Univ. of Tennessee
91*> \author Univ. of California Berkeley
92*> \author Univ. of Colorado Denver
93*> \author NAG Ltd.
94*
95*> \ingroup complex_eig
96*
97*  =====================================================================
98      SUBROUTINE CGET10( M, N, A, LDA, B, LDB, WORK, RWORK, RESULT )
99*
100*  -- LAPACK test routine --
101*  -- LAPACK is a software package provided by Univ. of Tennessee,    --
102*  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
103*
104*     .. Scalar Arguments ..
105      INTEGER            LDA, LDB, M, N
106      REAL               RESULT
107*     ..
108*     .. Array Arguments ..
109      REAL               RWORK( * )
110      COMPLEX            A( LDA, * ), B( LDB, * ), WORK( * )
111*     ..
112*
113*  =====================================================================
114*
115*     .. Parameters ..
116      REAL               ONE, ZERO
117      PARAMETER          ( ONE = 1.0E+0, ZERO = 0.0E+0 )
118*     ..
119*     .. Local Scalars ..
120      INTEGER            J
121      REAL               ANORM, EPS, UNFL, WNORM
122*     ..
123*     .. External Functions ..
124      REAL               SCASUM, SLAMCH, CLANGE
125      EXTERNAL           SCASUM, SLAMCH, CLANGE
126*     ..
127*     .. External Subroutines ..
128      EXTERNAL           CAXPY, CCOPY
129*     ..
130*     .. Intrinsic Functions ..
131      INTRINSIC          MAX, MIN, REAL
132*     ..
133*     .. Executable Statements ..
134*
135*     Quick return if possible
136*
137      IF( M.LE.0 .OR. N.LE.0 ) THEN
138         RESULT = ZERO
139         RETURN
140      END IF
141*
142      UNFL = SLAMCH( 'Safe minimum' )
143      EPS = SLAMCH( 'Precision' )
144*
145      WNORM = ZERO
146      DO 10 J = 1, N
147         CALL CCOPY( M, A( 1, J ), 1, WORK, 1 )
148         CALL CAXPY( M, CMPLX( -ONE ), B( 1, J ), 1, WORK, 1 )
149         WNORM = MAX( WNORM, SCASUM( N, WORK, 1 ) )
150   10 CONTINUE
151*
152      ANORM = MAX( CLANGE( '1', M, N, A, LDA, RWORK ), UNFL )
153*
154      IF( ANORM.GT.WNORM ) THEN
155         RESULT = ( WNORM / ANORM ) / ( M*EPS )
156      ELSE
157         IF( ANORM.LT.ONE ) THEN
158            RESULT = ( MIN( WNORM, M*ANORM ) / ANORM ) / ( M*EPS )
159         ELSE
160            RESULT = MIN( WNORM / ANORM, REAL( M ) ) / ( M*EPS )
161         END IF
162      END IF
163*
164      RETURN
165*
166*     End of CGET10
167*
168      END
169