LAPACK  3.8.0
LAPACK: Linear Algebra PACKage

◆ 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.
Date
December 2016

Definition at line 152 of file cglmts.f.

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