LAPACK 3.11.0
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ cglmts()

subroutine cglmts ( integer  N,
integer  M,
integer  P,
complex, dimension( lda, * )  A,
complex, dimension( lda, * )  AF,
integer  LDA,
complex, dimension( ldb, * )  B,
complex, dimension( ldb, * )  BF,
integer  LDB,
complex, dimension( * )  D,
complex, dimension( * )  DF,
complex, dimension( * )  X,
complex, dimension( * )  U,
complex, dimension( lwork )  WORK,
integer  LWORK,
real, dimension( * )  RWORK,
real  RESULT 
)

CGLMTS

Purpose:
 CGLMTS tests CGGGLM - a subroutine for solving the generalized
 linear model problem.
Parameters
[in]N
          N is INTEGER
          The number of rows of the matrices A and B.  N >= 0.
[in]M
          M is INTEGER
          The number of columns of the matrix A.  M >= 0.
[in]P
          P is INTEGER
          The number of columns of the matrix B.  P >= 0.
[in]A
          A is COMPLEX array, dimension (LDA,M)
          The N-by-M matrix A.
[out]AF
          AF is COMPLEX array, dimension (LDA,M)
[in]LDA
          LDA is INTEGER
          The leading dimension of the arrays A, AF. LDA >= max(M,N).
[in]B
          B is COMPLEX array, dimension (LDB,P)
          The N-by-P matrix A.
[out]BF
          BF is COMPLEX array, dimension (LDB,P)
[in]LDB
          LDB is INTEGER
          The leading dimension of the arrays B, BF. LDB >= max(P,N).
[in]D
          D is COMPLEX array, dimension( N )
          On input, the left hand side of the GLM.
[out]DF
          DF is COMPLEX array, dimension( N )
[out]X
          X is COMPLEX array, dimension( M )
          solution vector X in the GLM problem.
[out]U
          U is COMPLEX array, dimension( P )
          solution vector U in the GLM problem.
[out]WORK
          WORK is COMPLEX array, dimension (LWORK)
[in]LWORK
          LWORK is INTEGER
          The dimension of the array WORK.
[out]RWORK
          RWORK is REAL array, dimension (M)
[out]RESULT
          RESULT is REAL
          The test ratio:
                           norm( d - A*x - B*u )
            RESULT = -----------------------------------------
                     (norm(A)+norm(B))*(norm(x)+norm(u))*EPS
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.

Definition at line 148 of file cglmts.f.

150*
151* -- LAPACK test routine --
152* -- LAPACK is a software package provided by Univ. of Tennessee, --
153* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
154*
155* .. Scalar Arguments ..
156 INTEGER LDA, LDB, LWORK, M, P, N
157 REAL RESULT
158* ..
159* .. Array Arguments ..
160 REAL RWORK( * )
161 COMPLEX A( LDA, * ), AF( LDA, * ), B( LDB, * ),
162 $ BF( LDB, * ), D( * ), DF( * ), U( * ),
163 $ WORK( LWORK ), X( * )
164*
165* ====================================================================
166*
167* .. Parameters ..
168 REAL ZERO
169 parameter( zero = 0.0e+0 )
170 COMPLEX CONE
171 parameter( cone = 1.0e+0 )
172* ..
173* .. Local Scalars ..
174 INTEGER INFO
175 REAL ANORM, BNORM, EPS, XNORM, YNORM, DNORM, UNFL
176* ..
177* .. External Functions ..
178 REAL SCASUM, SLAMCH, CLANGE
179 EXTERNAL scasum, slamch, clange
180* ..
181* .. External Subroutines ..
182 EXTERNAL clacpy
183*
184* .. Intrinsic Functions ..
185 INTRINSIC max
186* ..
187* .. Executable Statements ..
188*
189 eps = slamch( 'Epsilon' )
190 unfl = slamch( 'Safe minimum' )
191 anorm = max( clange( '1', n, m, a, lda, rwork ), unfl )
192 bnorm = max( clange( '1', n, p, b, ldb, rwork ), unfl )
193*
194* Copy the matrices A and B to the arrays AF and BF,
195* and the vector D the array DF.
196*
197 CALL clacpy( 'Full', n, m, a, lda, af, lda )
198 CALL clacpy( 'Full', n, p, b, ldb, bf, ldb )
199 CALL ccopy( n, d, 1, df, 1 )
200*
201* Solve GLM problem
202*
203 CALL cggglm( n, m, p, af, lda, bf, ldb, df, x, u, work, lwork,
204 $ info )
205*
206* Test the residual for the solution of LSE
207*
208* norm( d - A*x - B*u )
209* RESULT = -----------------------------------------
210* (norm(A)+norm(B))*(norm(x)+norm(u))*EPS
211*
212 CALL ccopy( n, d, 1, df, 1 )
213 CALL cgemv( 'No transpose', n, m, -cone, a, lda, x, 1, cone,
214 $ df, 1 )
215*
216 CALL cgemv( 'No transpose', n, p, -cone, b, ldb, u, 1, cone,
217 $ df, 1 )
218*
219 dnorm = scasum( n, df, 1 )
220 xnorm = scasum( m, x, 1 ) + scasum( p, u, 1 )
221 ynorm = anorm + bnorm
222*
223 IF( xnorm.LE.zero ) THEN
224 result = zero
225 ELSE
226 result = ( ( dnorm / ynorm ) / xnorm ) /eps
227 END IF
228*
229 RETURN
230*
231* End of CGLMTS
232*
subroutine ccopy(N, CX, INCX, CY, INCY)
CCOPY
Definition: ccopy.f:81
subroutine cgemv(TRANS, M, N, ALPHA, A, LDA, X, INCX, BETA, Y, INCY)
CGEMV
Definition: cgemv.f:158
real function clange(NORM, M, N, A, LDA, WORK)
CLANGE returns the value of the 1-norm, Frobenius norm, infinity-norm, or the largest absolute value ...
Definition: clange.f:115
subroutine clacpy(UPLO, M, N, A, LDA, B, LDB)
CLACPY copies all or part of one two-dimensional array to another.
Definition: clacpy.f:103
subroutine cggglm(N, M, P, A, LDA, B, LDB, D, X, Y, WORK, LWORK, INFO)
CGGGLM
Definition: cggglm.f:185
real function scasum(N, CX, INCX)
SCASUM
Definition: scasum.f:72
real function slamch(CMACH)
SLAMCH
Definition: slamch.f:68
Here is the call graph for this function:
Here is the caller graph for this function: