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
      93
      94
      95
      96
      97
      98
      99
     100
     101
     102
     103
     104
     105
     106
     107
     108
     109
     110
     111
     112
     113
     114
     115
     116
     117
     118
     119
     120
     121
     122
     123
     124
     125
     126
     127
     128
     129
     130
     131
     132
     133
     134
     135
     136
#ifndef FLENS_LAPACK_INTERFACE_INCLUDE_CONFIG_H
#define FLENS_LAPACK_INTERFACE_INCLUDE_CONFIG_H 1

#include <complex>
#include <iomanip>
#include <iostream>

#ifdef LAPACK_DECL
#   undef   LAPACK_DECL
#endif
#define  LAPACK_DECL(x)     x##_

//#define FLENS_DEFAULT_INDEXTYPE long
//#define INTEGER                 long

#ifndef LOGICAL
#define LOGICAL             int
#endif

//
//  define typedefs for FLENS matrix and vector types
//
#ifndef USE_CXXLAPACK
#define USE_CXXLAPACK
#endif

#include <flens/flens.cxx>

#ifndef INTEGER
#define INTEGER             int
#endif // INTEGER

#define DOUBLE              double
#define DOUBLE_COMPLEX      double
#define CXX_DOUBLE_COMPLEX  std::complex<double>


extern "C" {

void
LAPACK_DECL(xerbla)(const char *SRNAME, const INTEGER *INFO, int SRNAME_LEN);

// extern "C"

#define LAPACK_ERROR(name, info)   LAPACK_DECL(xerbla)(name, info, strlen(name))

namespace flens {

template <typename ENUM>
typename RestrictTo<IsSame<ENUM,Transpose>::value,
                    Transpose>::Type
convertTo(const char c)
{
    if (c=='N') {
        return NoTrans;
    } else if (c=='T') {
        return Trans;
    } else if (c=='C') {
        return ConjTrans;
    } else if (c=='R') {
        return Conj;
    }
    std::cerr << "c = " << c << std::endl;
    ASSERT(0);
    return NoTrans;
}


// matrix/vector types with DOUBLE
typedef BandStorageView<double, ColMajor>                DBSView;
typedef ConstBandStorageView<double, ColMajor>           DConstBSView;

typedef GbMatrix<DBSView>                                DGbMatrixView;
typedef GbMatrix<DConstBSView>                           DConstGbMatrixView;

typedef FullStorageView<DOUBLE, cxxblas::ColMajor>       DFSView;
typedef ConstFullStorageView<DOUBLE, cxxblas::ColMajor>  DConstFSView;

typedef GeMatrix<DFSView>                                DGeMatrixView;
typedef GeMatrix<DConstFSView>                           DConstGeMatrixView;

typedef TrMatrix<DFSView>                                DTrMatrixView;
typedef TrMatrix<DConstFSView>                           DConstTrMatrixView;

typedef SyMatrix<DFSView>                                DSyMatrixView;
typedef SyMatrix<DConstFSView>                           DConstSyMatrixView;

typedef ArrayView<DOUBLE>                                DArrayView;
typedef DenseVector<DArrayView>                          DDenseVectorView;

typedef ConstArrayView<DOUBLE>                           DConstArrayView;
typedef DenseVector<DConstArrayView>                     DConstDenseVectorView;

// matrix/vector types with CXX_DOUBLE_COMPLEX
typedef FullStorageView<CXX_DOUBLE_COMPLEX,
                        cxxblas::ColMajor>               ZFSView;
typedef ConstFullStorageView<CXX_DOUBLE_COMPLEX,
                             cxxblas::ColMajor>          ZConstFSView;

typedef GeMatrix<ZFSView>                                ZGeMatrixView;
typedef GeMatrix<ZConstFSView>                           ZConstGeMatrixView;

typedef SyMatrix<ZFSView>                                ZSyMatrixView;
typedef SyMatrix<ZConstFSView>                           ZConstSyMatrixView;

typedef HeMatrix<ZFSView>                                ZHeMatrixView;
typedef HeMatrix<ZConstFSView>                           ZConstHeMatrixView;

typedef TrMatrix<ZFSView>                                ZTrMatrixView;
typedef TrMatrix<ZConstFSView>                           ZConstTrMatrixView;

typedef ArrayView<CXX_DOUBLE_COMPLEX>                    ZArrayView;
typedef DenseVector<ZArrayView>                          ZDenseVectorView;

typedef ConstArrayView<CXX_DOUBLE_COMPLEX>               ZConstArrayView;
typedef DenseVector<ZConstArrayView>                     ZConstDenseVectorView;

// matrix/vector types with bool
// TODO: using "bool" should be possible too
typedef Array<LOGICAL>                                   BArray;
typedef ArrayView<LOGICAL>                               BArrayView;
typedef DenseVector<BArray>                              BDenseVector;
typedef DenseVector<BArrayView>                          BDenseVectorView;

// matrix/vector types with INTEGER
typedef Array<INTEGER>                                   IArray;
typedef ArrayView<INTEGER>                               IArrayView;
typedef ConstArrayView<INTEGER>                          IConstArrayView;
typedef DenseVector<IArray>                              IDenseVector;
typedef DenseVector<IArrayView>                          IDenseVectorView;
typedef DenseVector<IConstArrayView>                     IConstDenseVectorView;


// namespace flens

#endif // FLENS_LAPACK_INTERFACE_INCLUDE_CONFIG_H