Commit 9a91a4e2 authored by MIJIEUX Thomas's avatar MIJIEUX Thomas

Use c++14 and Simplify traits

parent 7e28c176
......@@ -35,7 +35,7 @@ FIND_PACKAGE(OpenMP)
# Trouver un moyen de tester que le compilateur support la norme 2011
# (regarder éventuellement Simgrid/boost etc)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wextra -fmax-errors=2")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -Wall -Wextra -fmax-errors=2")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -Wall -Wextra -fmax-errors=2")
IF(OPENMP_FOUND)
......
......@@ -18,30 +18,28 @@
namespace fabulous {
template<class S> using ARNOLDI_STD = ArnoldiDR<HessDR, S>;
template<class S> using ARNOLDI_QR = ArnoldiDR<HessQR, S>;
template<class S> using ARNOLDI_QRDR = ArnoldiDR<HessQRDR, S>;
template<class S> using ARNOLDI_IB = ArnoldiIB<HessIB, S>;
template<class S> using ARNOLDI_IBDR = ArnoldiIBDR<HessIBDR, S>;
template<class S> using ARNOLDI_QRIBDR = ArnoldiIBDR<HessQRIBDR, S>;
template<class S> using ARNOLDI_STD = ArnoldiDR<HessDR<S>, S>;
template<class S> using ARNOLDI_QR = ArnoldiDR<HessQR<S>, S>;
template<class S> using ARNOLDI_QRDR = ArnoldiDR<HessQRDR<S>, S>;
template<class S> using ARNOLDI_IB = ArnoldiIB<HessIB<S>, S>;
template<class S> using ARNOLDI_IBDR = ArnoldiIBDR<HessIBDR<S>, S>;
template<class S> using ARNOLDI_QRIBDR = ArnoldiIBDR<HessQRIBDR<S>, S>;
#ifdef FABULOUS_USE_CHAMELEON
template<class S> using ARNOLDI_CHAM_QR = ArnoldiDR<HessChamQR, S>;
template<class S> using ARNOLDI_CHAM_TL = ArnoldiDR<HessChamTLDR, S>;
template<class S> using ARNOLDI_CHAM_QR = ArnoldiDR<HessChamQR<S>, S>;
template<class S> using ARNOLDI_CHAM_TL = ArnoldiDR<HessChamTLDR<S>, S>;
#endif // FABULOUS_USE_CHAMELEON
inline Algorithm<ARNOLDI_STD> arnoldi_std() { return Algorithm<ARNOLDI_STD>{}; }
inline Algorithm<ARNOLDI_QR> arnoldi_qr() { return Algorithm<ARNOLDI_QR>{}; }
inline Algorithm<ARNOLDI_QRDR> arnoldi_qrdr() { return Algorithm<ARNOLDI_QRDR>{}; }
inline Algorithm<ARNOLDI_IB> arnoldi_ib() { return Algorithm<ARNOLDI_IB>{}; }
inline Algorithm<ARNOLDI_IBDR> arnoldi_ibdr() { return Algorithm<ARNOLDI_IBDR>{}; }
inline Algorithm<ARNOLDI_QRIBDR> arnoldi_qribdr() { return Algorithm<ARNOLDI_QRIBDR>{}; }
inline auto arnoldi_std() { return Algorithm<ARNOLDI_STD>{}; }
inline auto arnoldi_qr() { return Algorithm<ARNOLDI_QR>{}; }
inline auto arnoldi_qrdr() { return Algorithm<ARNOLDI_QRDR>{}; }
inline auto arnoldi_ib() { return Algorithm<ARNOLDI_IB>{}; }
inline auto arnoldi_ibdr() { return Algorithm<ARNOLDI_IBDR>{}; }
inline auto arnoldi_qribdr() { return Algorithm<ARNOLDI_QRIBDR>{}; }
#ifdef FABULOUS_USE_CHAMELEON
inline Algorithm<ARNOLDI_CHAM_QR> arnoldi_cham_qr()
{ return Algorithm<ARNOLDI_CHAM_QR>{}; }
inline Algorithm<ARNOLDI_CHAM_TL> arnoldi_cham_tl()
{ return Algorithm<ARNOLDI_CHAM_TL>{}; }
inline auto arnoldi_cham_qr() { return Algorithm<ARNOLDI_CHAM_QR>{}; }
inline auto arnoldi_cham_tl() { return Algorithm<ARNOLDI_CHAM_TL>{}; }
#endif // FABULOUS_USE_CHAMELEON
std::ostream& operator<<(std::ostream &o, const Algorithm<ARNOLDI_STD> &)
......
......@@ -2,7 +2,7 @@
#define FABULOUS_ARNOLDI_DR_HPP
namespace fabulous {
template< template<class> class HESSENBERG, class S > class ArnoldiDR;
template<class HESSENBERG, class S> class ArnoldiDR;
};
#include "fabulous/data/Base.hpp"
......@@ -23,11 +23,11 @@ namespace fabulous {
*
* This class support DeflatedRestarting
*/
template< template<class> class HESSENBERG, class S >
template<class HESSENBERG, class S >
class ArnoldiDR
{
static_assert(
arnoldiXhessenberg<fabulous::ArnoldiDR, HESSENBERG>::value,
arnoldiXhessenberg<ArnoldiDR, HESSENBERG>::value,
"ArnoldiDR cannot be combined with this Hessenberg"
);
public:
......@@ -51,7 +51,7 @@ private:
private:
Logger<P> &_logger;
HESSENBERG<S> _hess;
HESSENBERG _hess;
bool _solution_computed;
Block<S> _solution;
Block<S> _lastY;
......
......@@ -2,7 +2,7 @@
#define FABULOUS_ARNOLDI_IB_HPP
namespace fabulous {
template<template<class> class HESSENBERG, class S> class ArnoldiIB;
template<class HESSENBERG, class S> class ArnoldiIB;
};
#include "fabulous/data/Base.hpp"
......@@ -25,11 +25,11 @@ namespace fabulous {
*
* \warning This class does NOT support DeflatedRestarting
*/
template < template<class> class HESSENBERG, class S >
template<class HESSENBERG, class S>
class ArnoldiIB
{
static_assert(
arnoldiXhessenberg<fabulous::ArnoldiIB, HESSENBERG>::value,
arnoldiXhessenberg<ArnoldiIB, HESSENBERG>::value,
"ArnoldiIB cannot be combined with this Hessenberg"
);
public:
......@@ -53,7 +53,7 @@ private:
private:
Logger<P> &_logger;
HESSENBERG<S> _F;
HESSENBERG _F;
bool _solution_computed;
Block<S> _solution;
Block<S> _last_Y;
......
......@@ -2,7 +2,7 @@
#define FABULOUS_ARNOLDI_IB_DR_HPP
namespace fabulous {
template<template<class> class HESSENBERG, class S> class ArnoldiIBDR;
template<class HESSENBERG, class S> class ArnoldiIBDR;
};
#include "fabulous/data/Base.hpp"
......@@ -22,11 +22,11 @@ namespace fabulous {
*
* the GELS kernel is used to solve the LeastSquare problem on the projected matrix
*/
template< template<class> class HESSENBERG, class S >
template<class HESSENBERG, class S >
class ArnoldiIBDR
{
static_assert(
arnoldiXhessenberg<fabulous::ArnoldiIBDR, HESSENBERG>::value,
arnoldiXhessenberg<ArnoldiIBDR, HESSENBERG>::value,
"ArnoldiIBDR cannot be combined with this Hessenberg"
);
public:
......@@ -51,7 +51,7 @@ private:
private:
Logger<P> &_logger;
HESSENBERG<S> _F;
HESSENBERG _F;
bool _solution_computed;
Block<S> _solution;
Block<S> _last_Y;
......
......@@ -9,29 +9,26 @@ namespace fabulous {
template<bool B, class T=void>
using enable_if_t = typename std::enable_if<B,T>::type;
template< template<template<class> class, class> class ARNOLDI,
template<class> class HESSENBERG> struct arnoldiXhessenberg;
template< template<class> class HESSENBERG,
class RESTARTER > struct hessenbergXrestarter;
template<template<class> class HESSENBERG, class S> class ArnoldiIB;
template<template<class> class HESSENBERG, class S> class ArnoldiDR;
template<template<class> class HESSENBERG, class S> class ArnoldiIBDR;
template< class > class HessDR;
template< class > class HessQR;
template< class > class HessQRDR;
template< class > class HessIB;
template< class > class HessIBDR;
template< class > class HessQRIBDR;
template<class ARNOLDI, class HESSENBERG> struct arnoldiXhessenberg;
template<class HESSENBERG, class RESTARTER> struct hessenbergXrestarter;
template<class HESSENBERG, class S> class ArnoldiIB;
template<class HESSENBERG, class S> class ArnoldiDR;
template<class HESSENBERG, class S> class ArnoldiIBDR;
template<class> class HessDR;
template<class> class HessQR;
template<class> class HessQRDR;
template<class> class HessIB;
template<class> class HessIBDR;
template<class> class HessQRIBDR;
#ifdef FABULOUS_USE_CHAMELEON
template< class > class HessChamTLDR;
template< class > class HessChamQR;
template<class> class HessChamTLDR;
template<class> class HessChamQR;
#endif
class ClassicRestart;
template< class > class DeflatedRestart;
template<class> class DeflatedRestart;
};
......@@ -40,15 +37,13 @@ namespace fabulous {
/**
* \brief boolean field 'value' is set whether ARNOLDI is compatible with HESSENBERG
*/
template<
template<template<class> class, class> class ARNOLDI,
template<class> class HESSENBERG >
template<class ARNOLDI, class HESSENBERG>
struct arnoldiXhessenberg : public std::false_type {};
#define FABULOUS_ARNOLDI_X_HESSENBERG(ARNOLDI, HESSENBERG) \
template<> \
struct arnoldiXhessenberg<ARNOLDI, HESSENBERG> \
: public std::true_type {}; \
#define FABULOUS_ARNOLDI_X_HESSENBERG(ARNOLDI, HESSENBERG) \
template<class S> \
struct arnoldiXhessenberg<ARNOLDI<HESSENBERG<S>, S>, HESSENBERG<S>> \
: public std::true_type {}; \
FABULOUS_ARNOLDI_X_HESSENBERG(ArnoldiDR, HessDR);
FABULOUS_ARNOLDI_X_HESSENBERG(ArnoldiDR, HessQR);
......@@ -66,20 +61,17 @@ FABULOUS_ARNOLDI_X_HESSENBERG(ArnoldiIBDR, HessQRIBDR);
/**
* \brief boolean field 'value' is set whether HESSENBERG is compatible with RESTARTER
*/
template<
template<class> class HESSENBERG,
class RESTART
>
template<class HESSENBERG, class RESTART>
struct hessenbergXrestarter : public std::false_type {};
#define FABULOUS_HESSENBERG_X_RESTARTER(HESSENBERG, RESTARTER) \
template<> \
struct hessenbergXrestarter<HESSENBERG, RESTARTER> \
template<class S> \
struct hessenbergXrestarter<HESSENBERG<S>, RESTARTER> \
: public std::true_type {}; \
#define FABULOUS_HESSENBERG_X_RESTARTER_S(HESSENBERG, RESTARTER) \
template<class S> \
struct hessenbergXrestarter<HESSENBERG, RESTARTER<S>> \
struct hessenbergXrestarter<HESSENBERG<S>, RESTARTER<S>> \
: public std::true_type {}; \
FABULOUS_HESSENBERG_X_RESTARTER(HessDR, ClassicRestart);
......@@ -122,22 +114,22 @@ FABULOUS_HESSENBERG_HANDLE_IB(HessQRIBDR);
template<class S>
struct is_complex_t : public std::false_type {};
#define FABULOUS_IS_COMPLEX(Type_S_) \
#define FABULOUS_TYPE_TRAITS_DEF_IS_COMPLEX(Type_S_) \
template<> \
struct is_complex_t<Type_S_> : public std::true_type {};
FABULOUS_IS_COMPLEX(std::complex<float>);
FABULOUS_IS_COMPLEX(std::complex<double>);
FABULOUS_TYPE_TRAITS_DEF_IS_COMPLEX(std::complex<float>);
FABULOUS_TYPE_TRAITS_DEF_IS_COMPLEX(std::complex<double>);
template<class S>
struct is_real_t : public std::false_type {};
#define FABULOUS_IS_REAL(Type_S_) \
#define FABULOUS_TYPE_TRAITS_DEF_IS_REAL(Type_S_) \
template<> \
struct is_real_t<Type_S_> : public std::true_type {};
FABULOUS_IS_REAL(float);
FABULOUS_IS_REAL(double);
FABULOUS_TYPE_TRAITS_DEF_IS_REAL(float);
FABULOUS_TYPE_TRAITS_DEF_IS_REAL(double);
#define FABULOUS
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment