3#ifndef TETL_LINALG_BLAS1_DOT_HPP
4#define TETL_LINALG_BLAS1_DOT_HPP
6#include <etl/_contracts/check.hpp>
7#include <etl/_linalg/exposition.hpp>
8#include <etl/_type_traits/declval.hpp>
9#include <etl/_utility/cmp_equal.hpp>
14template <in_vector InVec1, in_vector InVec2,
typename Scalar>
15[[nodiscard]]
constexpr auto dot(InVec1 v1, InVec2 v2, Scalar init) -> Scalar
17 static_assert(detail::compatible_static_extents<InVec1, InVec2>(0, 0));
18 TETL_PRECONDITION(etl::cmp_equal(v1.extent(0), v2.extent(0)));
20 using index_type = detail::common_index_type_t<InVec1, InVec2>;
21 for (index_type i{0}; i <
static_cast<index_type>(v1.extent(0)); ++i) {
22 init +=
static_cast<Scalar>(v1(i)) *
static_cast<Scalar>(v2(i));
28template <in_vector InVec1, in_vector InVec2>
29[[nodiscard]]
constexpr auto dot(InVec1 v1, InVec2 v2)
31 using scalar_type =
decltype(declval<
typename InVec1::value_type>() * declval<
typename InVec2::value_type>());
32 return etl::
linalg::dot(v1, v2, scalar_type{});
constexpr auto dot(InVec1 v1, InVec2 v2)
Definition blas1_dot.hpp:29
constexpr auto dot(InVec1 v1, InVec2 v2, Scalar init) -> Scalar
Definition blas1_dot.hpp:15
Definition accessor_conjugate.hpp:13
Definition adjacent_find.hpp:9