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 *>          CA is CHARACTER*1
00033 *> \endverbatim
00034 *>
00035 *> \param[in] CB
00036 *> \verbatim
00037 *>          CB is CHARACTER*1
00038 *>          CA and CB specify the single characters to be compared.
00039 *> \endverbatim
00040 *
00041 *  Authors:
00042 *  ========
00043 *
00044 *> \author Univ. of Tennessee 
00045 *> \author Univ. of California Berkeley 
00046 *> \author Univ. of Colorado Denver 
00047 *> \author NAG Ltd. 
00048 *
00049 *> \date November 2011
00050 *
00051 *> \ingroup aux_blas
00052 *
00053 *  =====================================================================
00054       LOGICAL FUNCTION LSAME(CA,CB)
00055 *
00056 *  -- Reference BLAS level1 routine (version 3.1) --
00057 *  -- Reference BLAS is a software package provided by Univ. of Tennessee,    --
00058 *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
00059 *     November 2011
00060 *
00061 *     .. Scalar Arguments ..
00062       CHARACTER CA,CB
00063 *     ..
00064 *
00065 * =====================================================================
00066 *
00067 *     .. Intrinsic Functions ..
00068       INTRINSIC ICHAR
00069 *     ..
00070 *     .. Local Scalars ..
00071       INTEGER INTA,INTB,ZCODE
00072 *     ..
00073 *
00074 *     Test if the characters are equal
00075 *
00076       LSAME = CA .EQ. CB
00077       IF (LSAME) 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