LAPACK  3.10.0
LAPACK: Linear Algebra PACKage

◆ sget51()

subroutine sget51 ( integer  ITYPE,
integer  N,
real, dimension( lda, * )  A,
integer  LDA,
real, dimension( ldb, * )  B,
integer  LDB,
real, dimension( ldu, * )  U,
integer  LDU,
real, dimension( ldv, * )  V,
integer  LDV,
real, dimension( * )  WORK,
real  RESULT 
)

SGET51

Purpose:
      SGET51  generally checks a decomposition of the form

              A = U B V'

      where ' means transpose and U and V are orthogonal.

      Specifically, if ITYPE=1

              RESULT = | A - U B V' | / ( |A| n ulp )

      If ITYPE=2, then:

              RESULT = | A - B | / ( |A| n ulp )

      If ITYPE=3, then:

              RESULT = | I - UU' | / ( n ulp )
Parameters
[in]ITYPE
          ITYPE is INTEGER
          Specifies the type of tests to be performed.
          =1: RESULT = | A - U B V' | / ( |A| n ulp )
          =2: RESULT = | A - B | / ( |A| n ulp )
          =3: RESULT = | I - UU' | / ( n ulp )
[in]N
          N is INTEGER
          The size of the matrix.  If it is zero, SGET51 does nothing.
          It must be at least zero.
[in]A
          A is REAL array, dimension (LDA, N)
          The original (unfactored) matrix.
[in]LDA
          LDA is INTEGER
          The leading dimension of A.  It must be at least 1
          and at least N.
[in]B
          B is REAL array, dimension (LDB, N)
          The factored matrix.
[in]LDB
          LDB is INTEGER
          The leading dimension of B.  It must be at least 1
          and at least N.
[in]U
          U is REAL array, dimension (LDU, N)
          The orthogonal matrix on the left-hand side in the
          decomposition.
          Not referenced if ITYPE=2
[in]LDU
          LDU is INTEGER
          The leading dimension of U.  LDU must be at least N and
          at least 1.
[in]V
          V is REAL array, dimension (LDV, N)
          The orthogonal matrix on the left-hand side in the
          decomposition.
          Not referenced if ITYPE=2
[in]LDV
          LDV is INTEGER
          The leading dimension of V.  LDV must be at least N and
          at least 1.
[out]WORK
          WORK is REAL array, dimension (2*N**2)
[out]RESULT
          RESULT is REAL
          The values computed by the test specified by ITYPE.  The
          value is currently limited to 1/ulp, to avoid overflow.
          Errors are flagged by RESULT=10/ulp.
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.

Definition at line 147 of file sget51.f.

149 *
150 * -- LAPACK test routine --
151 * -- LAPACK is a software package provided by Univ. of Tennessee, --
152 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
153 *
154 * .. Scalar Arguments ..
155  INTEGER ITYPE, LDA, LDB, LDU, LDV, N
156  REAL RESULT
157 * ..
158 * .. Array Arguments ..
159  REAL A( LDA, * ), B( LDB, * ), U( LDU, * ),
160  $ V( LDV, * ), WORK( * )
161 * ..
162 *
163 * =====================================================================
164 *
165 * .. Parameters ..
166  REAL ZERO, ONE, TEN
167  parameter( zero = 0.0, one = 1.0e0, ten = 10.0e0 )
168 * ..
169 * .. Local Scalars ..
170  INTEGER JCOL, JDIAG, JROW
171  REAL ANORM, ULP, UNFL, WNORM
172 * ..
173 * .. External Functions ..
174  REAL SLAMCH, SLANGE
175  EXTERNAL slamch, slange
176 * ..
177 * .. External Subroutines ..
178  EXTERNAL sgemm, slacpy
179 * ..
180 * .. Intrinsic Functions ..
181  INTRINSIC max, min, real
182 * ..
183 * .. Executable Statements ..
184 *
185  result = zero
186  IF( n.LE.0 )
187  $ RETURN
188 *
189 * Constants
190 *
191  unfl = slamch( 'Safe minimum' )
192  ulp = slamch( 'Epsilon' )*slamch( 'Base' )
193 *
194 * Some Error Checks
195 *
196  IF( itype.LT.1 .OR. itype.GT.3 ) THEN
197  result = ten / ulp
198  RETURN
199  END IF
200 *
201  IF( itype.LE.2 ) THEN
202 *
203 * Tests scaled by the norm(A)
204 *
205  anorm = max( slange( '1', n, n, a, lda, work ), unfl )
206 *
207  IF( itype.EQ.1 ) THEN
208 *
209 * ITYPE=1: Compute W = A - UBV'
210 *
211  CALL slacpy( ' ', n, n, a, lda, work, n )
212  CALL sgemm( 'N', 'N', n, n, n, one, u, ldu, b, ldb, zero,
213  $ work( n**2+1 ), n )
214 *
215  CALL sgemm( 'N', 'C', n, n, n, -one, work( n**2+1 ), n, v,
216  $ ldv, one, work, n )
217 *
218  ELSE
219 *
220 * ITYPE=2: Compute W = A - B
221 *
222  CALL slacpy( ' ', n, n, b, ldb, work, n )
223 *
224  DO 20 jcol = 1, n
225  DO 10 jrow = 1, n
226  work( jrow+n*( jcol-1 ) ) = work( jrow+n*( jcol-1 ) )
227  $ - a( jrow, jcol )
228  10 CONTINUE
229  20 CONTINUE
230  END IF
231 *
232 * Compute norm(W)/ ( ulp*norm(A) )
233 *
234  wnorm = slange( '1', n, n, work, n, work( n**2+1 ) )
235 *
236  IF( anorm.GT.wnorm ) THEN
237  result = ( wnorm / anorm ) / ( n*ulp )
238  ELSE
239  IF( anorm.LT.one ) THEN
240  result = ( min( wnorm, n*anorm ) / anorm ) / ( n*ulp )
241  ELSE
242  result = min( wnorm / anorm, real( n ) ) / ( n*ulp )
243  END IF
244  END IF
245 *
246  ELSE
247 *
248 * Tests not scaled by norm(A)
249 *
250 * ITYPE=3: Compute UU' - I
251 *
252  CALL sgemm( 'N', 'C', n, n, n, one, u, ldu, u, ldu, zero, work,
253  $ n )
254 *
255  DO 30 jdiag = 1, n
256  work( ( n+1 )*( jdiag-1 )+1 ) = work( ( n+1 )*( jdiag-1 )+
257  $ 1 ) - one
258  30 CONTINUE
259 *
260  result = min( slange( '1', n, n, work, n, work( n**2+1 ) ),
261  $ real( n ) ) / ( n*ulp )
262  END IF
263 *
264  RETURN
265 *
266 * End of SGET51
267 *
subroutine slacpy(UPLO, M, N, A, LDA, B, LDB)
SLACPY copies all or part of one two-dimensional array to another.
Definition: slacpy.f:103
real function slange(NORM, M, N, A, LDA, WORK)
SLANGE returns the value of the 1-norm, Frobenius norm, infinity-norm, or the largest absolute value ...
Definition: slange.f:114
subroutine sgemm(TRANSA, TRANSB, M, N, K, ALPHA, A, LDA, B, LDB, BETA, C, LDC)
SGEMM
Definition: sgemm.f:187
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: