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 = std::inner_product(inArray1.
cbegin(), inArray1.
cend(),
76 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), array2T.cend(
j),
91 inArray1.
cbegin(i), std::complex<dtype>{0});
100 errStr +=
" are not consistent.";
119 template<
typename dtype>
124 const auto shape1 = inArray1.shape();
125 const auto shape2 = inArray2.
shape();
127 if (shape1 == shape2 && (shape1.rows == 1 || shape1.cols == 1))
129 const std::complex<dtype> dotProduct = std::inner_product(inArray1.cbegin(), inArray1.cend(),
130 inArray2.
cbegin(), std::complex<dtype>{0});
134 if (shape1.cols == shape2.rows)
140 for (
uint32 i = 0; i < shape1.rows; ++i)
144 returnArray(i,
j) = std::inner_product(array2T.cbegin(
j), array2T.cend(
j),
145 inArray1.cbegin(i), std::complex<dtype>{0});
154 errStr +=
" are not consistent.";
#define THROW_INVALID_ARGUMENT_ERROR(msg)
Definition: Error.hpp:36
#define STATIC_ASSERT_ARITHMETIC(dtype)
Definition: StaticAsserts.hpp:37
Holds 1D and 2D arrays, the main work horse of the NumCpp library.
Definition: NdArrayCore.hpp:72
const_iterator cbegin() const noexcept
Definition: NdArrayCore.hpp:1270
Shape shape() const noexcept
Definition: NdArrayCore.hpp:4483
NdArray< dtype > transpose() const
Definition: NdArrayCore.hpp:4830
const_iterator cend() const noexcept
Definition: NdArrayCore.hpp:1614
NdArray< dtype > dot(const NdArray< dtype > &inOtherArray) const
Definition: NdArrayCore.hpp:2788
constexpr auto j
Definition: Constants.hpp:45
std::string num2str(dtype inNumber)
Definition: num2str.hpp:46
Definition: Coordinate.hpp:45
NdArray< dtype > dot(const NdArray< dtype > &inArray1, const NdArray< dtype > &inArray2)
Definition: dot.hpp:47
std::uint32_t uint32
Definition: Types.hpp:40