7#ifndef KERNEL_LAFEM_ARCH_UNIT_FILTER_BLOCKED_GENERIC_HPP
8#define KERNEL_LAFEM_ARCH_UNIT_FILTER_BLOCKED_GENERIC_HPP 1
10#ifndef KERNEL_LAFEM_ARCH_UNIT_FILTER_BLOCKED_HPP
11#error "Do not include this implementation-only header file directly!"
14#include <kernel/util/math.hpp>
23 template <
typename DT_,
typename IT_>
24 void UnitFilterBlocked::filter_rhs_generic(DT_ * v,
int block_size,
const DT_ *
const sv_elements,
const IT_ *
const sv_indices,
const Index ue,
bool ign_nans)
28 FEAT_PRAGMA_OMP(parallel
for)
29 for(
Index i = 0; i < ue; ++i)
34 v[
Index(block_size) * sv_indices[i] + j] = sv_elements[
Index(block_size) * i +
Index(j)];
40 FEAT_PRAGMA_OMP(parallel
for)
41 for(
Index i = 0; i < ue; ++i)
45 v[
Index(block_size) * sv_indices[i] + j] = sv_elements[
Index(block_size) * i + j];
51 template <
typename DT_,
typename IT_>
52 void UnitFilterBlocked::filter_def_generic(DT_ * v,
int block_size,
const DT_ *
const sv_elements,
const IT_ *
const sv_indices,
const Index ue,
bool ign_nans)
56 FEAT_PRAGMA_OMP(parallel
for)
57 for(
Index i = 0; i < ue; ++i)
62 v[
Index(block_size) * sv_indices[i] + j] = DT_(0);
68 FEAT_PRAGMA_OMP(parallel
for)
69 for(
Index i = 0; i < ue; ++i)
72 v[
Index(block_size) * sv_indices[i] + j] = DT_(0);
77 template<
typename DT_,
typename IT_>
78 void UnitFilterBlocked::filter_unit_mat_generic(DT_* mat,
const IT_*
const row_ptr,
const IT_*
const col_idx,
int block_height,
int block_width,
79 const DT_ *
const sv_elements,
const IT_ *
const sv_indices,
const Index ue,
bool ign_nans)
81 FEAT_PRAGMA_OMP(parallel
for)
82 for(
Index i = 0; i < ue; ++i)
84 const IT_ ix(sv_indices[i]);
85 const DT_*
const vx(&sv_elements[i*
Index(block_height)]);
88 for(IT_ j(row_ptr[ix]); j < row_ptr[ix + 1]; ++j)
91 for(
int k(0); k < block_height; ++k)
96 for(
int l(0); l < block_width; ++l)
98 if((col_idx[j] == ix) && (k < block_width))
99 mat[
Index(j)*
Index(block_height*block_width) +
Index(k*block_width + k)] = DT_(1);
105 template<
typename DT_,
typename IT_>
106 void UnitFilterBlocked::filter_offdiag_row_mat_generic(DT_* mat,
const IT_*
const row_ptr,
int block_height,
int block_width,
107 const DT_ *
const sv_elements,
const IT_ *
const sv_indices,
const Index ue,
bool ign_nans)
109 FEAT_PRAGMA_OMP(parallel
for)
110 for(
Index i = 0; i < ue; ++i)
112 const IT_ ix(sv_indices[i]);
113 const DT_*
const vx(&sv_elements[i*
Index(block_height)]);
116 for(IT_ j(row_ptr[ix]); j < row_ptr[ix + 1]; ++j)
119 for(
int k(0); k < block_height; ++k)
124 for(
int l(0); l < block_width; ++l)
125 mat[
Index(j)*
Index(block_height*block_width) +
Index(k*block_width + l)] = DT_(0);
131 template<
typename DT_,
typename IT_>
132 void UnitFilterBlocked::filter_weak_matrix_rows_generic(DT_* mat_a,
const DT_ *
const mat_m,
const IT_*
const row_ptr,
int block_height,
int block_width,
133 const DT_ *
const sv_elements,
const IT_ *
const sv_indices,
const Index ue)
135 FEAT_PRAGMA_OMP(parallel
for)
136 for(
Index i = 0; i < ue; ++i)
138 const IT_ ix(sv_indices[i]);
139 const DT_*
const vx(&sv_elements[i*
Index(block_height)]);
142 for(IT_ j(row_ptr[ix]); j < row_ptr[ix + 1]; ++j)
145 for(
int k(0); k < block_height; ++k)
147 for(
int l(0); l < block_width; ++l)
bool isnan(T_ x)
Checks whether a value is Not-A-Number.
std::uint64_t Index
Index data type.