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