39 #ifndef SHARK_LINALG_DIFFERENCEKERNELMATRIX_H 40 #define SHARK_LINALG_DIFFERENCEKERNELMATRIX_H 63 template <
class InputType,
class CacheType>
73 std::vector<std::pair<std::size_t, std::size_t>>
const& pairs)
79 for (std::size_t i=0; i<pairs.size(); i++)
81 std::pair<std::size_t, std::size_t>
const& p = pairs[i];
91 {
return entry(i, j); }
94 QpFloatType
entry(std::size_t i, std::size_t j)
const 96 std::tuple<std::size_t, std::size_t, std::size_t, std::size_t>
const& pi =
m_indices[i];
97 std::tuple<std::size_t, std::size_t, std::size_t, std::size_t>
const& pj =
m_indices[j];
98 std::size_t batch_si = std::get<0>(pi);
99 std::size_t index_si = std::get<1>(pi);
100 std::size_t batch_gi = std::get<2>(pi);
101 std::size_t index_gi = std::get<3>(pi);
102 std::size_t batch_sj = std::get<0>(pj);
103 std::size_t index_sj = std::get<1>(pj);
104 std::size_t batch_gj = std::get<2>(pj);
105 std::size_t index_gj = std::get<3>(pj);
115 return (k_gi_gj - k_gi_sj - k_si_gj + k_si_sj);
122 void row(std::size_t i, std::size_t start, std::size_t end, QpFloatType* storage)
const {
123 for (std::size_t j = start; j < end; j++) storage[j-start] =
entry(i, j);
128 void matrix(blas::matrix_expression<M, blas::cpu_tag>& storage)
const {
129 for (std::size_t i = 0; i !=
size(); ++i) {
130 for (std::size_t j = 0; j !=
size(); ++j) {
131 storage()(i, j) =
entry(i, j);
155 std::vector<std::tuple<std::size_t, std::size_t, std::size_t, std::size_t>>
m_indices;