46 template<
typename dtype>
49 return inArray1.
dot(inArray2);
65 template<
typename dtype>
70 const auto shape1 = inArray1.
shape();
71 const auto shape2 = inArray2.shape();
73 if (shape1 == shape2 && (shape1.rows == 1 || shape1.cols == 1))
75 const std::complex<dtype> dotProduct =
76 std::inner_product(inArray1.
cbegin(), inArray1.
cend(), inArray2.cbegin(), std::complex<dtype>{ 0 });
80 if (shape1.cols == shape2.rows)
84 auto array2T = inArray2.transpose();
86 for (
uint32 i = 0; i < shape1.rows; ++i)
90 returnArray(i,
j) = std::inner_product(array2T.cbegin(
j),
93 std::complex<dtype>{ 0 });
102 errStr +=
" are not consistent.";
121 template<
typename dtype>
126 const auto shape1 = inArray1.shape();
127 const auto shape2 = inArray2.
shape();
129 if (shape1 == shape2 && (shape1.rows == 1 || shape1.cols == 1))
131 const std::complex<dtype> dotProduct =
132 std::inner_product(inArray1.cbegin(), inArray1.cend(), inArray2.
cbegin(), std::complex<dtype>{ 0 });
136 if (shape1.cols == shape2.rows)
142 for (
uint32 i = 0; i < shape1.rows; ++i)
146 returnArray(i,
j) = std::inner_product(array2T.cbegin(
j),
149 std::complex<dtype>{ 0 });
158 errStr +=
" are not consistent.";
#define THROW_INVALID_ARGUMENT_ERROR(msg)
Definition: Error.hpp:37
#define STATIC_ASSERT_ARITHMETIC(dtype)
Definition: StaticAsserts.hpp:39
Holds 1D and 2D arrays, the main work horse of the NumCpp library.
Definition: NdArrayCore.hpp:139
const_iterator cbegin() const noexcept
Definition: NdArrayCore.hpp:1365
self_type transpose() const
Definition: NdArrayCore.hpp:4882
self_type dot(const self_type &inOtherArray) const
Definition: NdArrayCore.hpp:2719
const Shape & shape() const noexcept
Definition: NdArrayCore.hpp:4511
const_iterator cend() const noexcept
Definition: NdArrayCore.hpp:1673
constexpr auto j
Definition: Core/Constants.hpp:42
std::string num2str(dtype inNumber)
Definition: num2str.hpp:44
Definition: Cartesian.hpp:40
NdArray< dtype > dot(const NdArray< dtype > &inArray1, const NdArray< dtype > &inArray2)
Definition: dot.hpp:47
std::uint32_t uint32
Definition: Types.hpp:40