NumCpp  2.16.1
A Templatized Header Only C++ Implementation of the Python NumPy Library
Loading...
Searching...
No Matches
inner.hpp
Go to the documentation of this file.
1
28#pragma once
29
30#include <algorithm>
31
35#include "NumCpp/NdArray.hpp"
36
37namespace nc
38{
39 //============================================================================
40 // Method Description:
49 template<typename dtype>
51 {
53
54 if (a.size() != b.size())
55 {
56 THROW_INVALID_ARGUMENT_ERROR("Inputs 'a' and 'b' must have the same size");
57 }
58
59 return stl_algorithms::transform_reduce(a.cbegin(), a.cend(), b.cbegin(), dtype{ 0 });
60 }
61} // namespace nc
#define THROW_INVALID_ARGUMENT_ERROR(msg)
Definition Error.hpp:37
#define STATIC_ASSERT_ARITHMETIC_OR_COMPLEX(dtype)
Definition StaticAsserts.hpp:56
Holds 1D and 2D arrays, the main work horse of the NumCpp library.
Definition NdArrayCore.hpp:139
size_type size() const noexcept
Definition NdArrayCore.hpp:4604
const_iterator cbegin() const noexcept
Definition NdArrayCore.hpp:1365
const_iterator cend() const noexcept
Definition NdArrayCore.hpp:1673
T transform_reduce(ForwardIt1 first1, ForwardIt1 last1, ForwardIt2 first2, T init)
Definition StlAlgorithms.hpp:825
Definition Cartesian.hpp:40
NdArray< dtype > arange(dtype inStart, dtype inStop, dtype inStep=1)
Definition arange.hpp:59
dtype inner(const NdArray< dtype > &a, const NdArray< dtype > &b)
Definition inner.hpp:50