2#ifndef TETL_NUMERIC_INNER_PRODUCT_HPP
3#define TETL_NUMERIC_INNER_PRODUCT_HPP
13template <
typename InputIt1,
typename InputIt2,
typename T>
14[[nodiscard]]
constexpr auto inner_product(InputIt1 first1, InputIt1 last1, InputIt2 first2, T init) -> T
16 for (; first1 != last1; ++first1, ++first2) {
17 init =
etl::move(init) + *first1 * *first2;
23template <
typename InputIt1,
typename InputIt2,
typename T,
typename BinaryOperation1,
typename BinaryOperation2>
24[[nodiscard]]
constexpr auto
25inner_product(InputIt1 first1, InputIt1 last1, InputIt2 first2, T init, BinaryOperation1 op1, BinaryOperation2 op2) -> T
27 for (; first1 != last1; ++first1, ++first2) {
28 init = op1(
etl::move(init), op2(*first1, *first2));
constexpr auto move(InputIt first, InputIt last, OutputIt destination) -> OutputIt
Moves the elements in the range [first, last), to another range beginning at destination,...
Definition move.hpp:26
constexpr auto inner_product(InputIt1 first1, InputIt1 last1, InputIt2 first2, T init) -> T
Computes inner product (i.e. sum of products) or performs ordered map/reduce operation on the range [...
Definition inner_product.hpp:14
Definition adjacent_find.hpp:8