type for summation (optional template parameter)
first n-dimensional tensor
second n-dimensional tensor BLAS: SDOT, DDOT, SDSDOT, DSDOT, CDOTC, ZDOTC
dot product conj(xᐪ) × y
SDOT, DDOT
import mir.ndslice.allocation: slice; auto x = slice!double(4); auto y = slice!double(4); x[] = [0, 1, 2, 3]; y[] = [4, 5, 6, 7]; assert(dot(x, y) == 5 + 12 + 21);
SDOT, DDOT
import mir.ndslice.allocation: slice; auto x = slice!double(4); auto y = slice!double(4); x[] = [0, 1, 2, 3]; y[] = [4, 5, 6, 7]; assert(dot(x, y) == 5 + 12 + 21);
SDSDOT, DSDOT
import mir.ndslice.allocation: slice; auto x = slice!float(4); auto y = slice!float(4); x[] = [0, 1, 2, 3]; y[] = [4, 5, 6, 7]; assert(dot!real(x, y) == 5 + 12 + 21); // 80-bit FP for x86 CPUs
CDOTU, ZDOTU
import mir.ndslice.allocation: slice; auto x = slice!cdouble(2); auto y = slice!cdouble(2); x[] = [0 + 1i, 2 + 3i]; y[] = [4 + 5i, 6 + 7i]; version(LDC) // DMD Internal error: backend/cgxmm.c 628 assert(dot(x, y) == (0 + 1i) * (4 + 5i) + (2 + 3i) * (6 + 7i));
Forms the dot product of two vectors. Uses unrolled loops for strides equal to one.