LAPACK 3.3.0

zlsets.f

Go to the documentation of this file.
00001       SUBROUTINE ZLSETS( M, P, N, A, AF, LDA, B, BF, LDB, C, CF, D, DF,
00002      $                   X, WORK, LWORK, RWORK, RESULT )
00003 *
00004 *  -- LAPACK test routine (version 3.1) --
00005 *     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
00006 *     November 2006
00007 *
00008 *     .. Scalar Arguments ..
00009       INTEGER            LDA, LDB, LWORK, M, N, P
00010 *     ..
00011 *     .. Array Arguments ..
00012 *
00013 *  Purpose
00014 *  =======
00015 *
00016 *  ZLSETS tests ZGGLSE - a subroutine for solving linear equality
00017 *  constrained least square problem (LSE).
00018 *
00019 *  Arguments
00020 *  =========
00021 *
00022 *  M       (input) INTEGER
00023 *          The number of rows of the matrix A.  M >= 0.
00024 *
00025 *  P       (input) INTEGER
00026 *          The number of rows of the matrix B.  P >= 0.
00027 *
00028 *  N       (input) INTEGER
00029 *          The number of columns of the matrices A and B.  N >= 0.
00030 *
00031 *  A       (input) COMPLEX*16 array, dimension (LDA,N)
00032 *          The M-by-N matrix A.
00033 *
00034 *  AF      (workspace) COMPLEX*16 array, dimension (LDA,N)
00035 *
00036 *  LDA     (input) INTEGER
00037 *          The leading dimension of the arrays A, AF, Q and R.
00038 *          LDA >= max(M,N).
00039 *
00040 *  B       (input) COMPLEX*16 array, dimension (LDB,N)
00041 *          The P-by-N matrix A.
00042 *
00043 *  BF      (workspace) COMPLEX*16 array, dimension (LDB,N)
00044 *
00045 *  LDB     (input) INTEGER
00046 *          The leading dimension of the arrays B, BF, V and S.
00047 *          LDB >= max(P,N).
00048 *
00049 *  C       (input) COMPLEX*16 array, dimension( M )
00050 *          the vector C in the LSE problem.
00051 *
00052 *  CF      (workspace) COMPLEX*16 array, dimension( M )
00053 *
00054 *  D       (input) COMPLEX*16 array, dimension( P )
00055 *          the vector D in the LSE problem.
00056 *
00057 *  DF      (workspace) COMPLEX*16 array, dimension( P )
00058 *
00059 *  X       (output) COMPLEX*16 array, dimension( N )
00060 *          solution vector X in the LSE problem.
00061 *
00062 *  WORK    (workspace) COMPLEX*16 array, dimension (LWORK)
00063 *
00064 *  LWORK   (input) INTEGER
00065 *          The dimension of the array WORK.
00066 *
00067 *  RWORK   (workspace) DOUBLE PRECISION array, dimension (M)
00068 *
00069 *  RESULT  (output) DOUBLE PRECISION array, dimension (2)
00070 *          The test ratios:
00071 *            RESULT(1) = norm( A*x - c )/ norm(A)*norm(X)*EPS
00072 *            RESULT(2) = norm( B*x - d )/ norm(B)*norm(X)*EPS
00073 *
00074 *  ====================================================================
00075 *
00076       DOUBLE PRECISION   RESULT( 2 ), RWORK( * )
00077       COMPLEX*16         A( LDA, * ), AF( LDA, * ), B( LDB, * ),
00078      $                   BF( LDB, * ), C( * ), CF( * ), D( * ), DF( * ),
00079      $                   WORK( LWORK ), X( * )
00080 *     ..
00081 *     .. Local Scalars ..
00082       INTEGER            INFO
00083 *     ..
00084 *     .. External Subroutines ..
00085       EXTERNAL           ZCOPY, ZGET02, ZGGLSE, ZLACPY
00086 *     ..
00087 *     .. Executable Statements ..
00088 *
00089 *     Copy the matrices A and B to the arrays AF and BF,
00090 *     and the vectors C and D to the arrays CF and DF,
00091 *
00092       CALL ZLACPY( 'Full', M, N, A, LDA, AF, LDA )
00093       CALL ZLACPY( 'Full', P, N, B, LDB, BF, LDB )
00094       CALL ZCOPY( M, C, 1, CF, 1 )
00095       CALL ZCOPY( P, D, 1, DF, 1 )
00096 *
00097 *     Solve LSE problem
00098 *
00099       CALL ZGGLSE( M, N, P, AF, LDA, BF, LDB, CF, DF, X, WORK, LWORK,
00100      $             INFO )
00101 *
00102 *     Test the residual for the solution of LSE
00103 *
00104 *     Compute RESULT(1) = norm( A*x - c ) / norm(A)*norm(X)*EPS
00105 *
00106       CALL ZCOPY( M, C, 1, CF, 1 )
00107       CALL ZCOPY( P, D, 1, DF, 1 )
00108       CALL ZGET02( 'No transpose', M, N, 1, A, LDA, X, N, CF, M, RWORK,
00109      $             RESULT( 1 ) )
00110 *
00111 *     Compute result(2) = norm( B*x - d ) / norm(B)*norm(X)*EPS
00112 *
00113       CALL ZGET02( 'No transpose', P, N, 1, B, LDB, X, N, DF, P, RWORK,
00114      $             RESULT( 2 ) )
00115 *
00116       RETURN
00117 *
00118 *     End of ZLSETS
00119 *
00120       END
 All Files Functions