LAPACK  3.4.1
LAPACK: Linear Algebra PACKage
zlansy.f
Go to the documentation of this file.
00001 *> \brief \b ZLANSY
00002 *
00003 *  =========== DOCUMENTATION ===========
00004 *
00005 * Online html documentation available at 
00006 *            http://www.netlib.org/lapack/explore-html/ 
00007 *
00008 *> \htmlonly
00009 *> Download ZLANSY + dependencies 
00010 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zlansy.f"> 
00011 *> [TGZ]</a> 
00012 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zlansy.f"> 
00013 *> [ZIP]</a> 
00014 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zlansy.f"> 
00015 *> [TXT]</a>
00016 *> \endhtmlonly 
00017 *
00018 *  Definition:
00019 *  ===========
00020 *
00021 *       DOUBLE PRECISION FUNCTION ZLANSY( NORM, UPLO, N, A, LDA, WORK )
00022 * 
00023 *       .. Scalar Arguments ..
00024 *       CHARACTER          NORM, UPLO
00025 *       INTEGER            LDA, N
00026 *       ..
00027 *       .. Array Arguments ..
00028 *       DOUBLE PRECISION   WORK( * )
00029 *       COMPLEX*16         A( LDA, * )
00030 *       ..
00031 *  
00032 *
00033 *> \par Purpose:
00034 *  =============
00035 *>
00036 *> \verbatim
00037 *>
00038 *> ZLANSY  returns the value of the one norm,  or the Frobenius norm, or
00039 *> the  infinity norm,  or the  element of  largest absolute value  of a
00040 *> complex symmetric matrix A.
00041 *> \endverbatim
00042 *>
00043 *> \return ZLANSY
00044 *> \verbatim
00045 *>
00046 *>    ZLANSY = ( max(abs(A(i,j))), NORM = 'M' or 'm'
00047 *>             (
00048 *>             ( norm1(A),         NORM = '1', 'O' or 'o'
00049 *>             (
00050 *>             ( normI(A),         NORM = 'I' or 'i'
00051 *>             (
00052 *>             ( normF(A),         NORM = 'F', 'f', 'E' or 'e'
00053 *>
00054 *> where  norm1  denotes the  one norm of a matrix (maximum column sum),
00055 *> normI  denotes the  infinity norm  of a matrix  (maximum row sum) and
00056 *> normF  denotes the  Frobenius norm of a matrix (square root of sum of
00057 *> squares).  Note that  max(abs(A(i,j)))  is not a consistent matrix norm.
00058 *> \endverbatim
00059 *
00060 *  Arguments:
00061 *  ==========
00062 *
00063 *> \param[in] NORM
00064 *> \verbatim
00065 *>          NORM is CHARACTER*1
00066 *>          Specifies the value to be returned in ZLANSY as described
00067 *>          above.
00068 *> \endverbatim
00069 *>
00070 *> \param[in] UPLO
00071 *> \verbatim
00072 *>          UPLO is CHARACTER*1
00073 *>          Specifies whether the upper or lower triangular part of the
00074 *>          symmetric matrix A is to be referenced.
00075 *>          = 'U':  Upper triangular part of A is referenced
00076 *>          = 'L':  Lower triangular part of A is referenced
00077 *> \endverbatim
00078 *>
00079 *> \param[in] N
00080 *> \verbatim
00081 *>          N is INTEGER
00082 *>          The order of the matrix A.  N >= 0.  When N = 0, ZLANSY is
00083 *>          set to zero.
00084 *> \endverbatim
00085 *>
00086 *> \param[in] A
00087 *> \verbatim
00088 *>          A is COMPLEX*16 array, dimension (LDA,N)
00089 *>          The symmetric matrix A.  If UPLO = 'U', the leading n by n
00090 *>          upper triangular part of A contains the upper triangular part
00091 *>          of the matrix A, and the strictly lower triangular part of A
00092 *>          is not referenced.  If UPLO = 'L', the leading n by n lower
00093 *>          triangular part of A contains the lower triangular part of
00094 *>          the matrix A, and the strictly upper triangular part of A is
00095 *>          not referenced.
00096 *> \endverbatim
00097 *>
00098 *> \param[in] LDA
00099 *> \verbatim
00100 *>          LDA is INTEGER
00101 *>          The leading dimension of the array A.  LDA >= max(N,1).
00102 *> \endverbatim
00103 *>
00104 *> \param[out] WORK
00105 *> \verbatim
00106 *>          WORK is DOUBLE PRECISION array, dimension (MAX(1,LWORK)),
00107 *>          where LWORK >= N when NORM = 'I' or '1' or 'O'; otherwise,
00108 *>          WORK is not referenced.
00109 *> \endverbatim
00110 *
00111 *  Authors:
00112 *  ========
00113 *
00114 *> \author Univ. of Tennessee 
00115 *> \author Univ. of California Berkeley 
00116 *> \author Univ. of Colorado Denver 
00117 *> \author NAG Ltd. 
00118 *
00119 *> \date November 2011
00120 *
00121 *> \ingroup complex16SYauxiliary
00122 *
00123 *  =====================================================================
00124       DOUBLE PRECISION FUNCTION ZLANSY( NORM, UPLO, N, A, LDA, WORK )
00125 *
00126 *  -- LAPACK auxiliary routine (version 3.4.0) --
00127 *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
00128 *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
00129 *     November 2011
00130 *
00131 *     .. Scalar Arguments ..
00132       CHARACTER          NORM, UPLO
00133       INTEGER            LDA, N
00134 *     ..
00135 *     .. Array Arguments ..
00136       DOUBLE PRECISION   WORK( * )
00137       COMPLEX*16         A( LDA, * )
00138 *     ..
00139 *
00140 * =====================================================================
00141 *
00142 *     .. Parameters ..
00143       DOUBLE PRECISION   ONE, ZERO
00144       PARAMETER          ( ONE = 1.0D+0, ZERO = 0.0D+0 )
00145 *     ..
00146 *     .. Local Scalars ..
00147       INTEGER            I, J
00148       DOUBLE PRECISION   ABSA, SCALE, SUM, VALUE
00149 *     ..
00150 *     .. External Functions ..
00151       LOGICAL            LSAME
00152       EXTERNAL           LSAME
00153 *     ..
00154 *     .. External Subroutines ..
00155       EXTERNAL           ZLASSQ
00156 *     ..
00157 *     .. Intrinsic Functions ..
00158       INTRINSIC          ABS, MAX, SQRT
00159 *     ..
00160 *     .. Executable Statements ..
00161 *
00162       IF( N.EQ.0 ) THEN
00163          VALUE = ZERO
00164       ELSE IF( LSAME( NORM, 'M' ) ) THEN
00165 *
00166 *        Find max(abs(A(i,j))).
00167 *
00168          VALUE = ZERO
00169          IF( LSAME( UPLO, 'U' ) ) THEN
00170             DO 20 J = 1, N
00171                DO 10 I = 1, J
00172                   VALUE = MAX( VALUE, ABS( A( I, J ) ) )
00173    10          CONTINUE
00174    20       CONTINUE
00175          ELSE
00176             DO 40 J = 1, N
00177                DO 30 I = J, N
00178                   VALUE = MAX( VALUE, ABS( A( I, J ) ) )
00179    30          CONTINUE
00180    40       CONTINUE
00181          END IF
00182       ELSE IF( ( LSAME( NORM, 'I' ) ) .OR. ( LSAME( NORM, 'O' ) ) .OR.
00183      $         ( NORM.EQ.'1' ) ) THEN
00184 *
00185 *        Find normI(A) ( = norm1(A), since A is symmetric).
00186 *
00187          VALUE = ZERO
00188          IF( LSAME( UPLO, 'U' ) ) THEN
00189             DO 60 J = 1, N
00190                SUM = ZERO
00191                DO 50 I = 1, J - 1
00192                   ABSA = ABS( A( I, J ) )
00193                   SUM = SUM + ABSA
00194                   WORK( I ) = WORK( I ) + ABSA
00195    50          CONTINUE
00196                WORK( J ) = SUM + ABS( A( J, J ) )
00197    60       CONTINUE
00198             DO 70 I = 1, N
00199                VALUE = MAX( VALUE, WORK( I ) )
00200    70       CONTINUE
00201          ELSE
00202             DO 80 I = 1, N
00203                WORK( I ) = ZERO
00204    80       CONTINUE
00205             DO 100 J = 1, N
00206                SUM = WORK( J ) + ABS( A( J, J ) )
00207                DO 90 I = J + 1, N
00208                   ABSA = ABS( A( I, J ) )
00209                   SUM = SUM + ABSA
00210                   WORK( I ) = WORK( I ) + ABSA
00211    90          CONTINUE
00212                VALUE = MAX( VALUE, SUM )
00213   100       CONTINUE
00214          END IF
00215       ELSE IF( ( LSAME( NORM, 'F' ) ) .OR. ( LSAME( NORM, 'E' ) ) ) THEN
00216 *
00217 *        Find normF(A).
00218 *
00219          SCALE = ZERO
00220          SUM = ONE
00221          IF( LSAME( UPLO, 'U' ) ) THEN
00222             DO 110 J = 2, N
00223                CALL ZLASSQ( J-1, A( 1, J ), 1, SCALE, SUM )
00224   110       CONTINUE
00225          ELSE
00226             DO 120 J = 1, N - 1
00227                CALL ZLASSQ( N-J, A( J+1, J ), 1, SCALE, SUM )
00228   120       CONTINUE
00229          END IF
00230          SUM = 2*SUM
00231          CALL ZLASSQ( N, A, LDA+1, SCALE, SUM )
00232          VALUE = SCALE*SQRT( SUM )
00233       END IF
00234 *
00235       ZLANSY = VALUE
00236       RETURN
00237 *
00238 *     End of ZLANSY
00239 *
00240       END
 All Files Functions