1
      2
      3
      4
      5
      6
      7
      8
      9
     10
     11
     12
     13
     14
     15
     16
     17
     18
     19
     20
     21
     22
     23
     24
     25
     26
     27
     28
     29
     30
     31
     32
     33
     34
     35
     36
     37
     38
     39
     40
     41
     42
     43
     44
     45
     46
     47
     48
     49
     50
     51
     52
     53
     54
     55
     56
     57
     58
     59
     60
     61
     62
     63
     64
     65
     66
     67
     68
     69
     70
     71
     72
     73
     74
     75
     76
     77
     78
     79
     80
     81
     82
     83
     84
     85
     86
     87
     88
     89
     90
     91
     92
#ifndef FLENS_AUXILIARY_CXXF77BLAS_TCC
#define FLENS_AUXILIARY_CXXF77BLAS_TCC 1

#include <flens/auxiliary/cxxf77blas.h>
#include <flens/auxiliary/macros.h>

namespace flens { namespace cxxf77blas {

template <typename ENUM>
typename std::enable_if<std::is_same<ENUM,Transpose>::value, char>::type
getF77BlasChar(ENUM trans)
{
    if (trans==NoTrans) {
        return 'N';
    } else if (trans==Trans) {
        return 'T';
    } else if (trans==Conj) {
        return 'R';
    } else if (trans==ConjTrans) {
        return 'C';
    } else {
        ASSERT(0);
        return '?';
    }
}

template <typename ENUM>
typename std::enable_if<std::is_same<ENUM,Diag>::value, char>::type
getF77BlasChar(ENUM diag)
{
    if (diag==Unit) {
        return 'U';
    }
    return 'N';
}

template <typename ENUM>
typename std::enable_if<std::is_same<ENUM,StorageUpLo>::value, char>::type
getF77BlasChar(ENUM upLo)
{
    if (upLo==Upper) {
        return 'U';
    }
    return 'L';
}

//------------------------------------------------------------------------------
template <typename ENUM>
typename std::enable_if<std::is_same<ENUM,Transpose>::value,
                        Transpose>::type
getCxxBlasEnum(char trans)
{
    if ((trans=='N') || (trans=='n')) {
        return NoTrans;
    } else if ((trans=='T') || (trans=='t')) {
        return Trans;
    } else if ((trans=='C') || (trans=='c')) {
        return ConjTrans;
    } else if ((trans=='R') || (trans=='r')) {
        return Conj;
    }
    ASSERT(0);
    return NoTrans;
}

template <typename ENUM>
typename std::enable_if<std::is_same<ENUM,Diag>::value,
                        Diag>::type
getCxxBlasEnum(char diag)
{
    if (diag=='U') {
        return Unit;
    }
    ASSERT(diag=='N');
    return NonUnit;
}

template <typename ENUM>
typename std::enable_if<std::is_same<ENUM,StorageUpLo>::value,
                        StorageUpLo>::type
getCxxBlasEnum(char upLo)
{
    if (upLo=='U') {
        return Upper;
    }
    ASSERT(upLo=='L');
    return Lower;
}

} } // namespace cxxf77blas, flens

#endif // FLENS_AUXILIARY_CXXF77BLAS_TCC