LAPACK 3.11.0
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
zglmts.f
Go to the documentation of this file.
1*> \brief \b ZGLMTS
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 ZGLMTS( N, M, P, A, AF, LDA, B, BF, LDB, D, DF, X, U,
12* WORK, LWORK, RWORK, RESULT )
13*
14* .. Scalar Arguments ..
15* INTEGER LDA, LDB, LWORK, M, N, P
16* DOUBLE PRECISION RESULT
17* ..
18* .. Array Arguments ..
19*
20*
21*> \par Purpose:
22* =============
23*>
24*> \verbatim
25*>
26*> ZGLMTS tests ZGGGLM - a subroutine for solving the generalized
27*> linear model problem.
28*> \endverbatim
29*
30* Arguments:
31* ==========
32*
33*> \param[in] N
34*> \verbatim
35*> N is INTEGER
36*> The number of rows of the matrices A and B. N >= 0.
37*> \endverbatim
38*>
39*> \param[in] M
40*> \verbatim
41*> M is INTEGER
42*> The number of columns of the matrix A. M >= 0.
43*> \endverbatim
44*>
45*> \param[in] P
46*> \verbatim
47*> P is INTEGER
48*> The number of columns of the matrix B. P >= 0.
49*> \endverbatim
50*>
51*> \param[in] A
52*> \verbatim
53*> A is COMPLEX*16 array, dimension (LDA,M)
54*> The N-by-M matrix A.
55*> \endverbatim
56*>
57*> \param[out] AF
58*> \verbatim
59*> AF is COMPLEX*16 array, dimension (LDA,M)
60*> \endverbatim
61*>
62*> \param[in] LDA
63*> \verbatim
64*> LDA is INTEGER
65*> The leading dimension of the arrays A, AF. LDA >= max(M,N).
66*> \endverbatim
67*>
68*> \param[in] B
69*> \verbatim
70*> B is COMPLEX*16 array, dimension (LDB,P)
71*> The N-by-P matrix A.
72*> \endverbatim
73*>
74*> \param[out] BF
75*> \verbatim
76*> BF is COMPLEX*16 array, dimension (LDB,P)
77*> \endverbatim
78*>
79*> \param[in] LDB
80*> \verbatim
81*> LDB is INTEGER
82*> The leading dimension of the arrays B, BF. LDB >= max(P,N).
83*> \endverbatim
84*>
85*> \param[in] D
86*> \verbatim
87*> D is COMPLEX*16 array, dimension( N )
88*> On input, the left hand side of the GLM.
89*> \endverbatim
90*>
91*> \param[out] DF
92*> \verbatim
93*> DF is COMPLEX*16 array, dimension( N )
94*> \endverbatim
95*>
96*> \param[out] X
97*> \verbatim
98*> X is COMPLEX*16 array, dimension( M )
99*> solution vector X in the GLM problem.
100*> \endverbatim
101*>
102*> \param[out] U
103*> \verbatim
104*> U is COMPLEX*16 array, dimension( P )
105*> solution vector U in the GLM problem.
106*> \endverbatim
107*>
108*> \param[out] WORK
109*> \verbatim
110*> WORK is COMPLEX*16 array, dimension (LWORK)
111*> \endverbatim
112*>
113*> \param[in] LWORK
114*> \verbatim
115*> LWORK is INTEGER
116*> The dimension of the array WORK.
117*> \endverbatim
118*>
119*> \param[out] RWORK
120*> \verbatim
121*> RWORK is DOUBLE PRECISION array, dimension (M)
122*> \endverbatim
123*>
124*> \param[out] RESULT
125*> \verbatim
126*> RESULT is DOUBLE PRECISION
127*> The test ratio:
128*> norm( d - A*x - B*u )
129*> RESULT = -----------------------------------------
130*> (norm(A)+norm(B))*(norm(x)+norm(u))*EPS
131*> \endverbatim
132*
133* Authors:
134* ========
135*
136*> \author Univ. of Tennessee
137*> \author Univ. of California Berkeley
138*> \author Univ. of Colorado Denver
139*> \author NAG Ltd.
140*
141*> \ingroup complex16_eig
142*
143* =====================================================================
144 SUBROUTINE zglmts( N, M, P, A, AF, LDA, B, BF, LDB, D, DF, X, U,
145 $ WORK, LWORK, RWORK, RESULT )
146*
147* -- LAPACK test routine --
148* -- LAPACK is a software package provided by Univ. of Tennessee, --
149* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
150*
151* .. Scalar Arguments ..
152 INTEGER LDA, LDB, LWORK, M, N, P
153 DOUBLE PRECISION RESULT
154* ..
155* .. Array Arguments ..
156*
157* ====================================================================
158*
159 DOUBLE PRECISION RWORK( * )
160 COMPLEX*16 A( LDA, * ), AF( LDA, * ), B( LDB, * ),
161 $ bf( ldb, * ), d( * ), df( * ), u( * ),
162 $ work( lwork ), x( * )
163* ..
164* .. Parameters ..
165 DOUBLE PRECISION ZERO
166 parameter( zero = 0.0d+0 )
167 COMPLEX*16 CONE
168 parameter( cone = 1.0d+0 )
169* ..
170* .. Local Scalars ..
171 INTEGER INFO
172 DOUBLE PRECISION ANORM, BNORM, DNORM, EPS, UNFL, XNORM, YNORM
173* ..
174* .. External Functions ..
175 DOUBLE PRECISION DLAMCH, DZASUM, ZLANGE
176 EXTERNAL dlamch, dzasum, zlange
177* ..
178* .. External Subroutines ..
179*
180 EXTERNAL zcopy, zgemv, zggglm, zlacpy
181* ..
182* .. Intrinsic Functions ..
183 INTRINSIC max
184* ..
185* .. Executable Statements ..
186*
187 eps = dlamch( 'Epsilon' )
188 unfl = dlamch( 'Safe minimum' )
189 anorm = max( zlange( '1', n, m, a, lda, rwork ), unfl )
190 bnorm = max( zlange( '1', n, p, b, ldb, rwork ), unfl )
191*
192* Copy the matrices A and B to the arrays AF and BF,
193* and the vector D the array DF.
194*
195 CALL zlacpy( 'Full', n, m, a, lda, af, lda )
196 CALL zlacpy( 'Full', n, p, b, ldb, bf, ldb )
197 CALL zcopy( n, d, 1, df, 1 )
198*
199* Solve GLM problem
200*
201 CALL zggglm( n, m, p, af, lda, bf, ldb, df, x, u, work, lwork,
202 $ info )
203*
204* Test the residual for the solution of LSE
205*
206* norm( d - A*x - B*u )
207* RESULT = -----------------------------------------
208* (norm(A)+norm(B))*(norm(x)+norm(u))*EPS
209*
210 CALL zcopy( n, d, 1, df, 1 )
211 CALL zgemv( 'No transpose', n, m, -cone, a, lda, x, 1, cone, df,
212 $ 1 )
213*
214 CALL zgemv( 'No transpose', n, p, -cone, b, ldb, u, 1, cone, df,
215 $ 1 )
216*
217 dnorm = dzasum( n, df, 1 )
218 xnorm = dzasum( m, x, 1 ) + dzasum( p, u, 1 )
219 ynorm = anorm + bnorm
220*
221 IF( xnorm.LE.zero ) THEN
222 result = zero
223 ELSE
224 result = ( ( dnorm / ynorm ) / xnorm ) / eps
225 END IF
226*
227 RETURN
228*
229* End of ZGLMTS
230*
231 END
subroutine zcopy(N, ZX, INCX, ZY, INCY)
ZCOPY
Definition: zcopy.f:81
subroutine zgemv(TRANS, M, N, ALPHA, A, LDA, X, INCX, BETA, Y, INCY)
ZGEMV
Definition: zgemv.f:158
subroutine zglmts(N, M, P, A, AF, LDA, B, BF, LDB, D, DF, X, U, WORK, LWORK, RWORK, RESULT)
ZGLMTS
Definition: zglmts.f:146
subroutine zlacpy(UPLO, M, N, A, LDA, B, LDB)
ZLACPY copies all or part of one two-dimensional array to another.
Definition: zlacpy.f:103
subroutine zggglm(N, M, P, A, LDA, B, LDB, D, X, Y, WORK, LWORK, INFO)
ZGGGLM
Definition: zggglm.f:185