|
4 | 4 |
|
5 | 5 | #pragma once |
6 | 6 |
|
7 | | -#include <numeric> |
8 | | - |
9 | 7 | #include "common/type_traits/function_traits.h" |
10 | | -#include "common/vector-product.h" |
11 | 8 | #include "runtime-common/core/runtime-core.h" |
12 | 9 | #include "runtime-common/stdlib/array/array-functions.h" |
13 | 10 | #include "runtime/math_functions.h" |
@@ -178,54 +175,6 @@ void f$shuffle(array<T>& a) { |
178 | 175 | a = std::move(result); |
179 | 176 | } |
180 | 177 |
|
181 | | -template<class T> |
182 | | -T vk_dot_product_sparse(const array<T>& a, const array<T>& b) { |
183 | | - T result = T(); |
184 | | - for (const auto& it : a) { |
185 | | - const auto* b_val = b.find_value(it); |
186 | | - if (b_val && !f$is_null(*b_val)) { |
187 | | - result += it.get_value() * (*b_val); |
188 | | - } |
189 | | - } |
190 | | - return result; |
191 | | -} |
192 | | - |
193 | | -template<class T> |
194 | | -T vk_dot_product_dense(const array<T>& a, const array<T>& b) { |
195 | | - static_assert(!std::is_same<T, int>{}, "int is forbidden"); |
196 | | - |
197 | | - T result = T(); |
198 | | - int64_t size = min(a.count(), b.count()); |
199 | | - for (int64_t i = 0; i < size; i++) { |
200 | | - result += a.get_value(i) * b.get_value(i); |
201 | | - } |
202 | | - return result; |
203 | | -} |
204 | | - |
205 | | -template<> |
206 | | -inline int64_t vk_dot_product_dense<int64_t>(const array<int64_t>& a, const array<int64_t>& b) { |
207 | | - const int64_t size = min(a.count(), b.count()); |
208 | | - const int64_t* ap = a.get_const_vector_pointer(); |
209 | | - const int64_t* bp = b.get_const_vector_pointer(); |
210 | | - return std::inner_product(ap, ap + size, bp, 0L); |
211 | | -} |
212 | | - |
213 | | -template<> |
214 | | -inline double vk_dot_product_dense<double>(const array<double>& a, const array<double>& b) { |
215 | | - int64_t size = min(a.count(), b.count()); |
216 | | - const double* ap = a.get_const_vector_pointer(); |
217 | | - const double* bp = b.get_const_vector_pointer(); |
218 | | - return __dot_product(ap, bp, static_cast<int>(size)); |
219 | | -} |
220 | | - |
221 | | -template<class T> |
222 | | -T f$vk_dot_product(const array<T>& a, const array<T>& b) { |
223 | | - if (a.is_vector() && b.is_vector()) { |
224 | | - return vk_dot_product_dense<T>(a, b); |
225 | | - } |
226 | | - return vk_dot_product_sparse<T>(a, b); |
227 | | -} |
228 | | - |
229 | 178 | template<typename Result, typename U, typename Comparator> |
230 | 179 | Result array_functions_impl_::async_sort([[maybe_unused]] array<U>& arr, [[maybe_unused]] Comparator comparator, [[maybe_unused]] bool renumber) noexcept { |
231 | 180 | struct async_sort_stub_class {}; |
|
0 commit comments