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
#ifndef HPC_MATVEC_ISGEMATRIX_H
#define HPC_MATVEC_ISGEMATRIX_H 1

#include <cassert>
#include <type_traits>
#include <hpc/aux/iscomplex.h>
#include <hpc/matvec/gematrix.h>

namespace hpc { namespace matvec {

template <typename Matrix>
struct IsGeMatrix
{
    struct Two {
        char a, b;
    };

    template <typename T, typename I>
        static char
        checker(const GeMatrix<T, I> &);

    template <typename T, typename I>
        static char
        checker(const GeMatrixView<T, I> &);

    template <typename T, typename I>
        static char
        checker(const GeMatrixConstView<T, I> &);

    template <typename T>
        static Two
        checker(const T &);

    static Matrix   matrix;
    static const bool value = sizeof(checker(matrix)) == 1;
};

template <typename Matrix>
struct IsRealGeMatrix
{
    typedef typename Matrix::ElementType    T;

    static const bool value = IsGeMatrix<Matrix>::value
                          && !aux::IsComplex<T>::value;
};

template <typename Matrix>
struct IsComplexGeMatrix
{
    typedef typename Matrix::ElementType    T;

    static const bool value = IsGeMatrix<Matrix>::value
                           && aux::IsComplex<T>::value;
};

} } // namespace matvec, hpc

#endif // HPC_MATVEC_ISGEMATRIX_H