LAPACK  3.4.1
LAPACK: Linear Algebra PACKage
lsame.f
Go to the documentation of this file.
00001 *> \brief \b LSAME
00002 *
00003 *  =========== DOCUMENTATION ===========
00004 *
00005 * Online html documentation available at 
00006 *            http://www.netlib.org/lapack/explore-html/ 
00007 *
00008 *  Definition:
00009 *  ===========
00010 *
00011 *      LOGICAL FUNCTION LSAME( CA, CB )
00012 *
00013 *     .. Scalar Arguments ..
00014 *      CHARACTER          CA, CB
00015 *     ..
00016 *  
00017 *
00018 *> \par Purpose:
00019 *  =============
00020 *>
00021 *> \verbatim
00022 *>
00023 *> LSAME returns .TRUE. if CA is the same letter as CB regardless of
00024 *> case.
00025 *> \endverbatim
00026 *
00027 *  Arguments:
00028 *  ==========
00029 *
00030 *> \param[in] CA
00031 *> \verbatim
00032 *> \endverbatim
00033 *>
00034 *> \param[in] CB
00035 *> \verbatim
00036 *>          CA and CB specify the single characters to be compared.
00037 *> \endverbatim
00038 *
00039 *  Authors:
00040 *  ========
00041 *
00042 *> \author Univ. of Tennessee 
00043 *> \author Univ. of California Berkeley 
00044 *> \author Univ. of Colorado Denver 
00045 *> \author NAG Ltd. 
00046 *
00047 *> \date November 2011
00048 *
00049 *> \ingroup auxOTHERauxiliary
00050 *
00051 *  =====================================================================
00052       LOGICAL FUNCTION LSAME( CA, CB )
00053 *
00054 *  -- LAPACK auxiliary routine (version 3.4.0) --
00055 *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
00056 *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
00057 *     November 2011
00058 *
00059 *     .. Scalar Arguments ..
00060       CHARACTER          CA, CB
00061 *     ..
00062 *
00063 * =====================================================================
00064 *
00065 *     .. Intrinsic Functions ..
00066       INTRINSIC          ICHAR
00067 *     ..
00068 *     .. Local Scalars ..
00069       INTEGER            INTA, INTB, ZCODE
00070 *     ..
00071 *     .. Executable Statements ..
00072 *
00073 *     Test if the characters are equal
00074 *
00075       LSAME = CA.EQ.CB
00076       IF( LSAME )
00077      $   RETURN
00078 *
00079 *     Now test for equivalence if both characters are alphabetic.
00080 *
00081       ZCODE = ICHAR( 'Z' )
00082 *
00083 *     Use 'Z' rather than 'A' so that ASCII can be detected on Prime
00084 *     machines, on which ICHAR returns a value with bit 8 set.
00085 *     ICHAR('A') on Prime machines returns 193 which is the same as
00086 *     ICHAR('A') on an EBCDIC machine.
00087 *
00088       INTA = ICHAR( CA )
00089       INTB = ICHAR( CB )
00090 *
00091       IF( ZCODE.EQ.90 .OR. ZCODE.EQ.122 ) THEN
00092 *
00093 *        ASCII is assumed - ZCODE is the ASCII code of either lower or
00094 *        upper case 'Z'.
00095 *
00096          IF( INTA.GE.97 .AND. INTA.LE.122 ) INTA = INTA - 32
00097          IF( INTB.GE.97 .AND. INTB.LE.122 ) INTB = INTB - 32
00098 *
00099       ELSE IF( ZCODE.EQ.233 .OR. ZCODE.EQ.169 ) THEN
00100 *
00101 *        EBCDIC is assumed - ZCODE is the EBCDIC code of either lower or
00102 *        upper case 'Z'.
00103 *
00104          IF( INTA.GE.129 .AND. INTA.LE.137 .OR.
00105      $       INTA.GE.145 .AND. INTA.LE.153 .OR.
00106      $       INTA.GE.162 .AND. INTA.LE.169 ) INTA = INTA + 64
00107          IF( INTB.GE.129 .AND. INTB.LE.137 .OR.
00108      $       INTB.GE.145 .AND. INTB.LE.153 .OR.
00109      $       INTB.GE.162 .AND. INTB.LE.169 ) INTB = INTB + 64
00110 *
00111       ELSE IF( ZCODE.EQ.218 .OR. ZCODE.EQ.250 ) THEN
00112 *
00113 *        ASCII is assumed, on Prime machines - ZCODE is the ASCII code
00114 *        plus 128 of either lower or upper case 'Z'.
00115 *
00116          IF( INTA.GE.225 .AND. INTA.LE.250 ) INTA = INTA - 32
00117          IF( INTB.GE.225 .AND. INTB.LE.250 ) INTB = INTB - 32
00118       END IF
00119       LSAME = INTA.EQ.INTB
00120 *
00121 *     RETURN
00122 *
00123 *     End of LSAME
00124 *
00125       END
 All Files Functions