FEAT 3
Finite Element Analysis Toolbox
Loading...
Searching...
No Matches
axpy_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_AXPY_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 void AxpyDense::exec_generic_impl(DT_ * r, const DT_ alpha, const DT_ * const x, const Index size)
16 {
17 if (r == x)
18 {
19 DT_ alpha1 = DT_(1) + alpha;
20 FEAT_PRAGMA_OMP(parallel for)
21 for (Index i = 0 ; i < size ; ++i)
22 {
23 r[i] *= alpha1;
24 }
25 }
26 else
27 {
28 FEAT_PRAGMA_OMP(parallel for)
29 for (Index i = 0 ; i < size ; ++i)
30 {
31 r[i] += alpha * x[i];
32 }
33 }
34 }
35} // namespace FEAT::LAFEM::Arch
std::uint64_t Index
Index data type.