okami.mom/strata

git clone https://git.nkp.pet/okami.mom/strata

Niko1221Merge branch 'f-139b-arc' into f-139-relad33b8074

main
1.2 KiB32 linesraw
1//==---- numeric.h --------------------------------*- C++ -*----------------==//
2//
3// Copyright (C) Intel Corporation
4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
5// See https://llvm.org/LICENSE.txt for license information.
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef __DPCT_NUMERIC_H__
10#define __DPCT_NUMERIC_H__
11
12namespace dpct {
13
14template <typename Policy, typename InputIt1, typename InputIt2, typename T>
15T inner_product(Policy &&policy, InputIt1 first1, InputIt1 last1,
16                InputIt2 first2, T init) {
17  return std::transform_reduce(std::forward<Policy>(policy), first1, last1,
18                               first2, init);
19}
20
21template <typename Policy, typename InputIt1, typename InputIt2, typename T,
22          typename BinaryOperation1, typename BinaryOperation2>
23T inner_product(Policy &&policy, InputIt1 first1, InputIt1 last1,
24                InputIt2 first2, T init, BinaryOperation1 op1,
25                BinaryOperation2 op2) {
26  return std::transform_reduce(std::forward<Policy>(policy), first1, last1,
27                               first2, init, op1, op2);
28}
29
30} // end namespace dpct
31
32#endif