LAPACK 3.3.0

claqsy.f

Go to the documentation of this file.
00001       SUBROUTINE CLAQSY( UPLO, N, A, LDA, S, SCOND, AMAX, EQUED )
00002 *
00003 *  -- LAPACK auxiliary routine (version 3.2) --
00004 *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
00005 *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
00006 *     November 2006
00007 *
00008 *     .. Scalar Arguments ..
00009       CHARACTER          EQUED, UPLO
00010       INTEGER            LDA, N
00011       REAL               AMAX, SCOND
00012 *     ..
00013 *     .. Array Arguments ..
00014       REAL               S( * )
00015       COMPLEX            A( LDA, * )
00016 *     ..
00017 *
00018 *  Purpose
00019 *  =======
00020 *
00021 *  CLAQSY equilibrates a symmetric matrix A using the scaling factors
00022 *  in the vector S.
00023 *
00024 *  Arguments
00025 *  =========
00026 *
00027 *  UPLO    (input) CHARACTER*1
00028 *          Specifies whether the upper or lower triangular part of the
00029 *          symmetric matrix A is stored.
00030 *          = 'U':  Upper triangular
00031 *          = 'L':  Lower triangular
00032 *
00033 *  N       (input) INTEGER
00034 *          The order of the matrix A.  N >= 0.
00035 *
00036 *  A       (input/output) COMPLEX array, dimension (LDA,N)
00037 *          On entry, the symmetric matrix A.  If UPLO = 'U', the leading
00038 *          n by n upper triangular part of A contains the upper
00039 *          triangular part of the matrix A, and the strictly lower
00040 *          triangular part of A is not referenced.  If UPLO = 'L', the
00041 *          leading n by n lower triangular part of A contains the lower
00042 *          triangular part of the matrix A, and the strictly upper
00043 *          triangular part of A is not referenced.
00044 *
00045 *          On exit, if EQUED = 'Y', the equilibrated matrix:
00046 *          diag(S) * A * diag(S).
00047 *
00048 *  LDA     (input) INTEGER
00049 *          The leading dimension of the array A.  LDA >= max(N,1).
00050 *
00051 *  S       (input) REAL array, dimension (N)
00052 *          The scale factors for A.
00053 *
00054 *  SCOND   (input) REAL
00055 *          Ratio of the smallest S(i) to the largest S(i).
00056 *
00057 *  AMAX    (input) REAL
00058 *          Absolute value of largest matrix entry.
00059 *
00060 *  EQUED   (output) CHARACTER*1
00061 *          Specifies whether or not equilibration was done.
00062 *          = 'N':  No equilibration.
00063 *          = 'Y':  Equilibration was done, i.e., A has been replaced by
00064 *                  diag(S) * A * diag(S).
00065 *
00066 *  Internal Parameters
00067 *  ===================
00068 *
00069 *  THRESH is a threshold value used to decide if scaling should be done
00070 *  based on the ratio of the scaling factors.  If SCOND < THRESH,
00071 *  scaling is done.
00072 *
00073 *  LARGE and SMALL are threshold values used to decide if scaling should
00074 *  be done based on the absolute size of the largest matrix element.
00075 *  If AMAX > LARGE or AMAX < SMALL, scaling is done.
00076 *
00077 *  =====================================================================
00078 *
00079 *     .. Parameters ..
00080       REAL               ONE, THRESH
00081       PARAMETER          ( ONE = 1.0E+0, THRESH = 0.1E+0 )
00082 *     ..
00083 *     .. Local Scalars ..
00084       INTEGER            I, J
00085       REAL               CJ, LARGE, SMALL
00086 *     ..
00087 *     .. External Functions ..
00088       LOGICAL            LSAME
00089       REAL               SLAMCH
00090       EXTERNAL           LSAME, SLAMCH
00091 *     ..
00092 *     .. Executable Statements ..
00093 *
00094 *     Quick return if possible
00095 *
00096       IF( N.LE.0 ) THEN
00097          EQUED = 'N'
00098          RETURN
00099       END IF
00100 *
00101 *     Initialize LARGE and SMALL.
00102 *
00103       SMALL = SLAMCH( 'Safe minimum' ) / SLAMCH( 'Precision' )
00104       LARGE = ONE / SMALL
00105 *
00106       IF( SCOND.GE.THRESH .AND. AMAX.GE.SMALL .AND. AMAX.LE.LARGE ) THEN
00107 *
00108 *        No equilibration
00109 *
00110          EQUED = 'N'
00111       ELSE
00112 *
00113 *        Replace A by diag(S) * A * diag(S).
00114 *
00115          IF( LSAME( UPLO, 'U' ) ) THEN
00116 *
00117 *           Upper triangle of A is stored.
00118 *
00119             DO 20 J = 1, N
00120                CJ = S( J )
00121                DO 10 I = 1, J
00122                   A( I, J ) = CJ*S( I )*A( I, J )
00123    10          CONTINUE
00124    20       CONTINUE
00125          ELSE
00126 *
00127 *           Lower triangle of A is stored.
00128 *
00129             DO 40 J = 1, N
00130                CJ = S( J )
00131                DO 30 I = J, N
00132                   A( I, J ) = CJ*S( I )*A( I, J )
00133    30          CONTINUE
00134    40       CONTINUE
00135          END IF
00136          EQUED = 'Y'
00137       END IF
00138 *
00139       RETURN
00140 *
00141 *     End of CLAQSY
00142 *
00143       END
 All Files Functions