3#ifndef TETL_NUMERIC_INNER_PRODUCT_HPP
4#define TETL_NUMERIC_INNER_PRODUCT_HPP
6#include <etl/_utility/move.hpp>
14template <
typename InputIt1,
typename InputIt2,
typename T>
15[[nodiscard]]
constexpr auto inner_product(InputIt1 first1, InputIt1 last1, InputIt2 first2, T init) -> T
17 for (; first1 != last1; ++first1, ++first2) {
18 init =
etl::move(init) + *first1 * *first2;
24template <
typename InputIt1,
typename InputIt2,
typename T,
typename BinaryOperation1,
typename BinaryOperation2>
25[[nodiscard]]
constexpr auto
26inner_product(InputIt1 first1, InputIt1 last1, InputIt2 first2, T init, BinaryOperation1 op1, BinaryOperation2 op2) -> T
28 for (; first1 != last1; ++first1, ++first2) {
29 init = op1(
etl::move(init), op2(*first1, *first2));
constexpr auto inner_product(InputIt1 first1, InputIt1 last1, InputIt2 first2, T init, BinaryOperation1 op1, BinaryOperation2 op2) -> T
Definition inner_product.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:15
Definition adjacent_find.hpp:9