Computes inner product (i.e. sum of products).
Computes the generalized sum of products of the elements of two product types. By default, + and * is used.
namespace kumi::result
{
template<product_type S1, sized_product_type<S1::size()> S2, typename T>
template<product_type S1, sized_product_type<S1::size()> S2, typename T
, typename Sum, typename Prod
>
template<product_type S1, sized_product_type<S1::size()> S2, typename T>
template< product_type S1, sized_product_type<S1::size()> S2, typename T
, typename Sum, typename Prod
>
}
constexpr auto inner_product(S1 &&s1, S2 &&s2, T init, Sum sum, Prod prod) noexcept
Computes inner product (i.e. sum of products).
Definition inner_product.hpp:87
#include <kumi/kumi.hpp>
#include <iostream>
#include <vector>
int main()
{
using namespace kumi::literals;
auto bits =
kumi::record{
"a"_id = 1,
"b"_id = 0,
"c"_id = 1,
"d"_id = 0,
"e"_id = 0,
"f"_id = 1};
auto base =
kumi::record{
"f"_id = 32,
"e"_id = 16,
"d"_id = 8,
"c"_id = 4,
"b"_id = 2,
"a"_id = 1};
std::cout << 0b101001L << "\n";
}
Fixed-size collection of heterogeneous fields necessarily named, names are unique.
Definition record.hpp:29