LAPACK 3.3.0

zlansy.f

Go to the documentation of this file.
00001       DOUBLE PRECISION FUNCTION ZLANSY( NORM, UPLO, N, A, LDA, WORK )
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          NORM, UPLO
00010       INTEGER            LDA, N
00011 *     ..
00012 *     .. Array Arguments ..
00013       DOUBLE PRECISION   WORK( * )
00014       COMPLEX*16         A( LDA, * )
00015 *     ..
00016 *
00017 *  Purpose
00018 *  =======
00019 *
00020 *  ZLANSY  returns the value of the one norm,  or the Frobenius norm, or
00021 *  the  infinity norm,  or the  element of  largest absolute value  of a
00022 *  complex symmetric matrix A.
00023 *
00024 *  Description
00025 *  ===========
00026 *
00027 *  ZLANSY returns the value
00028 *
00029 *     ZLANSY = ( max(abs(A(i,j))), NORM = 'M' or 'm'
00030 *              (
00031 *              ( norm1(A),         NORM = '1', 'O' or 'o'
00032 *              (
00033 *              ( normI(A),         NORM = 'I' or 'i'
00034 *              (
00035 *              ( normF(A),         NORM = 'F', 'f', 'E' or 'e'
00036 *
00037 *  where  norm1  denotes the  one norm of a matrix (maximum column sum),
00038 *  normI  denotes the  infinity norm  of a matrix  (maximum row sum) and
00039 *  normF  denotes the  Frobenius norm of a matrix (square root of sum of
00040 *  squares).  Note that  max(abs(A(i,j)))  is not a consistent matrix norm.
00041 *
00042 *  Arguments
00043 *  =========
00044 *
00045 *  NORM    (input) CHARACTER*1
00046 *          Specifies the value to be returned in ZLANSY as described
00047 *          above.
00048 *
00049 *  UPLO    (input) CHARACTER*1
00050 *          Specifies whether the upper or lower triangular part of the
00051 *          symmetric matrix A is to be referenced.
00052 *          = 'U':  Upper triangular part of A is referenced
00053 *          = 'L':  Lower triangular part of A is referenced
00054 *
00055 *  N       (input) INTEGER
00056 *          The order of the matrix A.  N >= 0.  When N = 0, ZLANSY is
00057 *          set to zero.
00058 *
00059 *  A       (input) COMPLEX*16 array, dimension (LDA,N)
00060 *          The symmetric matrix A.  If UPLO = 'U', the leading n by n
00061 *          upper triangular part of A contains the upper triangular part
00062 *          of the matrix A, and the strictly lower triangular part of A
00063 *          is not referenced.  If UPLO = 'L', the leading n by n lower
00064 *          triangular part of A contains the lower triangular part of
00065 *          the matrix A, and the strictly upper triangular part of A is
00066 *          not referenced.
00067 *
00068 *  LDA     (input) INTEGER
00069 *          The leading dimension of the array A.  LDA >= max(N,1).
00070 *
00071 *  WORK    (workspace) DOUBLE PRECISION array, dimension (MAX(1,LWORK)),
00072 *          where LWORK >= N when NORM = 'I' or '1' or 'O'; otherwise,
00073 *          WORK is not referenced.
00074 *
00075 * =====================================================================
00076 *
00077 *     .. Parameters ..
00078       DOUBLE PRECISION   ONE, ZERO
00079       PARAMETER          ( ONE = 1.0D+0, ZERO = 0.0D+0 )
00080 *     ..
00081 *     .. Local Scalars ..
00082       INTEGER            I, J
00083       DOUBLE PRECISION   ABSA, SCALE, SUM, VALUE
00084 *     ..
00085 *     .. External Functions ..
00086       LOGICAL            LSAME
00087       EXTERNAL           LSAME
00088 *     ..
00089 *     .. External Subroutines ..
00090       EXTERNAL           ZLASSQ
00091 *     ..
00092 *     .. Intrinsic Functions ..
00093       INTRINSIC          ABS, MAX, SQRT
00094 *     ..
00095 *     .. Executable Statements ..
00096 *
00097       IF( N.EQ.0 ) THEN
00098          VALUE = ZERO
00099       ELSE IF( LSAME( NORM, 'M' ) ) THEN
00100 *
00101 *        Find max(abs(A(i,j))).
00102 *
00103          VALUE = ZERO
00104          IF( LSAME( UPLO, 'U' ) ) THEN
00105             DO 20 J = 1, N
00106                DO 10 I = 1, J
00107                   VALUE = MAX( VALUE, ABS( A( I, J ) ) )
00108    10          CONTINUE
00109    20       CONTINUE
00110          ELSE
00111             DO 40 J = 1, N
00112                DO 30 I = J, N
00113                   VALUE = MAX( VALUE, ABS( A( I, J ) ) )
00114    30          CONTINUE
00115    40       CONTINUE
00116          END IF
00117       ELSE IF( ( LSAME( NORM, 'I' ) ) .OR. ( LSAME( NORM, 'O' ) ) .OR.
00118      $         ( NORM.EQ.'1' ) ) THEN
00119 *
00120 *        Find normI(A) ( = norm1(A), since A is symmetric).
00121 *
00122          VALUE = ZERO
00123          IF( LSAME( UPLO, 'U' ) ) THEN
00124             DO 60 J = 1, N
00125                SUM = ZERO
00126                DO 50 I = 1, J - 1
00127                   ABSA = ABS( A( I, J ) )
00128                   SUM = SUM + ABSA
00129                   WORK( I ) = WORK( I ) + ABSA
00130    50          CONTINUE
00131                WORK( J ) = SUM + ABS( A( J, J ) )
00132    60       CONTINUE
00133             DO 70 I = 1, N
00134                VALUE = MAX( VALUE, WORK( I ) )
00135    70       CONTINUE
00136          ELSE
00137             DO 80 I = 1, N
00138                WORK( I ) = ZERO
00139    80       CONTINUE
00140             DO 100 J = 1, N
00141                SUM = WORK( J ) + ABS( A( J, J ) )
00142                DO 90 I = J + 1, N
00143                   ABSA = ABS( A( I, J ) )
00144                   SUM = SUM + ABSA
00145                   WORK( I ) = WORK( I ) + ABSA
00146    90          CONTINUE
00147                VALUE = MAX( VALUE, SUM )
00148   100       CONTINUE
00149          END IF
00150       ELSE IF( ( LSAME( NORM, 'F' ) ) .OR. ( LSAME( NORM, 'E' ) ) ) THEN
00151 *
00152 *        Find normF(A).
00153 *
00154          SCALE = ZERO
00155          SUM = ONE
00156          IF( LSAME( UPLO, 'U' ) ) THEN
00157             DO 110 J = 2, N
00158                CALL ZLASSQ( J-1, A( 1, J ), 1, SCALE, SUM )
00159   110       CONTINUE
00160          ELSE
00161             DO 120 J = 1, N - 1
00162                CALL ZLASSQ( N-J, A( J+1, J ), 1, SCALE, SUM )
00163   120       CONTINUE
00164          END IF
00165          SUM = 2*SUM
00166          CALL ZLASSQ( N, A, LDA+1, SCALE, SUM )
00167          VALUE = SCALE*SQRT( SUM )
00168       END IF
00169 *
00170       ZLANSY = VALUE
00171       RETURN
00172 *
00173 *     End of ZLANSY
00174 *
00175       END
 All Files Functions