7#ifndef KERNEL_LAFEM_ARCH_MIRROR_GENERIC_HPP
8#define KERNEL_LAFEM_ARCH_MIRROR_GENERIC_HPP 1
10#ifndef KERNEL_LAFEM_ARCH_MIRROR_HPP
11#error "Do not include this implementation-only header file directly!"
21 template<
typename DT_,
typename IT_>
22 void Mirror::gather_dv_generic(
const Index boff,
const Index nidx,
const IT_* idx, DT_* buf,
const DT_* vec)
24 FEAT_PRAGMA_OMP(parallel
for)
25 for(
Index i = 0; i < nidx; ++i)
27 buf[boff+i] = vec[idx[i]];
31 template<
typename DT_,
typename IT_>
32 void Mirror::scatter_dv_generic(
const Index boff,
const Index nidx,
const IT_* idx,
const DT_* buf, DT_* vec,
const DT_ alpha)
34 FEAT_PRAGMA_OMP(parallel
for)
35 for(
Index i = 0; i < nidx; ++i)
37 vec[idx[i]] += alpha*buf[boff+i];
41 template<
typename DT_,
typename IT_>
42 void Mirror::gather_dvb_generic(
const Index bs,
const Index boff,
const Index nidx,
const IT_* idx, DT_* buf,
const DT_* vec)
44 FEAT_PRAGMA_OMP(parallel
for)
45 for(
Index i = 0; i < nidx; ++i)
47 for(
Index k(0); k < bs; ++k)
49 buf[boff+i*bs+k] = vec[idx[i]*bs+k];
54 template<
typename DT_,
typename IT_>
55 void Mirror::scatter_dvb_generic(
const Index bs,
const Index boff,
const Index nidx,
const IT_* idx,
const DT_* buf, DT_* vec,
const DT_ alpha)
57 FEAT_PRAGMA_OMP(parallel
for)
58 for(
Index i = 0; i < nidx; ++i)
60 for(
Index k(0); k < bs; ++k)
62 vec[idx[i]*bs+k] += alpha*buf[boff+i*bs+k];
67 template<
typename DT_,
typename IT_>
68 void Mirror::gather_sv_generic(
const Index boff,
const Index nidx,
const IT_* idx, DT_* buf,
const Index nvec,
const DT_* vval,
const IT_* vidx)
71 FEAT_PRAGMA_OMP(parallel
for)
72 for(
Index i = 0; i < nidx; ++i)
77 for(
Index j = 0; j < nvec; ++j)
81 buf[boff+i] = vval[j];
88 template<
typename DT_,
typename IT_>
89 void Mirror::scatter_sv_generic(
const Index boff,
const Index nidx,
const IT_* idx,
const DT_* buf,
const Index nvec, DT_* vval,
const IT_* vidx,
const DT_ alpha)
92 FEAT_PRAGMA_OMP(parallel
for)
93 for(
Index i = 0; i < nidx; ++i)
96 for(
Index j(0); j < nvec; ++j)
100 vval[j] += alpha*buf[boff+i];
107 template<
typename DT_,
typename IT_>
108 void Mirror::gather_svb_generic(
const Index bs,
const Index boff,
const Index nidx,
const IT_* idx, DT_* buf,
const Index nvec,
const DT_* vval,
const IT_* vidx)
110 FEAT_PRAGMA_OMP(parallel
for)
111 for(
Index i = 0; i < nidx; ++i)
113 for(
Index k(0); k < bs; ++k)
114 buf[boff+i*bs+k] = DT_(0);
116 for(
Index j(0); j < nvec; ++j)
118 if(idx[i] == vidx[j])
120 for(
Index k(0); k < bs; ++k)
121 buf[boff+i*bs+k] = vval[j*bs+k];
128 template<
typename DT_,
typename IT_>
129 void Mirror::scatter_svb_generic(
const Index bs,
const Index boff,
const Index nidx,
const IT_* idx,
const DT_* buf,
const Index nvec, DT_* vval,
const IT_* vidx,
const DT_ alpha)
131 FEAT_PRAGMA_OMP(parallel
for)
132 for(
Index i = 0; i < nidx; ++i)
134 for(
Index j(0); j < nvec; ++j)
136 if(idx[i] == vidx[j])
138 for(
Index k(0); k < bs; ++k)
139 vval[j*bs+k] += alpha*buf[boff+i*bs+k];
std::uint64_t Index
Index data type.