Template Function librapid::dot(First&&, Second&&)#
Defined in File arrayMultiply.hpp
Function Documentation#
-
template<typename First, typename Second, typename std::enable_if_t<IsArrayType<First>::value && IsArrayType<Second>::value, int> = 0>
auto librapid::dot(First &&a, Second &&b)# Computes the dot product of two arrays.
This function calculates the dot product of two arrays.
If the input arrays are 1-dimensional vectors, this function computes the vector-dot product \( \mathbf{a} \cdot \mathbf{b} = a_1b_1 + a_2b_2 + \ldots + a_nb_n \). Note that the return value will be a 1x1 array (i.e. a scalar) since we cannot return a scalar directly.
If the left input is a 2-dimensional matrix and the right input is a 1-dimensional vector, this function computes the matrix-vector product \( y_i = \sum_{j=1}^{n} a_{ij} x_j \) for \( i = 1, \ldots, m \).
If both inputs are 2-dimensional matrices, this function computes the matrix-matrix product \( c_{ij} = \sum_{k=1}^{n} a_{ik} b_{kj} \) for \( i = 1, \ldots, m \) and \( j = 1, \ldots, p \).
- Template Parameters
StorageTypeA – The storage type of the left input array.
StorageTypeB – The storage type of the right input array.
- Parameters
a – The left input array.
b – The right input array.
- Returns
The dot product of the two input arrays.