FEAT 3
Finite Element Analysis Toolbox
Loading...
Searching...
No Matches
triple_dot_product_dense_generic.hpp
1// FEAT3: Finite Element Analysis Toolbox, Version 3
2// Copyright (C) 2010 by Stefan Turek & the FEAT group
3// FEAT3 is released under the GNU General Public License version 3,
4// see the file 'copyright.txt' in the top level directory for details.
5
6#pragma once
7
8#ifndef KERNEL_LAFEM_ARCH_TRIPLE_DOT_PRODUCT_DENSE_HPP
9#error "Do not include this implementation-only header file directly!"
10#endif
11
12namespace FEAT::LAFEM::Arch
13{
14 template <typename DT_>
15 DT_ TripleDotProductDense::exec_generic_impl(const DT_ * const x, const DT_ * const y, const DT_ * const z, const Index size)
16 {
17 DT_ r(0);
18
19 if (x == y)
20 {
21 FEAT_PRAGMA_OMP(parallel for reduction(+:r))
22 for (Index i = 0 ; i < size ; ++i)
23 r += x[i] * x[i] * z[i];
24 }
25 else if (x == z)
26 {
27 FEAT_PRAGMA_OMP(parallel for reduction(+:r))
28 for (Index i = 0 ; i < size ; ++i)
29 r += x[i] * x[i] * y[i];
30 }
31 else if (y == z)
32 {
33 FEAT_PRAGMA_OMP(parallel for reduction(+:r))
34 for (Index i = 0 ; i < size ; ++i)
35 r += x[i] * y[i] * y[i];
36 }
37 else
38 {
39 FEAT_PRAGMA_OMP(parallel for reduction(+:r))
40 for (Index i = 0 ; i < size ; ++i)
41 r += x[i] * y[i] * z[i];
42 }
43
44 return r;
45 }
46} // namespace FEAT::LAFEM::Arch
std::uint64_t Index
Index data type.