2015-07-25 17:41:16 +00:00
|
|
|
#ifndef id8949C80C36BA42CABC49EA4C1DB54BC7
|
|
|
|
#define id8949C80C36BA42CABC49EA4C1DB54BC7
|
|
|
|
|
|
|
|
#include "vectorwrapper.hpp"
|
|
|
|
#include <type_traits>
|
|
|
|
#include <cstddef>
|
|
|
|
|
|
|
|
namespace vwr {
|
|
|
|
template <typename V1, typename V2, std::size_t S>
|
|
|
|
typename std::common_type<typename Vec<V1>::scalar_type, typename Vec<V2>::scalar_type>::type dot ( const Vec<V1, S>& parLeft, const Vec<V2, S>& parRight );
|
|
|
|
|
|
|
|
template <typename V1, typename V2, std::size_t S>
|
|
|
|
inline typename std::common_type<typename Vec<V1>::scalar_type, typename Vec<V2>::scalar_type>::type dot (const Vec<V1, S>& parLeft, const Vec<V2, S>& parRight) {
|
|
|
|
auto retval = parLeft.x() * parRight.x();
|
2016-09-05 19:30:17 +00:00
|
|
|
for (std::size_t z = 1; z < S; ++z) {
|
2015-07-25 17:41:16 +00:00
|
|
|
retval += parLeft[z] * parRight[z];
|
|
|
|
}
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
} //namespace vwr
|
|
|
|
|
|
|
|
#endif
|