Skip to content
Snippets Groups Projects
Commit 14375621 authored by Dominic Kempf's avatar Dominic Kempf
Browse files

Add traits to extract the underlying scalar type from vectors

parent dcbf6b58
No related branches found
No related tags found
No related merge requests found
......@@ -30,6 +30,29 @@
#include <numeric>
template<typename T>
struct base_floatingpoint
{};
template<>
struct base_floatingpoint<_vcl::Vec4d>
{
using value = double;
}
template<>
struct base_floatingpoint<_vcl::Vec8d>
{
using value = double;
}
template<>
struct base_floatingpoint<_vcl::Vec8f>
{
using value = float;
}
struct Vec4d
{
oc::OpCounter<double> _d[4];
......@@ -111,6 +134,11 @@ struct Vec4d
};
template<>
struct base_floatingpoint<Vec4d>
{
using value = typename Vec4d::F;
}
/*****************************************************************************
*
......@@ -776,6 +804,11 @@ struct Vec8d
};
template<>
struct base_floatingpoint<Vec8d>
{
using value = typename Vec8d::F;
}
/*****************************************************************************
*
......@@ -1196,6 +1229,11 @@ struct Vec8f
};
template<>
struct base_floatingpoint<Vec8f>
{
using value = typename Vec8f::F;
}
/*****************************************************************************
*
......
#ifndef DUNE_PERFTOOL_SUMFACT_HORIZONTALADD_HH
#define DUNE_PERFTOOL_SUMFACT_HORIZONTALADD_HH
#include<dune/perftool/common/vectorclass.hh>
template<class V>
double horizontal_add_lower(const V& x)
typename base_floatingpoint<V>::value horizontal_add_lower(const V& x)
{
return horizontal_add(x.get_low());
}
template<class V>
double horizontal_add_upper(const V& x)
typename base_floatingpoint<V>::value horizontal_add_upper(const V& x)
{
return horizontal_add(x.get_high());
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment